ai_old/js/lib/ai.ts

73 lines
1.9 KiB
TypeScript
Raw Normal View History

2024-09-17 18:44:21 +08:00
// just for develop
{{range .LLMList}}
let {{.}}: LLM
2024-09-18 18:29:21 +08:00
{{- end}}
2024-09-17 18:44:21 +08:00
export default {
2024-09-18 18:29:21 +08:00
{{- range .LLMList}}
2024-09-17 18:44:21 +08:00
{{.}},
2024-09-18 18:29:21 +08:00
{{- end}}
2024-09-17 18:44:21 +08:00
}
2024-09-18 18:29:21 +08:00
interface ChatConfig {
2024-09-17 18:44:21 +08:00
model: string
ratio: number
maxTokens: number
temperature: number
topP: number
tools: Object
}
interface ChatResult {
result: string
askTokens: number
answerTokens: number
totalTokens: number
error: string
}
2024-09-18 18:29:21 +08:00
interface GCConfig {
model: string
size: string
ref: string
}
2024-09-17 18:44:21 +08:00
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 {
2024-09-18 18:29:21 +08:00
ask(messages: any, config?: ChatConfig, callback?: (answer: string) => void): ChatResult
2024-09-17 18:44:21 +08:00
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
2024-09-18 18:29:21 +08:00
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
2024-09-17 18:44:21 +08:00
support: Support
}