mirror of
https://github.com/linux-do/new-api.git
synced 2025-11-12 00:53:41 +08:00
feat: support claude3 not stream
This commit is contained in:
@@ -82,6 +82,14 @@ func (m Message) StringContent() string {
|
||||
return string(m.Content)
|
||||
}
|
||||
|
||||
func (m Message) IsStringContent() bool {
|
||||
var stringContent string
|
||||
if err := json.Unmarshal(m.Content, &stringContent); err == nil {
|
||||
return true
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
func (m Message) ParseContent() []MediaMessage {
|
||||
var contentList []MediaMessage
|
||||
var stringContent string
|
||||
@@ -130,9 +138,3 @@ func (m Message) ParseContent() []MediaMessage {
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
type Usage struct {
|
||||
PromptTokens int `json:"prompt_tokens"`
|
||||
CompletionTokens int `json:"completion_tokens"`
|
||||
TotalTokens int `json:"total_tokens"`
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user