claude
This commit is contained in:
@@ -16,6 +16,7 @@ import (
|
||||
"net/http/httputil"
|
||||
"net/url"
|
||||
"opencatd-open/pkg/azureopenai"
|
||||
"opencatd-open/pkg/claude"
|
||||
"opencatd-open/store"
|
||||
"os"
|
||||
"path/filepath"
|
||||
@@ -469,6 +470,10 @@ func HandleProy(c *gin.Context) {
|
||||
localuser = store.IsExistAuthCache(auth[7:])
|
||||
c.Set("localuser", auth[7:])
|
||||
}
|
||||
if c.Request.URL.Path == "/v1/complete" {
|
||||
claude.ClaudeProxy(c)
|
||||
return
|
||||
}
|
||||
if c.Request.URL.Path == "/v1/audio/transcriptions" {
|
||||
WhisperProxy(c)
|
||||
return
|
||||
@@ -481,12 +486,16 @@ func HandleProy(c *gin.Context) {
|
||||
}})
|
||||
return
|
||||
}
|
||||
onekey := store.FromKeyCacheRandomItemKey()
|
||||
|
||||
if err := c.BindJSON(&chatreq); err != nil {
|
||||
c.AbortWithError(http.StatusBadRequest, err)
|
||||
return
|
||||
}
|
||||
if strings.HasPrefix(chatreq.Model, "claude-") {
|
||||
claude.Translate(c, &chatreq)
|
||||
return
|
||||
}
|
||||
|
||||
chatlog.Model = chatreq.Model
|
||||
for _, m := range chatreq.Messages {
|
||||
pre_prompt += m.Content + "\n"
|
||||
@@ -498,6 +507,8 @@ func HandleProy(c *gin.Context) {
|
||||
|
||||
var body bytes.Buffer
|
||||
json.NewEncoder(&body).Encode(chatreq)
|
||||
|
||||
onekey := store.FromKeyCacheRandomItemKey()
|
||||
// 创建 API 请求
|
||||
switch onekey.ApiType {
|
||||
case "azure_openai":
|
||||
|
||||
Reference in New Issue
Block a user