- Model providers for OpenAI and Anthropic message formats (e.g. via Sub2API), with API keys encrypted at rest and never returned - Skills tree with markdown editing, priorities, drafts, publishing and rollback; only published skills enter the chat prompt - Chat page with tool calls over collected news and Binance USD-M klines, a persisted CONTEXT.md, reset, and stop-generation support - Chat may only create skill drafts and update CONTEXT.md; publishing, deleting, moving and priority changes stay with the user
53 lines
1.3 KiB
TypeScript
53 lines
1.3 KiB
TypeScript
import { http } from "@/http"
|
||
|
||
export interface ToolCall {
|
||
id: string
|
||
name: string
|
||
arguments: Record<string, unknown>
|
||
}
|
||
|
||
export interface ChatMessage {
|
||
id: number
|
||
role: "user" | "assistant" | "tool"
|
||
/** user: {text};assistant: {text, tool_calls, stopped?, error?};tool: {tool_call_id, name, result} */
|
||
content: Record<string, any>
|
||
provider_id: number | null
|
||
usage: { input_tokens?: number, output_tokens?: number } | null
|
||
created_at: string
|
||
}
|
||
|
||
export interface ChatSession {
|
||
id: number
|
||
created_at: string
|
||
messages: ChatMessage[]
|
||
estimated_tokens: number
|
||
generating: boolean
|
||
}
|
||
|
||
export interface ChatContext {
|
||
id: number | null
|
||
content: string
|
||
source: "user" | "chat" | "reset" | null
|
||
created_at: string | null
|
||
}
|
||
|
||
export function getChatSession(): Promise<ChatSession> {
|
||
return http.get("/chat/session")
|
||
}
|
||
|
||
export function resetChat(clearContext: boolean): Promise<void> {
|
||
return http.post("/chat/reset", { clear_context: clearContext })
|
||
}
|
||
|
||
export function getChatContext(): Promise<ChatContext> {
|
||
return http.get("/chat/context")
|
||
}
|
||
|
||
export function saveChatContext(content: string): Promise<ChatContext> {
|
||
return http.put("/chat/context", { content })
|
||
}
|
||
|
||
export function listChatContextVersions(): Promise<ChatContext[]> {
|
||
return http.get("/chat/context/versions")
|
||
}
|