feat: support zhipu new API (#44)

This commit is contained in:
Buer
2024-01-19 22:14:30 +08:00
committed by GitHub
parent 0be687905f
commit b42d4d44aa
15 changed files with 344 additions and 128 deletions

View File

@@ -38,3 +38,21 @@ func (r EmbeddingRequest) ParseInput() []string {
}
return input
}
func (r EmbeddingRequest) ParseInputString() string {
if r.Input == nil {
return ""
}
var input string
switch r.Input.(type) {
case string:
input = r.Input.(string)
case []any:
// 取第一个
if len(r.Input.([]any)) > 0 {
input = r.Input.([]any)[0].(string)
}
}
return input
}