feat: 支持修改聊天记录名称

This commit is contained in:
digua
2025-12-02 00:07:47 +08:00
parent 3ef37f16be
commit d70549c9b1
7 changed files with 180 additions and 76 deletions

View File

@@ -371,6 +371,30 @@ export function deleteSession(sessionId: string): boolean {
}
}
/**
* 重命名会话
*/
export function renameSession(sessionId: string, newName: string): boolean {
const dbPath = getDbPath(sessionId)
if (!fs.existsSync(dbPath)) {
return false
}
try {
const db = new Database(dbPath)
db.pragma('journal_mode = WAL')
const stmt = db.prepare('UPDATE meta SET name = ?')
stmt.run(newName)
db.close()
return true
} catch (error) {
console.error('[Database] Failed to rename session:', error)
return false
}
}
/**
* 获取数据库存储目录
*/