this repo has no description
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

add set-labels, pt-br translations, update packages, cli-test playground

alice e79ae691 0ae9b216

+192 -88
+24 -5
cli-test.ts src/cli-test.ts
··· 5 5 import { z } from 'zod'; 6 6 import { AtpAgent } from '@atproto/api'; 7 7 import 'dotenv/config'; 8 + import { anthropic } from '@ai-sdk/anthropic'; 8 9 9 10 const agent = new AtpAgent({ 10 11 service: process.env.BSKY_SERVICE ?? 'https://bsky.social', ··· 54 55 } 55 56 await fs.writeFile(avatar, canvas.toBuffer()); 56 57 58 + // const prompt = ` 59 + // 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? 60 + 61 + // 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. 62 + // Always return an answer — house name only, all lowercase. 63 + // The user's data may be in any language. Focus on the meaning, not just the surface content. 64 + // Consider traits for all houses, not just intellect. 65 + // 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. 66 + 67 + // The user's data is as follows: 68 + 69 + // Name: ${subject.displayName || subject.handle} (@${subject.handle}) 70 + // Bio: ${subject.description || 'User has no bio.'} 71 + // `; 72 + 73 + 57 74 const prompt = ` 58 75 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? 59 76 ··· 61 78 Always return an answer — house name only, all lowercase. 62 79 The user's data may be in any language. Focus on the meaning, not just the surface content. 63 80 Consider traits for all houses, not just intellect. 64 - 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. 81 + You're 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. 65 82 66 83 The user's data is as follows: 67 84 ··· 69 86 Bio: ${subject.description || 'User has no bio.'} 70 87 `; 71 88 89 + 72 90 console.log(prompt); 73 91 74 92 generateText({ 75 - model: openai('gpt-4o', {}), 93 + model: openai('gpt-4o-mini'), 94 + // model: anthropic('claude-3-haiku-20240307'), 76 95 messages: [ 77 96 { 78 97 role: 'user', ··· 84 103 { 85 104 type: 'image', 86 105 image: canvas.toBuffer(), 87 - experimental_providerMetadata: { 88 - openai: { imageDetail: 'low' }, 89 - }, 106 + // experimental_providerMetadata: { 107 + // openai: { imageDetail: 'low' }, 108 + // }, 90 109 }, 91 110 ], 92 111 },
+98 -81
package-lock.json
··· 8 8 "name": "pronouns-bsky", 9 9 "version": "1.0.0", 10 10 "dependencies": { 11 + "@ai-sdk/anthropic": "^0.0.49", 11 12 "@ai-sdk/openai": "^0.0.58", 12 13 "@atproto/api": "^0.13.0", 13 14 "@skyware/firehose": "^0.3.1", ··· 21 22 "@types/better-sqlite3": "^7.6.11", 22 23 "@types/node": "^20.14.10", 23 24 "typescript": "^5.5.3" 25 + } 26 + }, 27 + "node_modules/@ai-sdk/anthropic": { 28 + "version": "0.0.49", 29 + "resolved": "https://registry.npmjs.org/@ai-sdk/anthropic/-/anthropic-0.0.49.tgz", 30 + "integrity": "sha512-RBMRJqnsfl1mkuNsdWSfuz64knKUCocF9wB6GySfprZZYyKtLsHK1aIqJBOjcQP8TX70wxwCC3FUrpALKAEokg==", 31 + "license": "Apache-2.0", 32 + "dependencies": { 33 + "@ai-sdk/provider": "0.0.23", 34 + "@ai-sdk/provider-utils": "1.0.18" 35 + }, 36 + "engines": { 37 + "node": ">=18" 38 + }, 39 + "peerDependencies": { 40 + "zod": "^3.0.0" 24 41 } 25 42 }, 26 43 "node_modules/@ai-sdk/openai": { ··· 785 802 } 786 803 }, 787 804 "node_modules/@skyware/labeler": { 788 - "version": "0.1.5", 789 - "resolved": "https://registry.npmjs.org/@skyware/labeler/-/labeler-0.1.5.tgz", 790 - "integrity": "sha512-JuWIXdiSikYm+qHLWpGJFL8xx6MLRRECmaY5wSpTlcBgiALiiHRhXzVrz63mn9qy5MtZLqWS9R/F4ixc22+u9w==", 805 + "version": "0.1.6", 806 + "resolved": "https://registry.npmjs.org/@skyware/labeler/-/labeler-0.1.6.tgz", 807 + "integrity": "sha512-qz1uNetOA+VpXvwu2yu1N5BvSXYcTqodQZ1CW1akHT48hwcSOQIfl9Kdq0afafbKa5YCrEuTJcWNGUM+kSs3Jg==", 791 808 "license": "MPL-2.0", 792 809 "dependencies": { 793 810 "@atcute/cbor": "^1.0.0", ··· 1477 1494 "node": ">=6" 1478 1495 } 1479 1496 }, 1480 - "node_modules/canvas/node_modules/decompress-response": { 1481 - "version": "4.2.1", 1482 - "resolved": "https://registry.npmjs.org/decompress-response/-/decompress-response-4.2.1.tgz", 1483 - "integrity": "sha512-jOSne2qbyE+/r8G1VU+G/82LBs2Fs4LAsTiLSHOCOMZQl2OKZ6i8i4IyHemTe+/yIXOtTcRQMzPcgyhoFlqPkw==", 1484 - "license": "MIT", 1485 - "dependencies": { 1486 - "mimic-response": "^2.0.0" 1487 - }, 1488 - "engines": { 1489 - "node": ">=8" 1490 - } 1491 - }, 1492 - "node_modules/canvas/node_modules/mimic-response": { 1493 - "version": "2.1.0", 1494 - "resolved": "https://registry.npmjs.org/mimic-response/-/mimic-response-2.1.0.tgz", 1495 - "integrity": "sha512-wXqjST+SLt7R009ySCglWBCFpjUygmCIfD790/kVbiGmUgfYGuB14PiTd5DwVxSV4NcYHjzMkoj5LjQZwTQLEA==", 1496 - "license": "MIT", 1497 - "engines": { 1498 - "node": ">=8" 1499 - }, 1500 - "funding": { 1501 - "url": "https://github.com/sponsors/sindresorhus" 1502 - } 1503 - }, 1504 - "node_modules/canvas/node_modules/simple-get": { 1505 - "version": "3.1.1", 1506 - "resolved": "https://registry.npmjs.org/simple-get/-/simple-get-3.1.1.tgz", 1507 - "integrity": "sha512-CQ5LTKGfCpvE1K0n2us+kuMPbk/q0EKl82s4aheV9oXjFEz6W/Y7oQFVJuU6QG77hRT4Ghb5RURteF5vnWjupA==", 1508 - "license": "MIT", 1509 - "dependencies": { 1510 - "decompress-response": "^4.2.0", 1511 - "once": "^1.3.1", 1512 - "simple-concat": "^1.0.0" 1513 - } 1514 - }, 1515 1497 "node_modules/cbor-extract": { 1516 1498 "version": "2.2.0", 1517 1499 "resolved": "https://registry.npmjs.org/cbor-extract/-/cbor-extract-2.2.0.tgz", ··· 1565 1547 } 1566 1548 }, 1567 1549 "node_modules/chownr": { 1568 - "version": "1.1.4", 1569 - "resolved": "https://registry.npmjs.org/chownr/-/chownr-1.1.4.tgz", 1570 - "integrity": "sha512-jJ0bqzaylmJtVnNgzTeSOs8DPavpbYgEr/b0YL8/2GO3xJEhInFmhKMUnEJQjZumK7KXGFhUy89PrsJWlakBVg==", 1571 - "license": "ISC" 1550 + "version": "2.0.0", 1551 + "resolved": "https://registry.npmjs.org/chownr/-/chownr-2.0.0.tgz", 1552 + "integrity": "sha512-bIomtDF5KGpdogkLd9VspvFzk9KfpyyGlS8YFVZl7TGPBHL5snIOnxeshwVgPteQ9b4Eydl+pVbIyE1DcvCWgQ==", 1553 + "license": "ISC", 1554 + "engines": { 1555 + "node": ">=10" 1556 + } 1572 1557 }, 1573 1558 "node_modules/client-only": { 1574 1559 "version": "0.0.1", ··· 1690 1675 } 1691 1676 }, 1692 1677 "node_modules/decompress-response": { 1693 - "version": "6.0.0", 1694 - "resolved": "https://registry.npmjs.org/decompress-response/-/decompress-response-6.0.0.tgz", 1695 - "integrity": "sha512-aW35yZM6Bb/4oJlZncMH2LCoZtJXTRxES17vE3hoRiowU2kWHaJKFkSBDnDR+cm9J+9QhXmREyIfv0pji9ejCQ==", 1678 + "version": "4.2.1", 1679 + "resolved": "https://registry.npmjs.org/decompress-response/-/decompress-response-4.2.1.tgz", 1680 + "integrity": "sha512-jOSne2qbyE+/r8G1VU+G/82LBs2Fs4LAsTiLSHOCOMZQl2OKZ6i8i4IyHemTe+/yIXOtTcRQMzPcgyhoFlqPkw==", 1696 1681 "license": "MIT", 1697 1682 "dependencies": { 1698 - "mimic-response": "^3.1.0" 1683 + "mimic-response": "^2.0.0" 1699 1684 }, 1700 1685 "engines": { 1701 - "node": ">=10" 1702 - }, 1703 - "funding": { 1704 - "url": "https://github.com/sponsors/sindresorhus" 1686 + "node": ">=8" 1705 1687 } 1706 1688 }, 1707 1689 "node_modules/deep-extend": { ··· 2760 2742 } 2761 2743 }, 2762 2744 "node_modules/mimic-response": { 2763 - "version": "3.1.0", 2764 - "resolved": "https://registry.npmjs.org/mimic-response/-/mimic-response-3.1.0.tgz", 2765 - "integrity": "sha512-z0yWI+4FDrrweS8Zmt4Ej5HdJmky15+L2e6Wgn3+iK5fWzb6T3fhNFq2+MeTRb064c6Wr4N/wv0DzQTjNzHNGQ==", 2745 + "version": "2.1.0", 2746 + "resolved": "https://registry.npmjs.org/mimic-response/-/mimic-response-2.1.0.tgz", 2747 + "integrity": "sha512-wXqjST+SLt7R009ySCglWBCFpjUygmCIfD790/kVbiGmUgfYGuB14PiTd5DwVxSV4NcYHjzMkoj5LjQZwTQLEA==", 2766 2748 "license": "MIT", 2767 2749 "engines": { 2768 - "node": ">=10" 2750 + "node": ">=8" 2769 2751 }, 2770 2752 "funding": { 2771 2753 "url": "https://github.com/sponsors/sindresorhus" ··· 3216 3198 "node": ">=10" 3217 3199 } 3218 3200 }, 3201 + "node_modules/prebuild-install/node_modules/decompress-response": { 3202 + "version": "6.0.0", 3203 + "resolved": "https://registry.npmjs.org/decompress-response/-/decompress-response-6.0.0.tgz", 3204 + "integrity": "sha512-aW35yZM6Bb/4oJlZncMH2LCoZtJXTRxES17vE3hoRiowU2kWHaJKFkSBDnDR+cm9J+9QhXmREyIfv0pji9ejCQ==", 3205 + "license": "MIT", 3206 + "dependencies": { 3207 + "mimic-response": "^3.1.0" 3208 + }, 3209 + "engines": { 3210 + "node": ">=10" 3211 + }, 3212 + "funding": { 3213 + "url": "https://github.com/sponsors/sindresorhus" 3214 + } 3215 + }, 3216 + "node_modules/prebuild-install/node_modules/mimic-response": { 3217 + "version": "3.1.0", 3218 + "resolved": "https://registry.npmjs.org/mimic-response/-/mimic-response-3.1.0.tgz", 3219 + "integrity": "sha512-z0yWI+4FDrrweS8Zmt4Ej5HdJmky15+L2e6Wgn3+iK5fWzb6T3fhNFq2+MeTRb064c6Wr4N/wv0DzQTjNzHNGQ==", 3220 + "license": "MIT", 3221 + "engines": { 3222 + "node": ">=10" 3223 + }, 3224 + "funding": { 3225 + "url": "https://github.com/sponsors/sindresorhus" 3226 + } 3227 + }, 3228 + "node_modules/prebuild-install/node_modules/simple-get": { 3229 + "version": "4.0.1", 3230 + "resolved": "https://registry.npmjs.org/simple-get/-/simple-get-4.0.1.tgz", 3231 + "integrity": "sha512-brv7p5WgH0jmQJr1ZDDfKDOSeWWg+OVypG99A/5vYGPqJ6pxiaHLy8nxtFjBA7oMa01ebA9gfh1uMCFqOuXxvA==", 3232 + "funding": [ 3233 + { 3234 + "type": "github", 3235 + "url": "https://github.com/sponsors/feross" 3236 + }, 3237 + { 3238 + "type": "patreon", 3239 + "url": "https://www.patreon.com/feross" 3240 + }, 3241 + { 3242 + "type": "consulting", 3243 + "url": "https://feross.org/support" 3244 + } 3245 + ], 3246 + "license": "MIT", 3247 + "dependencies": { 3248 + "decompress-response": "^6.0.0", 3249 + "once": "^1.3.1", 3250 + "simple-concat": "^1.0.0" 3251 + } 3252 + }, 3219 3253 "node_modules/process": { 3220 3254 "version": "0.11.10", 3221 3255 "resolved": "https://registry.npmjs.org/process/-/process-0.11.10.tgz", ··· 3606 3640 "license": "MIT" 3607 3641 }, 3608 3642 "node_modules/simple-get": { 3609 - "version": "4.0.1", 3610 - "resolved": "https://registry.npmjs.org/simple-get/-/simple-get-4.0.1.tgz", 3611 - "integrity": "sha512-brv7p5WgH0jmQJr1ZDDfKDOSeWWg+OVypG99A/5vYGPqJ6pxiaHLy8nxtFjBA7oMa01ebA9gfh1uMCFqOuXxvA==", 3612 - "funding": [ 3613 - { 3614 - "type": "github", 3615 - "url": "https://github.com/sponsors/feross" 3616 - }, 3617 - { 3618 - "type": "patreon", 3619 - "url": "https://www.patreon.com/feross" 3620 - }, 3621 - { 3622 - "type": "consulting", 3623 - "url": "https://feross.org/support" 3624 - } 3625 - ], 3643 + "version": "3.1.1", 3644 + "resolved": "https://registry.npmjs.org/simple-get/-/simple-get-3.1.1.tgz", 3645 + "integrity": "sha512-CQ5LTKGfCpvE1K0n2us+kuMPbk/q0EKl82s4aheV9oXjFEz6W/Y7oQFVJuU6QG77hRT4Ghb5RURteF5vnWjupA==", 3626 3646 "license": "MIT", 3627 3647 "dependencies": { 3628 - "decompress-response": "^6.0.0", 3648 + "decompress-response": "^4.2.0", 3629 3649 "once": "^1.3.1", 3630 3650 "simple-concat": "^1.0.0" 3631 3651 } ··· 3818 3838 "tar-stream": "^2.1.4" 3819 3839 } 3820 3840 }, 3841 + "node_modules/tar-fs/node_modules/chownr": { 3842 + "version": "1.1.4", 3843 + "resolved": "https://registry.npmjs.org/chownr/-/chownr-1.1.4.tgz", 3844 + "integrity": "sha512-jJ0bqzaylmJtVnNgzTeSOs8DPavpbYgEr/b0YL8/2GO3xJEhInFmhKMUnEJQjZumK7KXGFhUy89PrsJWlakBVg==", 3845 + "license": "ISC" 3846 + }, 3821 3847 "node_modules/tar-stream": { 3822 3848 "version": "2.2.0", 3823 3849 "resolved": "https://registry.npmjs.org/tar-stream/-/tar-stream-2.2.0.tgz", ··· 3832 3858 }, 3833 3859 "engines": { 3834 3860 "node": ">=6" 3835 - } 3836 - }, 3837 - "node_modules/tar/node_modules/chownr": { 3838 - "version": "2.0.0", 3839 - "resolved": "https://registry.npmjs.org/chownr/-/chownr-2.0.0.tgz", 3840 - "integrity": "sha512-bIomtDF5KGpdogkLd9VspvFzk9KfpyyGlS8YFVZl7TGPBHL5snIOnxeshwVgPteQ9b4Eydl+pVbIyE1DcvCWgQ==", 3841 - "license": "ISC", 3842 - "engines": { 3843 - "node": ">=10" 3844 3861 } 3845 3862 }, 3846 3863 "node_modules/thread-stream": {
+1
package.json
··· 12 12 "typescript": "^5.5.3" 13 13 }, 14 14 "dependencies": { 15 + "@ai-sdk/anthropic": "^0.0.49", 15 16 "@ai-sdk/openai": "^0.0.58", 16 17 "@atproto/api": "^0.13.0", 17 18 "@skyware/firehose": "^0.3.1",
+2 -2
src/label.ts
··· 95 95 const prompt = createPrompt(data); 96 96 97 97 await generateText({ 98 - model: openai('gpt-4o'), 98 + model: openai('gpt-4o-mini'), 99 99 messages: [ 100 100 { 101 101 role: 'user', ··· 133 133 } 134 134 135 135 async function prepareAvatar(subject: AppBskyActorDefs.ProfileView) { 136 - const size = 100; 136 + const size = 150; 137 137 const canvas = createCanvas(size, size); 138 138 const ctx = canvas.getContext('2d'); 139 139
+67
src/set-labels.ts
··· 1 + import { setLabelerLabelDefinitions, type LoginCredentials } from '@skyware/labeler/scripts'; 2 + import { type ComAtprotoLabelDefs } from '@atproto/api'; 3 + import 'dotenv/config'; 4 + 5 + const LABELS = [ 6 + { 7 + identifier: 'ravenclaw', 8 + enName: 'Ravenclaw 🦅', 9 + enDescription: 'Wise, creative, and curious.', 10 + ptName: 'Corvinal 🦅', 11 + ptDescription: 'Sábio, criativo e curioso.', 12 + }, 13 + { 14 + identifier: 'slytherin', 15 + enName: 'Slytherin 🐍', 16 + enDescription: 'Ambitious, cunning, and resourceful.', 17 + ptName: 'Sonserina 🐍', 18 + ptDescription: 'Ambicioso, astuto e engenhoso.', 19 + }, 20 + { 21 + identifier: 'gryffindor', 22 + enName: 'Gryffindor 🦁', 23 + enDescription: 'Brave, bold, and daring.', 24 + ptName: 'Grifinória 🦁', 25 + ptDescription: 'Corajoso, ousado e destemido.', 26 + }, 27 + { 28 + identifier: 'hufflepuff', 29 + enName: 'Hufflepuff 🦡', 30 + enDescription: 'Loyal, hardworking, and fair.', 31 + ptName: 'Lufa-Lufa 🦡', 32 + ptDescription: 'Leal, trabalhador e justo.', 33 + }, 34 + ] 35 + 36 + const loginCredentials: LoginCredentials = { 37 + identifier: process.env.BSKY_IDENTIFIER!, 38 + password: process.env.BSKY_PASSWORD!, 39 + }; 40 + 41 + const labelDefinitions: ComAtprotoLabelDefs.LabelValueDefinition[] = []; 42 + 43 + for (const label of LABELS) { 44 + const labelValueDefinition: ComAtprotoLabelDefs.LabelValueDefinition = { 45 + identifier: label.identifier, 46 + severity: 'inform', 47 + blurs: 'none', 48 + defaultSetting: 'warn', 49 + adultOnly: false, 50 + locales: [ 51 + { 52 + lang: 'en', 53 + name: label.enName, 54 + description: label.enDescription, 55 + }, 56 + { 57 + lang: 'pt-BR', 58 + name: label.ptName, 59 + description: label.ptDescription, 60 + }, 61 + ], 62 + }; 63 + 64 + labelDefinitions.push(labelValueDefinition); 65 + } 66 + 67 + await setLabelerLabelDefinitions(loginCredentials, labelDefinitions);