aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDhravya <[email protected]>2024-06-24 22:11:05 -0500
committerDhravya <[email protected]>2024-06-24 22:11:05 -0500
commitdcf5cffdf0a90318f9408115b7446c5669c3611a (patch)
tree594e7cb09f57aa0089ab2302a7488d5f9bf05677
parentfix: redirect if not logged in (diff)
downloadsupermemory-dcf5cffdf0a90318f9408115b7446c5669c3611a.tar.xz
supermemory-dcf5cffdf0a90318f9408115b7446c5669c3611a.zip
use gpt-4o again, responses are considerably better.
-rw-r--r--apps/cf-ai-backend/src/index.ts7
-rw-r--r--apps/web/app/api/telegram/route.ts4
-rw-r--r--apps/web/wrangler.toml8
3 files changed, 9 insertions, 10 deletions
diff --git a/apps/cf-ai-backend/src/index.ts b/apps/cf-ai-backend/src/index.ts
index 40b0f7b1..60188090 100644
--- a/apps/cf-ai-backend/src/index.ts
+++ b/apps/cf-ai-backend/src/index.ts
@@ -188,18 +188,13 @@ app.post(
const { store, model } = await initQuery(c);
- // we're creating another instance of the model here because we want to use a cheaper model for this.
- const openai = createOpenAI({
- apiKey: c.env.OPENAI_API_KEY,
- });
-
let task: "add" | "chat" = "chat";
let thingToAdd: "page" | "image" | "text" | undefined = undefined;
let addContent: string | undefined = undefined;
// This is a "router". this finds out if the user wants to add a document, or chat with the AI to get a response.
const routerQuery = await generateText({
- model: openai.chat("gpt-3.5-turbo"),
+ model: model,
system: `You are Supermemory chatbot. You can either add a document to the supermemory database, or return a chat response. Based on this query,
You must determine what to do. Basically if it feels like a "question", then you should intiate a chat. If it feels like a "command" or feels like something that could be forwarded to the AI, then you should add a document.
You must also extract the "thing" to add and what type of thing it is.`,
diff --git a/apps/web/app/api/telegram/route.ts b/apps/web/app/api/telegram/route.ts
index 59177c4e..000b473a 100644
--- a/apps/web/app/api/telegram/route.ts
+++ b/apps/web/app/api/telegram/route.ts
@@ -107,3 +107,7 @@ bot.on("message", async (ctx) => {
});
export const POST = webhookCallback(bot, "std/http");
+
+export const GET = async () => {
+ return new Response("OK", { status: 200 });
+};
diff --git a/apps/web/wrangler.toml b/apps/web/wrangler.toml
index da9cd616..a2ac88d0 100644
--- a/apps/web/wrangler.toml
+++ b/apps/web/wrangler.toml
@@ -14,8 +14,8 @@ bucket_name = "dev-r2-anycontext"
[[d1_databases]]
binding = "DATABASE"
-# database_name = "prod-d1-supermemory"
-# database_id = "f527a727-c472-41d4-8eaf-3d7ba0f2f395"
+database_name = "prod-d1-supermemory"
+database_id = "f527a727-c472-41d4-8eaf-3d7ba0f2f395"
-database_name = "dev-d1-anycontext"
-database_id = "fc562605-157a-4f60-b439-2a24ffed5b4c" \ No newline at end of file
+# database_name = "dev-d1-anycontext"
+# database_id = "fc562605-157a-4f60-b439-2a24ffed5b4c" \ No newline at end of file