mirror of
https://github.com/supermemoryai/supermemory.git
synced 2026-10-08 03:08:21 +00:00
fix breadcrumbs and btter handling
This commit is contained in:
parent
33f8cdac23
commit
b0d1a03434
4 changed files with 19 additions and 9 deletions
|
|
@ -20,7 +20,7 @@ const History = memo(({ setQuery }: { setQuery: (q: string) => void }) => {
|
|||
return;
|
||||
}
|
||||
console.log(suggestions);
|
||||
setSuggestions(suggestions.data.reverse());
|
||||
setSuggestions(suggestions.data.reverse().slice(0, 3));
|
||||
})();
|
||||
}, []);
|
||||
|
||||
|
|
|
|||
|
|
@ -777,8 +777,6 @@ export async function getQuerySuggestions() {
|
|||
.map((c) => `${c.title} \n\n${c.content}`)
|
||||
.join(" ");
|
||||
|
||||
const sentences = getRandomSentences(fullQuery);
|
||||
|
||||
const suggestionsCall = (await env.AI.run(
|
||||
// @ts-ignore
|
||||
"@cf/meta/llama-3.1-8b-instruct",
|
||||
|
|
@ -786,11 +784,11 @@ export async function getQuerySuggestions() {
|
|||
messages: [
|
||||
{
|
||||
role: "system",
|
||||
content: `You are a model that suggests questions based on the user's content.`,
|
||||
content: `You are a model that suggests questions based on the user's content. you MUST suggest atleast 1 question to ask. Create 3 suggestions at most.`,
|
||||
},
|
||||
{
|
||||
role: "user",
|
||||
content: `Run the function based on this input: ${sentences}`,
|
||||
content: `Run the function based on this input: ${fullQuery.slice(0, 2000)}`,
|
||||
},
|
||||
],
|
||||
tools: [
|
||||
|
|
@ -823,6 +821,11 @@ export async function getQuerySuggestions() {
|
|||
tool_calls: { name: string; arguments: { querySuggestions: string[] } }[];
|
||||
};
|
||||
|
||||
console.log(
|
||||
"I RAN AN AI CALLS OWOWOWOWOW",
|
||||
JSON.stringify(suggestionsCall, null, 2),
|
||||
);
|
||||
|
||||
const suggestions =
|
||||
suggestionsCall.tool_calls?.[0]?.arguments?.querySuggestions;
|
||||
|
||||
|
|
@ -833,9 +836,11 @@ export async function getQuerySuggestions() {
|
|||
};
|
||||
}
|
||||
|
||||
await env.RECOMMENDATIONS.put(data.user.id, JSON.stringify(suggestions), {
|
||||
expirationTtl: 60 * 2,
|
||||
});
|
||||
if (suggestions.length > 0) {
|
||||
await env.RECOMMENDATIONS.put(data.user.id, JSON.stringify(suggestions), {
|
||||
expirationTtl: 60 * 2,
|
||||
});
|
||||
}
|
||||
|
||||
return {
|
||||
success: true,
|
||||
|
|
|
|||
|
|
@ -2,4 +2,7 @@ import { drizzle } from "drizzle-orm/d1";
|
|||
|
||||
import * as schema from "./schema";
|
||||
|
||||
export const db = drizzle(process.env.DATABASE, { schema, logger: true });
|
||||
export const db = drizzle(process.env.DATABASE, {
|
||||
schema,
|
||||
logger: process.env.NODE_ENV === "development",
|
||||
});
|
||||
|
|
|
|||
|
|
@ -14,6 +14,8 @@ env.production.kv_namespaces = [
|
|||
{ binding = "RECOMMENDATIONS", id = "83bc7055226c4657948141c2ff9a5425" }
|
||||
]
|
||||
|
||||
[ai]
|
||||
binding = "AI"
|
||||
|
||||
[placement]
|
||||
mode = "smart"
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue