feat: support claude3 not stream

This commit is contained in:
CaIon
2024-03-08 18:25:57 +08:00
parent 280c63e1d4
commit c2965eb835
7 changed files with 174 additions and 49 deletions

View File

@@ -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"`
}