From 42dd99bfac9777a4ecc6700b87edf26a5c984de6 Mon Sep 17 00:00:00 2001 From: polwex Date: Wed, 23 Jul 2025 02:37:15 +0700 Subject: checkpoint --- src/types/index.ts | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) (limited to 'src/types') diff --git a/src/types/index.ts b/src/types/index.ts index 97be443..b276457 100644 --- a/src/types/index.ts +++ b/src/types/index.ts @@ -1,15 +1,29 @@ import type OpenAI from "openai"; +import type { AsyncRes } from "sortug"; export type ChatMessage = { author: string; text: string; sent: number; reasoning?: string; }; -export type Result = { ok: T } | { error: string }; -export type AResult = Promise<{ ok: T } | { error: string }>; // openai export type OChoice = OpenAI.Chat.Completions.ChatCompletion.Choice; export type OChunk = OpenAI.Chat.Completions.ChatCompletionChunk.Choice; export type OMessage = OpenAI.Chat.Completions.ChatCompletionMessageParam; export type ContentType = { text: string } | { audio: Response }; +export type AIModelChoice = + | { name: "deepseek" | "chatgpt" | "claude" | "gemini" | "grok" } + | { other: { baseURL: string; apiKey: string } }; +export interface AIModelAPI { + setModel: (model: string) => void; + tokenizer: (text: string) => number; + maxTokens: number; + + send: (systemPrompt: string, input: ChatMessage[]) => AsyncRes; + stream: ( + systemPrompt: string, + input: ChatMessage[], + handler: (data: any) => void, + ) => void; +} -- cgit v1.2.3