🎄 merry christmas: ai sdk v6 beta + tool approval (#1361)
This commit is contained in:
parent
6e5b883cf2
commit
4d3ba8d9fe
21 changed files with 429 additions and 202 deletions
|
|
@ -9,7 +9,8 @@ config({
|
|||
|
||||
const runMigrate = async () => {
|
||||
if (!process.env.POSTGRES_URL) {
|
||||
throw new Error("POSTGRES_URL is not defined");
|
||||
console.log("⏭️ POSTGRES_URL not defined, skipping migrations");
|
||||
process.exit(0);
|
||||
}
|
||||
|
||||
const connection = postgres(process.env.POSTGRES_URL, { max: 1 });
|
||||
|
|
|
|||
|
|
@ -250,6 +250,20 @@ export async function saveMessages({ messages }: { messages: DBMessage[] }) {
|
|||
}
|
||||
}
|
||||
|
||||
export async function updateMessage({
|
||||
id,
|
||||
parts,
|
||||
}: {
|
||||
id: string;
|
||||
parts: DBMessage["parts"];
|
||||
}) {
|
||||
try {
|
||||
return await db.update(message).set({ parts }).where(eq(message.id, id));
|
||||
} catch (_error) {
|
||||
throw new ChatSDKError("bad_request:database", "Failed to update message");
|
||||
}
|
||||
}
|
||||
|
||||
export async function getMessagesByChatId({ id }: { id: string }) {
|
||||
try {
|
||||
return await db
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue