The issue was caused by the `omitempty` tag in the Go struct, which prevented the `temperature` field from being included in the JSON output when it was set to 0. Signed-off-by: Butui Hu <hot123tea123@gmail.com>
39 lines
943 B
Go
39 lines
943 B
Go
package palm
|
|
|
|
import "one-api/dto"
|
|
|
|
type PaLMChatMessage struct {
|
|
Author string `json:"author"`
|
|
Content string `json:"content"`
|
|
}
|
|
|
|
type PaLMFilter struct {
|
|
Reason string `json:"reason"`
|
|
Message string `json:"message"`
|
|
}
|
|
|
|
type PaLMPrompt struct {
|
|
Messages []PaLMChatMessage `json:"messages"`
|
|
}
|
|
|
|
type PaLMChatRequest struct {
|
|
Prompt PaLMPrompt `json:"prompt"`
|
|
Temperature *float64 `json:"temperature,omitempty"`
|
|
CandidateCount int `json:"candidateCount,omitempty"`
|
|
TopP float64 `json:"topP,omitempty"`
|
|
TopK uint `json:"topK,omitempty"`
|
|
}
|
|
|
|
type PaLMError struct {
|
|
Code int `json:"code"`
|
|
Message string `json:"message"`
|
|
Status string `json:"status"`
|
|
}
|
|
|
|
type PaLMChatResponse struct {
|
|
Candidates []PaLMChatMessage `json:"candidates"`
|
|
Messages []dto.Message `json:"messages"`
|
|
Filters []PaLMFilter `json:"filters"`
|
|
Error PaLMError `json:"error"`
|
|
}
|