this repo has no description
0
fork

Configure Feed

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

tweaks

alice 8c465e12 3bff3658

+15 -9
+7 -4
cli-test.ts
··· 72 72 console.log(prompt); 73 73 74 74 generateText({ 75 - model: openai('gpt-4o', { 76 - 77 - }), 75 + model: openai('gpt-4o', {}), 78 76 messages: [ 79 77 { 80 78 role: 'user', ··· 97 95 tools: { 98 96 decide: tool({ 99 97 parameters: z.object({ 100 - answer: z.union([z.literal('gryffindor'), z.literal('hufflepuff'), z.literal('ravenclaw'), z.literal('slytherin')]), 98 + answer: z.union([ 99 + z.literal('gryffindor'), 100 + z.literal('hufflepuff'), 101 + z.literal('ravenclaw'), 102 + z.literal('slytherin'), 103 + ]), 101 104 }), 102 105 execute: async ({ answer }) => { 103 106 console.log(`@${subject.handle} is ${answer}`);
+8 -5
src/label.ts
··· 28 28 password: process.env.BSKY_PASSWORD!, 29 29 }); 30 30 31 + console.log('Logged in to Bluesky'); 32 + 31 33 export const label = async (subject: string | AppBskyActorDefs.ProfileView, rkey: string) => { 32 34 const did = AppBskyActorDefs.isProfileView(subject) ? subject.did : subject; 33 35 ··· 52 54 53 55 async function canPerformLabelOperation(did: string): Promise<boolean> { 54 56 const thirtyDaysAgo = new Date(Date.now() - 30 * 24 * 60 * 60 * 1000); 55 - const query = server.db.prepare<unknown[], { count: number }>( 56 - `SELECT COUNT(*) as count FROM labels WHERE uri = ? AND cts > ?` 57 - ).get(did, thirtyDaysAgo.toISOString())!; 57 + const query = server.db 58 + .prepare<unknown[], { count: number }>(`SELECT COUNT(*) as count FROM labels WHERE uri = ? AND cts > ?`) 59 + .get(did, thirtyDaysAgo.toISOString())!; 58 60 59 61 return query.count < 2; 60 62 } 61 63 62 64 async function handleDeleteLabels(did: string, labels: Set<string>) { 63 65 try { 64 - if (labels.size > 0 && await canPerformLabelOperation(did)) { 66 + if (labels.size > 0 && (await canPerformLabelOperation(did))) { 65 67 await server.createLabels({ uri: did }, { negate: [...labels] }); 66 68 console.log(`Deleted labels for ${did}`); 67 69 } else if (labels.size === 0) { 68 70 console.log(`No labels to delete for ${did}`); 69 71 } else { 72 + console.log('THIS SHOULD NOT HAPPEN!!'); 70 73 console.log(`Cannot delete labels for ${did}: 30-day limit reached`); 71 74 } 72 75 } catch (err) { ··· 76 79 77 80 async function handleAddLabel(did: string) { 78 81 try { 79 - if (!await canPerformLabelOperation(did)) { 82 + if (!(await canPerformLabelOperation(did))) { 80 83 console.log(`Cannot add label for ${did}: 30-day limit reached`); 81 84 return; 82 85 }