ai_old/js/lib/ai.ts
Star afce45396e add util
move js to root
2024-09-18 18:29:42 +08:00

73 lines
1.9 KiB
TypeScript

// just for develop
{{range .LLMList}}
let {{.}}: LLM
{{- end}}
export default {
{{- range .LLMList}}
{{.}},
{{- end}}
}
interface ChatConfig {
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 GCConfig {
model: string
size: string
ref: 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?: ChatConfig, 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(prompt: string, config?: GCConfig): GCResult
fastMakeImage(prompt: string, config?: GCConfig): GCResult
bestMakeImage(prompt: string, config?: GCConfig): GCResult
makeVideo(prompt: string, config?: GCConfig): GCResult
fastMakeVideo(prompt: string, config?: GCConfig): GCResult
bestMakeVideo(prompt: string, config?: GCConfig): GCResult
support: Support
}