feat: AI assistant panel, editor improvements, vite and package config

This commit is contained in:
2026-06-15 10:24:27 +08:00
parent 80b361813e
commit 33357650c7
10 changed files with 721 additions and 5 deletions

View File

@@ -0,0 +1,18 @@
export async function sendAIRequest(sessionId: string, userMessage: string, mode: string, apiKey: string): Promise<{ result: string }> {
const resp = await fetch('/api/ai', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ sessionId, userMessage, apiKey, mode }),
})
if (!resp.ok) {
const err = await resp.json().catch(() => ({ error: 'request failed' }))
throw new Error(err.error || 'request failed')
}
return resp.json()
}
export async function listSessions(): Promise<any[]> {
const resp = await fetch('/api/ai/sessions')
if (!resp.ok) return []
return resp.json()
}