diff options
| author | soryu <soryu@soryu.co> | 2026-01-02 22:00:45 +0000 |
|---|---|---|
| committer | soryu <soryu@soryu.co> | 2026-01-02 22:00:45 +0000 |
| commit | 2fab6904260099d9a011734763e62ebba91cf448 (patch) | |
| tree | 5890486b77f209348761ae7dc99a64e974dbcb7c /makima/frontend/src/lib/api.ts | |
| parent | e8ebf8f01101905bd9aec84aec94fd8854f8a030 (diff) | |
| download | soryu-2fab6904260099d9a011734763e62ebba91cf448.tar.gz soryu-2fab6904260099d9a011734763e62ebba91cf448.zip | |
Update LLM to keep context
Diffstat (limited to 'makima/frontend/src/lib/api.ts')
| -rw-r--r-- | makima/frontend/src/lib/api.ts | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/makima/frontend/src/lib/api.ts b/makima/frontend/src/lib/api.ts index 931981b..eb8d908 100644 --- a/makima/frontend/src/lib/api.ts +++ b/makima/frontend/src/lib/api.ts @@ -136,9 +136,15 @@ export class VersionConflictError extends Error { export type LlmModel = "claude-sonnet" | "claude-opus" | "groq"; // Chat API types +export interface ChatMessage { + role: "user" | "assistant"; + content: string; +} + export interface ChatRequest { message: string; model?: LlmModel; + history?: ChatMessage[]; } export interface ToolCallInfo { @@ -219,12 +225,16 @@ export async function deleteFile(id: string): Promise<void> { export async function chatWithFile( id: string, message: string, - model?: LlmModel + model?: LlmModel, + history?: ChatMessage[] ): Promise<ChatResponse> { const body: ChatRequest = { message }; if (model) { body.model = model; } + if (history && history.length > 0) { + body.history = history; + } const res = await fetch(`${API_BASE}/api/v1/files/${id}/chat`, { method: "POST", headers: { "Content-Type": "application/json" }, |
