Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
phsl
/
new-api
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
85381404
authored
Sep 30, 2025
by
Seefs
Committed by
GitHub
Sep 30, 2025
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1925 from seefs001/feature/claude-context-editing
feat: claude context editing
parents
bc197184
a7f6065f
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
16 additions
and
6 deletions
+16
-6
dto/claude.go
+5
-4
relay/channel/aws/adaptor.go
+4
-0
relay/channel/claude/adaptor.go
+4
-0
web/src/i18n/locales/en.json
+1
-0
web/src/i18n/locales/fr.json
+1
-0
web/src/pages/Setting/Model/SettingClaudeModel.jsx
+1
-2
No files found.
dto/claude.go
View file @
85381404
...
@@ -196,10 +196,11 @@ type ClaudeRequest struct {
...
@@ -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
{
...
...
relay/channel/aws/adaptor.go
View file @
85381404
...
@@ -52,6 +52,10 @@ func (a *Adaptor) GetRequestURL(info *relaycommon.RelayInfo) (string, error) {
...
@@ -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
}
}
...
...
relay/channel/claude/adaptor.go
View file @
85381404
...
@@ -72,6 +72,10 @@ func (a *Adaptor) SetupRequestHeader(c *gin.Context, req *http.Header, info *rel
...
@@ -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
}
}
...
...
web/src/i18n/locales/en.json
View file @
85381404
...
@@ -1404,6 +1404,7 @@
...
@@ -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"
,
...
...
web/src/i18n/locales/fr.json
View file @
85381404
...
@@ -1404,6 +1404,7 @@
...
@@ -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"
,
...
...
web/src/pages/Setting/Model/SettingClaudeModel.jsx
View file @
85381404
...
@@ -202,9 +202,8 @@ export default function SettingClaudeModel(props) {
...
@@ -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
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment