feat(数据库): 添加 AI 生成图片字段支持
- messages 表新增 generated_images 字段存储 Gemini 生成的图片 - 定义 GeneratedImageData 接口(mimeType, data, width, height) - shared_conversations 表新增 selected_message_ids 字段
This commit is contained in:
parent
4efee3a06a
commit
4c43fb4471
2
src/drizzle/migrations/0015_milky_anthem.sql
Normal file
2
src/drizzle/migrations/0015_milky_anthem.sql
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
ALTER TABLE "messages" ADD COLUMN "generated_images" jsonb;--> statement-breakpoint
|
||||||
|
ALTER TABLE "shared_conversations" ADD COLUMN "selected_message_ids" jsonb;
|
||||||
1341
src/drizzle/migrations/meta/0015_snapshot.json
Normal file
1341
src/drizzle/migrations/meta/0015_snapshot.json
Normal file
File diff suppressed because it is too large
Load Diff
@ -106,6 +106,13 @@
|
|||||||
"when": 1766546111189,
|
"when": 1766546111189,
|
||||||
"tag": "0014_naive_kronos",
|
"tag": "0014_naive_kronos",
|
||||||
"breakpoints": true
|
"breakpoints": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"idx": 15,
|
||||||
|
"version": "7",
|
||||||
|
"when": 1766812096044,
|
||||||
|
"tag": "0015_milky_anthem",
|
||||||
|
"breakpoints": true
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
@ -207,6 +207,8 @@ export const messages = pgTable('messages', {
|
|||||||
usedTools: jsonb('used_tools').$type<string[]>().default([]),
|
usedTools: jsonb('used_tools').$type<string[]>().default([]),
|
||||||
// 搜索到的图片(图片搜索工具返回)
|
// 搜索到的图片(图片搜索工具返回)
|
||||||
searchImages: jsonb('search_images').$type<SearchImageData[]>(),
|
searchImages: jsonb('search_images').$type<SearchImageData[]>(),
|
||||||
|
// AI 生成的图片(Gemini 等图片生成模型返回)
|
||||||
|
generatedImages: jsonb('generated_images').$type<GeneratedImageData[]>(),
|
||||||
// Token 统计
|
// Token 统计
|
||||||
inputTokens: integer('input_tokens').default(0),
|
inputTokens: integer('input_tokens').default(0),
|
||||||
outputTokens: integer('output_tokens').default(0),
|
outputTokens: integer('output_tokens').default(0),
|
||||||
@ -479,6 +481,14 @@ export interface SearchImageData {
|
|||||||
sourceUrl?: string;
|
sourceUrl?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// AI 生成的图片数据(用于 Gemini 等图片生成模型)
|
||||||
|
export interface GeneratedImageData {
|
||||||
|
mimeType: string; // 图片 MIME 类型,如 "image/png"、"image/jpeg"
|
||||||
|
data: string; // Base64 编码的图片数据
|
||||||
|
width?: number; // 图片宽度(可选)
|
||||||
|
height?: number; // 图片高度(可选)
|
||||||
|
}
|
||||||
|
|
||||||
// 导出类型
|
// 导出类型
|
||||||
export type User = typeof users.$inferSelect;
|
export type User = typeof users.$inferSelect;
|
||||||
export type NewUser = typeof users.$inferInsert;
|
export type NewUser = typeof users.$inferInsert;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user