mirror of
https://github.com/QuantumNous/new-api.git
synced 2026-04-19 09:58:38 +00:00
Merge pull request #1925 from seefs001/feature/claude-context-editing
feat: claude context editing
This commit is contained in:
@@ -196,10 +196,11 @@ type ClaudeRequest struct {
|
|||||||
TopP float64 `json:"top_p,omitempty"`
|
TopP float64 `json:"top_p,omitempty"`
|
||||||
TopK int `json:"top_k,omitempty"`
|
TopK int `json:"top_k,omitempty"`
|
||||||
//ClaudeMetadata `json:"metadata,omitempty"`
|
//ClaudeMetadata `json:"metadata,omitempty"`
|
||||||
Stream bool `json:"stream,omitempty"`
|
Stream bool `json:"stream,omitempty"`
|
||||||
Tools any `json:"tools,omitempty"`
|
Tools any `json:"tools,omitempty"`
|
||||||
ToolChoice any `json:"tool_choice,omitempty"`
|
ContextManagement json.RawMessage `json:"context_management,omitempty"`
|
||||||
Thinking *Thinking `json:"thinking,omitempty"`
|
ToolChoice any `json:"tool_choice,omitempty"`
|
||||||
|
Thinking *Thinking `json:"thinking,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *ClaudeRequest) GetTokenCountMeta() *types.TokenCountMeta {
|
func (c *ClaudeRequest) GetTokenCountMeta() *types.TokenCountMeta {
|
||||||
|
|||||||
@@ -52,6 +52,10 @@ func (a *Adaptor) GetRequestURL(info *relaycommon.RelayInfo) (string, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (a *Adaptor) SetupRequestHeader(c *gin.Context, req *http.Header, info *relaycommon.RelayInfo) error {
|
func (a *Adaptor) SetupRequestHeader(c *gin.Context, req *http.Header, info *relaycommon.RelayInfo) error {
|
||||||
|
anthropicBeta := c.Request.Header.Get("anthropic-beta")
|
||||||
|
if anthropicBeta != "" {
|
||||||
|
req.Set("anthropic-beta", anthropicBeta)
|
||||||
|
}
|
||||||
model_setting.GetClaudeSettings().WriteHeaders(info.OriginModelName, req)
|
model_setting.GetClaudeSettings().WriteHeaders(info.OriginModelName, req)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -72,6 +72,10 @@ func (a *Adaptor) SetupRequestHeader(c *gin.Context, req *http.Header, info *rel
|
|||||||
anthropicVersion = "2023-06-01"
|
anthropicVersion = "2023-06-01"
|
||||||
}
|
}
|
||||||
req.Set("anthropic-version", anthropicVersion)
|
req.Set("anthropic-version", anthropicVersion)
|
||||||
|
anthropicBeta := c.Request.Header.Get("anthropic-beta")
|
||||||
|
if anthropicBeta != "" {
|
||||||
|
req.Set("anthropic-beta", anthropicBeta)
|
||||||
|
}
|
||||||
model_setting.GetClaudeSettings().WriteHeaders(info.OriginModelName, req)
|
model_setting.GetClaudeSettings().WriteHeaders(info.OriginModelName, req)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1404,6 +1404,7 @@
|
|||||||
"Claude思考适配 BudgetTokens = MaxTokens * BudgetTokens 百分比": "Claude thinking adaptation BudgetTokens = MaxTokens * BudgetTokens percentage",
|
"Claude思考适配 BudgetTokens = MaxTokens * BudgetTokens 百分比": "Claude thinking adaptation BudgetTokens = MaxTokens * BudgetTokens percentage",
|
||||||
"思考适配 BudgetTokens 百分比": "Thinking adaptation BudgetTokens percentage",
|
"思考适配 BudgetTokens 百分比": "Thinking adaptation BudgetTokens percentage",
|
||||||
"0.1-1之间的小数": "Decimal between 0.1 and 1",
|
"0.1-1之间的小数": "Decimal between 0.1 and 1",
|
||||||
|
"0.1以上的小数": "Decimal above 0.1",
|
||||||
"模型相关设置": "Model related settings",
|
"模型相关设置": "Model related settings",
|
||||||
"收起侧边栏": "Collapse sidebar",
|
"收起侧边栏": "Collapse sidebar",
|
||||||
"展开侧边栏": "Expand sidebar",
|
"展开侧边栏": "Expand sidebar",
|
||||||
|
|||||||
@@ -1404,6 +1404,7 @@
|
|||||||
"Claude思考适配 BudgetTokens = MaxTokens * BudgetTokens 百分比": "Adaptation de la pensée Claude BudgetTokens = MaxTokens * BudgetTokens pourcentage",
|
"Claude思考适配 BudgetTokens = MaxTokens * BudgetTokens 百分比": "Adaptation de la pensée Claude BudgetTokens = MaxTokens * BudgetTokens pourcentage",
|
||||||
"思考适配 BudgetTokens 百分比": "Adaptation de la pensée BudgetTokens pourcentage",
|
"思考适配 BudgetTokens 百分比": "Adaptation de la pensée BudgetTokens pourcentage",
|
||||||
"0.1-1之间的小数": "Décimal entre 0,1 et 1",
|
"0.1-1之间的小数": "Décimal entre 0,1 et 1",
|
||||||
|
"0.1以上的小数": "Décimal supérieur à 0,1",
|
||||||
"模型相关设置": "Paramètres liés au modèle",
|
"模型相关设置": "Paramètres liés au modèle",
|
||||||
"收起侧边栏": "Réduire la barre latérale",
|
"收起侧边栏": "Réduire la barre latérale",
|
||||||
"展开侧边栏": "Développer la barre latérale",
|
"展开侧边栏": "Développer la barre latérale",
|
||||||
|
|||||||
@@ -202,9 +202,8 @@ export default function SettingClaudeModel(props) {
|
|||||||
label={t('思考适配 BudgetTokens 百分比')}
|
label={t('思考适配 BudgetTokens 百分比')}
|
||||||
field={'claude.thinking_adapter_budget_tokens_percentage'}
|
field={'claude.thinking_adapter_budget_tokens_percentage'}
|
||||||
initValue={''}
|
initValue={''}
|
||||||
extraText={t('0.1-1之间的小数')}
|
extraText={t('0.1以上的小数')}
|
||||||
min={0.1}
|
min={0.1}
|
||||||
max={1}
|
|
||||||
onChange={(value) =>
|
onChange={(value) =>
|
||||||
setInputs({
|
setInputs({
|
||||||
...inputs,
|
...inputs,
|
||||||
|
|||||||
Reference in New Issue
Block a user