fix: chat session reliability, cost, and hygiene (empty-response guard, tool truncation, delete, titles)
- Empty/refusal responses retried once, then surfaced as errors instead of silent blanks
- Chinese refusal boilerplate detected via denylist + non-ASCII heuristic
- Bulk-tool preference added to SOUL.md (list_lxcs over per-entity get_lxc_state)
- Tool results truncated to 4KB on persist; get_state_snapshot filters null-state entities
- Session delete (DELETE /sessions/{id} + confirm-on-second-click UI)
- Session titles auto-generated from assistant answer instead of raw user message
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import { writable, get } from 'svelte/store'
|
||||
import { streamChat, fetchSessions, fetchMessages } from '$lib/api'
|
||||
import { streamChat, fetchSessions, fetchMessages, deleteSession as apiDeleteSession } from '$lib/api'
|
||||
import type { ChatEvent, Session, Message } from '$lib/api'
|
||||
|
||||
export interface ChatMessage {
|
||||
@@ -177,3 +177,12 @@ export function cancelStream() {
|
||||
streaming.set(false)
|
||||
}
|
||||
}
|
||||
|
||||
export async function deleteSession(sessionId: string) {
|
||||
const ok = await apiDeleteSession(sessionId)
|
||||
if (!ok) return
|
||||
if (get(currentSession) === sessionId) {
|
||||
newChat()
|
||||
}
|
||||
loadSessions()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user