support gpt-4-1106-vision-preview

This commit is contained in:
CaIon
2023-11-17 18:24:37 +08:00
parent fc494416fc
commit 7e0d2606c3
13 changed files with 81 additions and 34 deletions

View File

@@ -59,7 +59,7 @@ func requestOpenAI2PaLM(textRequest GeneralOpenAIRequest) *PaLMChatRequest {
}
for _, message := range textRequest.Messages {
palmMessage := PaLMChatMessage{
Content: message.Content,
Content: string(message.Content),
}
if message.Role == "user" {
palmMessage.Author = "0"
@@ -76,11 +76,12 @@ func responsePaLM2OpenAI(response *PaLMChatResponse) *OpenAITextResponse {
Choices: make([]OpenAITextResponseChoice, 0, len(response.Candidates)),
}
for i, candidate := range response.Candidates {
content, _ := json.Marshal(candidate.Content)
choice := OpenAITextResponseChoice{
Index: i,
Message: Message{
Role: "assistant",
Content: candidate.Content,
Content: content,
},
FinishReason: "stop",
}