refactor: normalize script_builder_messages into separate table
Extract JSONB messages array from script_builder_sessions into a proper script_builder_messages table with individual columns for role, content, script, tokens, etc. Migration handles data migration from JSONB to rows. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -56,11 +56,11 @@ export interface ScriptBuilderContent {
|
||||
script_language?: string
|
||||
}
|
||||
|
||||
export function isScriptGenerationAction(content: Record<string, unknown>): content is ScriptGenerationContent {
|
||||
export function isScriptGenerationAction(content: Record<string, unknown>): content is Record<string, unknown> & ScriptGenerationContent {
|
||||
return content.action_type === 'script_generation'
|
||||
}
|
||||
|
||||
export function isScriptBuilderAction(content: Record<string, unknown>): content is ScriptBuilderContent {
|
||||
export function isScriptBuilderAction(content: Record<string, unknown>): content is Record<string, unknown> & ScriptBuilderContent {
|
||||
return content.action_type === 'open_script_builder'
|
||||
}
|
||||
|
||||
|
||||
@@ -22,12 +22,15 @@ export interface ScriptBuilderSessionDetail {
|
||||
}
|
||||
|
||||
export interface ScriptBuilderMessage {
|
||||
id?: string
|
||||
role: 'user' | 'assistant'
|
||||
content: string
|
||||
script?: string | null
|
||||
script_filename?: string | null
|
||||
line_count?: number | null
|
||||
timestamp: string
|
||||
input_tokens?: number | null
|
||||
output_tokens?: number | null
|
||||
created_at: string
|
||||
}
|
||||
|
||||
export interface ScriptBuilderMessageResponse {
|
||||
|
||||
Reference in New Issue
Block a user