From c72c3aec59b4f8c4e022bd4c70c166b0aae9456d Mon Sep 17 00:00:00 2001 From: Ariel Weinberger Date: Thu, 17 Jul 2025 11:08:36 -0500 Subject: [PATCH] unused hardcoded artifact id --- ai-service/.env.example | 2 -- ai-service/src/lib/constants.ts | 1 - ai-service/test.ts | 35 +++++++++++++++++++++++++++++++++ 3 files changed, 35 insertions(+), 3 deletions(-) create mode 100644 ai-service/test.ts diff --git a/ai-service/.env.example b/ai-service/.env.example index bcc82331f..41b7f2c70 100644 --- a/ai-service/.env.example +++ b/ai-service/.env.example @@ -1,5 +1,3 @@ ANTHROPIC_API_KEY= APPWRITE_ENDPOINT=http://localhost/v1 -IMAGINE_PROJECT_ID=demo-project -IMAGINE_ARTIFACT_ID=demo-artifact SYNAPSE_ENDPOINT=http://127.0.0.1:3010 \ No newline at end of file diff --git a/ai-service/src/lib/constants.ts b/ai-service/src/lib/constants.ts index a06a7ac62..6d32c4e6e 100644 --- a/ai-service/src/lib/constants.ts +++ b/ai-service/src/lib/constants.ts @@ -1,2 +1 @@ -export const OVERRIDE_BASE_DIR = `./tmp/workspace/artifact/${process.env.ARTIFACT_ID}`; export const ANTHROPIC_MAX_CACHE_CONTROL_BLOCKS = 4; // Anthropic only allows 4 cache control blocks diff --git a/ai-service/test.ts b/ai-service/test.ts new file mode 100644 index 000000000..475399cdb --- /dev/null +++ b/ai-service/test.ts @@ -0,0 +1,35 @@ +import "dotenv/config"; + +import fs from 'fs'; +import { convertToModelMessages, generateText, UIMessage } from 'ai'; +import { anthropic } from '@ai-sdk/anthropic'; + +async function main() { + const loaded = fs.readFileSync('./tmp/messages-submitted-tool-result.json', 'utf-8'); + const messages: UIMessage[] = JSON.parse(loaded); + + messages.push({ + id: "123", + role: "user", + parts: [ + { + type: "text", + text: "What is the content of the src/App.tsx file?" + } + ] + }) + + const converted = convertToModelMessages(messages); + + // const loaded = fs.readFileSync('/Users/arielweinberger/Development/appwrite/appwrite-console/ai-service/tmp/messages-submitted-tool-result-converted.json', 'utf-8'); + // const converted = JSON.parse(loaded); + + const result = await generateText({ + model: anthropic("claude-3-7-sonnet-20250219"), + messages: converted, + }); + + console.log(result.text); +} + +main(); \ No newline at end of file