mirror of
https://github.com/songquanpeng/one-api.git
synced 2025-11-17 21:53:42 +08:00
✨ feat: support zhipu new API (#44)
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user