ai_old/js/lib/ai.ts
2024-09-17 18:44:21 +08:00

82 lines
2.0 KiB
TypeScript

// just for develop
{{range .LLMList}}
let {{.}}: LLM
{{end}}
export default {
{{range .LLMList}}
{{.}},
{{end}}
}
interface ChatModelConfig {
model: string
ratio: number
maxTokens: number
temperature: number
topP: number
tools: Object
}
interface ChatResult {
result: string
askTokens: number
answerTokens: number
totalTokens: number
error: string
}
interface GCResult {
result: string
preview: string
results: Array<string>
previews: Array<string>
error: string
}
interface Support {
ask: boolean
askWithImage: boolean
askWithVideo: boolean
askWithCodeInterpreter: boolean
askWithWebSearch: boolean
makeImage: boolean
makeVideo: boolean
models: Array<string>
}
interface LLM {
ask(messages: any, config?: ChatModelConfig, callback?: (answer: string) => void): ChatResult
fastAsk(messages: any, callback?: (answer: string) => void): ChatResult
longAsk(messages: any, callback?: (answer: string) => void): ChatResult
batterAsk(messages: any, callback?: (answer: string) => void): ChatResult
bestAsk(messages: any, callback?: (answer: string) => void): ChatResult
multiAsk(messages: any, callback?: (answer: string) => void): ChatResult
bestMultiAsk(messages: any, callback?: (answer: string) => void): ChatResult
codeInterpreterAsk(messages: any, callback?: (answer: string) => void): ChatResult
webSearchAsk(messages: any, callback?: (answer: string) => void): ChatResult
makeImage(model: string, prompt: string, size?: string, refImage?: string): GCResult
fastMakeImage(prompt: string, size?: string, refImage?: string): GCResult
bestMakeImage(prompt: string, size?: string, refImage?: string): GCResult
makeVideo(arg2: string, arg3: string, arg4: string, arg5: string): GCResult
fastMakeVideo(prompt: string, size?: string, refImage?: string): GCResult
bestMakeVideo(prompt: string, size?: string, refImage?: string): GCResult
support: Support
}