Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
"typecheck:web": "vue-tsc --noEmit -p tsconfig.app.json --composite false",
"typecheck": "pnpm run typecheck:node && pnpm run typecheck:web",
"start": "electron-vite preview",
"dev": "VITE_ENABLE_PLAYGROUND=true electron-vite dev --watch",
"dev": "cross-env VITE_ENABLE_PLAYGROUND=true electron-vite dev --watch",
"dev:inspect": "electron-vite dev --watch --inspect=9229",
"dev:linux": "electron-vite dev --watch --noSandbox",
"build": "pnpm run typecheck && electron-vite build",
Expand Down Expand Up @@ -134,6 +134,7 @@
"autoprefixer": "^10.4.21",
"class-variance-authority": "^0.7.1",
"clsx": "^2.1.1",
"cross-env": "^10.1.0",
"electron": "^37.6.0",
"electron-builder": "26.0.12",
"electron-vite": "^4.0.0",
Expand Down
27 changes: 20 additions & 7 deletions src/main/presenter/sqlitePresenter/tables/conversations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ type ConversationRow = {
enable_search: number | null
forced_search: number | null
search_strategy: string | null
context_chain: string | null
}

// 解析 JSON 字段
Expand Down Expand Up @@ -147,9 +148,10 @@ export class ConversationsTable extends BaseTable {
verbosity,
enable_search,
forced_search,
search_strategy
search_strategy,
context_chain
)
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
`)
const conv_id = nanoid()
const now = Date.now()
Expand All @@ -173,7 +175,8 @@ export class ConversationsTable extends BaseTable {
settings.verbosity !== undefined ? settings.verbosity : null,
settings.enableSearch !== undefined ? (settings.enableSearch ? 1 : 0) : null,
settings.forcedSearch !== undefined ? (settings.forcedSearch ? 1 : 0) : null,
settings.searchStrategy !== undefined ? settings.searchStrategy : null
settings.searchStrategy !== undefined ? settings.searchStrategy : null,
settings.selectedVariantsMap ? JSON.stringify(settings.selectedVariantsMap) : '{}'
)
return conv_id
}
Expand Down Expand Up @@ -202,7 +205,8 @@ export class ConversationsTable extends BaseTable {
verbosity,
enable_search,
forced_search,
search_strategy
search_strategy,
context_chain
FROM conversations
WHERE conv_id = ?
`
Expand Down Expand Up @@ -238,7 +242,8 @@ export class ConversationsTable extends BaseTable {
forcedSearch: result.forced_search !== null ? Boolean(result.forced_search) : undefined,
searchStrategy: result.search_strategy
? (result.search_strategy as 'turbo' | 'max')
: undefined
: undefined,
selectedVariantsMap: getJsonField(result.context_chain, undefined)
}
}
}
Expand Down Expand Up @@ -319,6 +324,10 @@ export class ConversationsTable extends BaseTable {
updates.push('search_strategy = ?')
params.push(data.settings.searchStrategy)
}
if (data.settings.selectedVariantsMap !== undefined) {
updates.push('context_chain = ?')
params.push(JSON.stringify(data.settings.selectedVariantsMap))
}
}
if (updates.length > 0 || data.updatedAt) {
updates.push('updated_at = ?')
Expand Down Expand Up @@ -369,7 +378,8 @@ export class ConversationsTable extends BaseTable {
verbosity,
enable_search,
forced_search,
search_strategy
search_strategy,
context_chain
FROM conversations
ORDER BY updated_at DESC
LIMIT ? OFFSET ?
Expand Down Expand Up @@ -402,7 +412,10 @@ export class ConversationsTable extends BaseTable {
verbosity: row.verbosity ? (row.verbosity as 'low' | 'medium' | 'high') : undefined,
enableSearch: row.enable_search !== null ? Boolean(row.enable_search) : undefined,
forcedSearch: row.forced_search !== null ? Boolean(row.forced_search) : undefined,
searchStrategy: row.search_strategy ? (row.search_strategy as 'turbo' | 'max') : undefined
searchStrategy: row.search_strategy
? (row.search_strategy as 'turbo' | 'max')
: undefined,
selectedVariantsMap: getJsonField(row.context_chain, undefined)
}
}))
}
Expand Down
Loading