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
d007f84c
authored
Mar 08, 2024
by
CaIon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: fix claude channel test
parent
22f1c13a
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
4 deletions
+4
-4
controller/channel-test.go
+4
-2
relay/channel/claude/adaptor.go
+0
-2
No files found.
controller/channel-test.go
View file @
d007f84c
...
@@ -52,6 +52,7 @@ func testChannel(channel *model.Channel, testModel string) (err error, openaiErr
...
@@ -52,6 +52,7 @@ func testChannel(channel *model.Channel, testModel string) (err error, openaiErr
case
common
.
ChannelTypeAli
:
case
common
.
ChannelTypeAli
:
c
.
Set
(
"plugin"
,
channel
.
Other
)
c
.
Set
(
"plugin"
,
channel
.
Other
)
}
}
meta
:=
relaycommon
.
GenRelayInfo
(
c
)
meta
:=
relaycommon
.
GenRelayInfo
(
c
)
apiType
:=
constant
.
ChannelType2APIType
(
channel
.
Type
)
apiType
:=
constant
.
ChannelType2APIType
(
channel
.
Type
)
adaptor
:=
relay
.
GetAdaptor
(
apiType
)
adaptor
:=
relay
.
GetAdaptor
(
apiType
)
...
@@ -60,13 +61,14 @@ func testChannel(channel *model.Channel, testModel string) (err error, openaiErr
...
@@ -60,13 +61,14 @@ func testChannel(channel *model.Channel, testModel string) (err error, openaiErr
}
}
if
testModel
==
""
{
if
testModel
==
""
{
testModel
=
adaptor
.
GetModelList
()[
0
]
testModel
=
adaptor
.
GetModelList
()[
0
]
meta
.
UpstreamModelName
=
testModel
}
}
request
:=
buildTestRequest
()
request
:=
buildTestRequest
()
request
.
Model
=
testModel
meta
.
UpstreamModelName
=
testModel
adaptor
.
Init
(
meta
,
*
request
)
adaptor
.
Init
(
meta
,
*
request
)
request
.
Model
=
testModel
meta
.
UpstreamModelName
=
testModel
convertedRequest
,
err
:=
adaptor
.
ConvertRequest
(
c
,
constant
.
RelayModeChatCompletions
,
request
)
convertedRequest
,
err
:=
adaptor
.
ConvertRequest
(
c
,
constant
.
RelayModeChatCompletions
,
request
)
if
err
!=
nil
{
if
err
!=
nil
{
return
err
,
nil
return
err
,
nil
...
...
relay/channel/claude/adaptor.go
View file @
d007f84c
...
@@ -6,7 +6,6 @@ import (
...
@@ -6,7 +6,6 @@ import (
"github.com/gin-gonic/gin"
"github.com/gin-gonic/gin"
"io"
"io"
"net/http"
"net/http"
"one-api/common"
"one-api/dto"
"one-api/dto"
"one-api/relay/channel"
"one-api/relay/channel"
relaycommon
"one-api/relay/common"
relaycommon
"one-api/relay/common"
...
@@ -50,7 +49,6 @@ func (a *Adaptor) SetupRequestHeader(c *gin.Context, req *http.Request, info *re
...
@@ -50,7 +49,6 @@ func (a *Adaptor) SetupRequestHeader(c *gin.Context, req *http.Request, info *re
}
}
func
(
a
*
Adaptor
)
ConvertRequest
(
c
*
gin
.
Context
,
relayMode
int
,
request
*
dto
.
GeneralOpenAIRequest
)
(
any
,
error
)
{
func
(
a
*
Adaptor
)
ConvertRequest
(
c
*
gin
.
Context
,
relayMode
int
,
request
*
dto
.
GeneralOpenAIRequest
)
(
any
,
error
)
{
common
.
SysLog
(
fmt
.
Sprintf
(
"Request mode: %d"
,
a
.
RequestMode
))
if
request
==
nil
{
if
request
==
nil
{
return
nil
,
errors
.
New
(
"request is nil"
)
return
nil
,
errors
.
New
(
"request is nil"
)
}
}
...
...
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