From 2fab6904260099d9a011734763e62ebba91cf448 Mon Sep 17 00:00:00 2001 From: soryu Date: Fri, 2 Jan 2026 22:00:45 +0000 Subject: Update LLM to keep context --- makima/frontend/src/lib/api.ts | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'makima/frontend/src/lib') 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 { export async function chatWithFile( id: string, message: string, - model?: LlmModel + model?: LlmModel, + history?: ChatMessage[] ): Promise { 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" }, -- cgit v1.2.3