Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
陈曦
sub2api
Commits
d85288a6
Commit
d85288a6
authored
Jan 12, 2026
by
ianshaw
Browse files
Revert "fix(gateway): 修复 base_url 包含 /chat/completions 时路径拼接错误"
This reverts commit
7fdc25df
.
parent
3402acb6
Changes
2
Hide whitespace changes
Inline
Side-by-side
backend/internal/service/account_test_service.go
View file @
d85288a6
...
@@ -332,10 +332,7 @@ func (s *AccountTestService) testOpenAIAccountConnection(c *gin.Context, account
...
@@ -332,10 +332,7 @@ func (s *AccountTestService) testOpenAIAccountConnection(c *gin.Context, account
if
err
!=
nil
{
if
err
!=
nil
{
return
s
.
sendErrorAndEnd
(
c
,
fmt
.
Sprintf
(
"Invalid base URL: %s"
,
err
.
Error
()))
return
s
.
sendErrorAndEnd
(
c
,
fmt
.
Sprintf
(
"Invalid base URL: %s"
,
err
.
Error
()))
}
}
// Remove /chat/completions suffix if present, then add /responses
apiURL
=
strings
.
TrimSuffix
(
normalizedBaseURL
,
"/"
)
+
"/responses"
normalizedBaseURL
=
strings
.
TrimSuffix
(
normalizedBaseURL
,
"/"
)
normalizedBaseURL
=
strings
.
TrimSuffix
(
normalizedBaseURL
,
"/chat/completions"
)
apiURL
=
normalizedBaseURL
+
"/responses"
}
else
{
}
else
{
return
s
.
sendErrorAndEnd
(
c
,
fmt
.
Sprintf
(
"Unsupported account type: %s"
,
account
.
Type
))
return
s
.
sendErrorAndEnd
(
c
,
fmt
.
Sprintf
(
"Unsupported account type: %s"
,
account
.
Type
))
}
}
...
...
backend/internal/service/openai_gateway_service.go
View file @
d85288a6
...
@@ -738,9 +738,6 @@ func (s *OpenAIGatewayService) buildUpstreamRequest(ctx context.Context, c *gin.
...
@@ -738,9 +738,6 @@ func (s *OpenAIGatewayService) buildUpstreamRequest(ctx context.Context, c *gin.
if
err
!=
nil
{
if
err
!=
nil
{
return
nil
,
err
return
nil
,
err
}
}
// Remove /chat/completions suffix if present, then add /responses
validatedURL
=
strings
.
TrimSuffix
(
validatedURL
,
"/"
)
validatedURL
=
strings
.
TrimSuffix
(
validatedURL
,
"/chat/completions"
)
targetURL
=
validatedURL
+
"/responses"
targetURL
=
validatedURL
+
"/responses"
}
}
default
:
default
:
...
...
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