add tool use, update system prompt

This commit is contained in:
duanfuxiang
2025-03-12 21:39:29 +08:00
parent cabf2d5fa4
commit b0fbbb22d3
36 changed files with 7149 additions and 430 deletions

View File

@@ -94,6 +94,7 @@ export class DBManager {
// return drizzle(this.pgClient)
} catch (error) {
console.error('Error loading database:', error)
console.log(this.dbPath)
return null
}
}

View File

@@ -1,6 +1,7 @@
import { SerializedLexicalNode } from 'lexical'
import { SUPPORT_EMBEDDING_SIMENTION } from '../constants'
import { ApplyStatus } from '../types/apply'
// import { EmbeddingModelId } from '../types/embedding'
// PostgreSQL column types
@@ -123,6 +124,7 @@ export type Conversation = {
export type Message = {
id: string // uuid
conversationId: string // uuid
applyStatus: number
role: 'user' | 'assistant'
content: string | null
reasoningContent?: string | null
@@ -151,6 +153,7 @@ export type InsertMessage = {
id: string
conversationId: string
role: 'user' | 'assistant'
apply_status: number
content: string | null
reasoningContent?: string | null
promptContent?: string | null
@@ -163,6 +166,7 @@ export type InsertMessage = {
export type SelectMessage = {
id: string // uuid
conversation_id: string // uuid
apply_status: number
role: 'user' | 'assistant'
content: string | null
reasoning_content?: string | null

View File

@@ -102,20 +102,10 @@ export const migrations: Record<string, SqlMigration> = {
"updated_at" timestamp DEFAULT now() NOT NULL
);
DO $$
BEGIN
IF NOT EXISTS (
SELECT 1 FROM information_schema.columns
WHERE table_name = 'messages'
AND column_name = 'reasoning_content'
) THEN
ALTER TABLE "messages" ADD COLUMN "reasoning_content" text;
END IF;
END $$;
CREATE TABLE IF NOT EXISTS "messages" (
"id" uuid PRIMARY KEY NOT NULL,
"conversation_id" uuid NOT NULL REFERENCES "conversations"("id") ON DELETE CASCADE,
"apply_status" integer NOT NULL DEFAULT 0,
"role" text NOT NULL,
"content" text,
"reasoning_content" text,