feat: refactor LLM api request code, get API URL from ApiKey object

This commit is contained in:
RockYang
2024-01-04 14:51:33 +08:00
parent d1950acd01
commit a06a81a415
13 changed files with 59 additions and 53 deletions

View File

@@ -62,7 +62,6 @@ type ApiError struct {
const PromptMsg = "prompt" // prompt message
const ReplyMsg = "reply" // reply message
const MjMsg = "mj"
var ModelToTokens = map[string]int{
"gpt-3.5-turbo": 4096,
@@ -75,4 +74,12 @@ var ModelToTokens = map[string]int{
"ernie_bot_turbo": 8192, // 文心一言
"general": 8192, // 科大讯飞
"general2": 8192,
"general3": 8192,
}
func GetModelMaxToken(model string) int {
if token, ok := ModelToTokens[model]; ok {
return token
}
return 4096
}

View File

@@ -141,7 +141,6 @@ type InviteReward struct {
}
type ModelAPIConfig struct {
ApiURL string `json:"api_url,omitempty"`
Temperature float32 `json:"temperature"`
MaxTokens int `json:"max_tokens"`
ApiKey string `json:"api_key"`