更新到官方v0.9.0-alpha.8真正最新版本并恢复自定义功能
✅ 更新到官方真正的最新版本 v0.9.0-alpha.8 ✅ 恢复 Footer.jsx 自定义页脚 (听泉claude提供) ✅ 恢复 Claude 穿透功能到 adaptor.go ✅ 恢复 Docker 自定义配置 (端口3099) ✅ 添加 service/channel_state_reporter.go 关键更新: - 文件格式从 .js 更新为 .jsx (官方最新格式) - Claude adaptor 保持穿透功能兼容性 - 全新的界面和功能改进 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -60,14 +60,34 @@ func (a *Adaptor) GetRequestURL(info *relaycommon.RelayInfo) (string, error) {
|
||||
}
|
||||
|
||||
func (a *Adaptor) SetupRequestHeader(c *gin.Context, req *http.Header, info *relaycommon.RelayInfo) error {
|
||||
channel.SetupApiRequestHeader(info, c, req)
|
||||
req.Set("x-api-key", info.ApiKey)
|
||||
anthropicVersion := c.Request.Header.Get("anthropic-version")
|
||||
if anthropicVersion == "" {
|
||||
anthropicVersion = "2023-06-01"
|
||||
if model_setting.GetGlobalSettings().PassThroughRequestEnabled {
|
||||
// 穿透模式:直接复制原始请求头,但跳过系统级头信息
|
||||
for key, values := range c.Request.Header {
|
||||
keyLower := strings.ToLower(key)
|
||||
if keyLower == "host" || keyLower == "content-length" || keyLower == "connection" {
|
||||
continue
|
||||
}
|
||||
for _, value := range values {
|
||||
req.Add(key, value)
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// 非穿透模式:使用通用设置
|
||||
channel.SetupApiRequestHeader(info, c, req)
|
||||
}
|
||||
|
||||
// 无论哪种模式都需要设置正确的API密钥
|
||||
req.Set("x-api-key", info.ApiKey)
|
||||
|
||||
if !model_setting.GetGlobalSettings().PassThroughRequestEnabled {
|
||||
// 非穿透模式才强制设置这些头
|
||||
anthropicVersion := c.Request.Header.Get("anthropic-version")
|
||||
if anthropicVersion == "" {
|
||||
anthropicVersion = "2023-06-01"
|
||||
}
|
||||
req.Set("anthropic-version", anthropicVersion)
|
||||
model_setting.GetClaudeSettings().WriteHeaders(info.OriginModelName, req)
|
||||
}
|
||||
req.Set("anthropic-version", anthropicVersion)
|
||||
model_setting.GetClaudeSettings().WriteHeaders(info.OriginModelName, req)
|
||||
return nil
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user