···17171818const did = agent.session!.did;
19192020-AtpAgent.configure({
2121- appLabelers: [did],
2222-});
2323-2420let userDid = process.argv[2];
25212622if (!userDid) {
···4440if (!data) throw new Error('Profile not found');
4541const subject = data;
46424747-if (subject.labels && subject.labels.some((label) => label.src === did)) {
4848- throw new Error('Already ' + subject.labels.find((label) => label.src === did)?.val);
4343+const size = 100;
4444+const canvas = createCanvas(size, size);
4545+const ctx = canvas.getContext('2d');
4646+4747+if (subject.avatar) {
4848+ const image = await loadImage(subject.avatar);
4949+ ctx.drawImage(image, 0, 0, size, size);
5050+} else {
5151+ console.log('No avatar found, using 1x1 white pixel');
5252+ ctx.fillStyle = 'white';
5353+ ctx.fillRect(0, 0, 1, 1);
4954}
5555+await fs.writeFile(avatar, canvas.toBuffer());
50565151-if (!subject.avatar) throw new Error('No avatar');
5757+// const prompt = `
5858+// You're the Sorting Hat from Harry Potter. Which house does the user with the profile data to follow belong to?
52595353-const image = await loadImage(subject.avatar);
5454-const canvas = createCanvas(100, 100);
5555-const ctx = canvas.getContext('2d');
5656-ctx.drawImage(image, 0, 0, 100, 100);
5757-await fs.writeFile(avatar, canvas.toBuffer());
6060+// The avatar of the user may be attached to this message.
6161+// If either the avatar or the bio is missing, focus on the available information.
6262+// Always return an answer. Answer with the name of the house only, all lowercase.
6363+// The user's data may be in any language. Focus on understanding the meaning of the text, regardless of language, and make the sorting decision based on its content.
6464+// Don't overindex on the user's information being too tech-related; try to find the person behind the information.
6565+// Analyze the content for traits that could apply to any house, not just intellect.
6666+// Most importantly, you're mischevious and playfully inclined to sort people in ways that are not always necessarily based on their actual traits, but may just be a reflection of your whims. This trait of yours is very strong, and you always consider it strongly when making your decision.
6767+6868+// The user's data is as follows:
6969+7070+// Name: ${subject.displayName || subject.handle} (@${subject.handle})
7171+// Bio: ${subject.description || 'User has no bio.'}
7272+// `;
7373+58745975const prompt = `
6060-You're the Sorting Hat from Harry Potter, operating on the microblogging platform / social network Bluesky. Which house does the user with the following profile data belong to?
7676+You're the Sorting Hat from Harry Potter. Which house does the user with the profile data at the end of this message belong to?
61776262-Name and handle: ${subject.displayName || subject.handle} (@${subject.handle})
6363-Bio: ${subject.description || 'User has no bio.'}
7878+Focus on the available information. If the avatar is not available, a 1x1 pixel white image is provided instead as a placeholder. Disregard the placeholder and focus on the user's data.
7979+Always return an answer — house name only, all lowercase.
8080+The user's data may be in any language. Focus on the meaning, not just the surface content.
8181+Consider traits for all houses, not just intellect.
8282+You're strongly mischievous and enjoy sorting based on whims, not always strictly following the user's traits; imagine as if you're a person who likes to play tricks on people.
64836565-The avatar of the user may be attached to this message.
6666-If either the avatar or the bio is missing, focus on the available information.
6767-Always return an answer. Answer with the name of the house only, all lowercase.
6868-The user's data may be in any language. Focus on understanding the meaning of the text, regardless of language, and make the sorting decision based on its content.
8484+The user's data is as follows:
8585+8686+Name: ${subject.displayName || subject.handle} (@${subject.handle})
8787+Bio: ${subject.description || 'User has no bio.'}
6988`;
70899090+// const prompt = `
9191+// You're the Sorting Hat from Harry Potter. Which house does the person with the following information belong to?
9292+9393+// Name: ${subject.displayName || subject.handle} (@${subject.handle})
9494+// Personal information: ${subject.description || 'None.'}
9595+9696+// The chosen appearance of the person may be attached to this message.
9797+// If either the chosen appearance or the personal information is missing, focus on whatever is available.
9898+// Always return an answer. Answer with the name of the house only, all lowercase.
9999+// The person's information may be in any language. Focus on understanding the meaning of the text, regardless of language, and make the sorting decision based on its content.
100100+// `;
101101+102102+// const prompt = `
103103+// You're the Sorting Hat from Harry Potter, operating on the microblogging platform / social network Bluesky. Which house does the user with the following profile data belong to?
104104+105105+// Name and handle: ${subject.displayName || subject.handle} (@${subject.handle})
106106+// Bio: ${subject.description || 'User has no bio.'}
107107+108108+// The avatar of the user may be attached to this message.
109109+// If either the avatar or the bio is missing, focus on the available information.
110110+// Always return an answer. Answer with the name of the house only, all lowercase.
111111+// The user's data may be in any language. Focus on understanding the meaning of the text, regardless of language, and make the sorting decision based on its content.
112112+// Don't overindex on the user's information being too tech-related; try to find the person behind the information.
113113+// Analyze the content for traits that could apply to any house, not just intellect.
114114+// Heavily bias towards the user's avatar, when available, as a primary source of information.
115115+// `;
116116+117117+71118console.log(prompt);
7211973120generateText({
7474- model: openai('gpt-4o'),
121121+ model: openai('gpt-4o', {
122122+123123+ }),
75124 messages: [
76125 {
77126 role: 'user',
···83132 {
84133 type: 'image',
85134 image: canvas.toBuffer(),
135135+ // experimental_providerMetadata: {
136136+ // openai: { imageDetail: 'low' },
137137+ // },
86138 },
87139 ],
88140 },