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
9962d036
authored
Sep 27, 2024
by
1808837298@qq.com
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: playground max_tokens #512 #511
parent
f3d13659
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
2 deletions
+5
-2
controller/relay.go
+2
-1
web/src/components/Playground.js
+3
-1
No files found.
controller/relay.go
View file @
9962d036
...
@@ -75,7 +75,8 @@ func Playground(c *gin.Context) {
...
@@ -75,7 +75,8 @@ func Playground(c *gin.Context) {
}
}
channel
,
err
:=
model
.
CacheGetRandomSatisfiedChannel
(
group
,
playgroundRequest
.
Model
,
0
)
channel
,
err
:=
model
.
CacheGetRandomSatisfiedChannel
(
group
,
playgroundRequest
.
Model
,
0
)
if
err
!=
nil
{
if
err
!=
nil
{
openaiErr
=
service
.
OpenAIErrorWrapperLocal
(
err
,
"get_playground_channel_failed"
,
http
.
StatusInternalServerError
)
message
:=
fmt
.
Sprintf
(
"当前分组 %s 下对于模型 %s 无可用渠道"
,
group
,
playgroundRequest
.
Model
)
openaiErr
=
service
.
OpenAIErrorWrapperLocal
(
errors
.
New
(
message
),
"get_playground_channel_failed"
,
http
.
StatusInternalServerError
)
return
return
}
}
middleware
.
SetupContextForSelectedChannel
(
c
,
channel
,
playgroundRequest
.
Model
)
middleware
.
SetupContextForSelectedChannel
(
c
,
channel
,
playgroundRequest
.
Model
)
...
...
web/src/components/Playground.js
View file @
9962d036
...
@@ -133,8 +133,10 @@ const Playground = () => {
...
@@ -133,8 +133,10 @@ const Playground = () => {
completeMessage
();
completeMessage
();
}
else
{
}
else
{
let
text
=
payload
.
choices
[
0
].
delta
.
content
;
let
text
=
payload
.
choices
[
0
].
delta
.
content
;
if
(
text
)
{
generateMockResponse
(
text
);
generateMockResponse
(
text
);
}
}
}
}
else
{
}
else
{
completeMessage
();
completeMessage
();
}
}
...
@@ -186,7 +188,7 @@ const Playground = () => {
...
@@ -186,7 +188,7 @@ const Playground = () => {
stream
:
true
,
stream
:
true
,
model
:
inputs
.
model
,
model
:
inputs
.
model
,
group
:
inputs
.
group
,
group
:
inputs
.
group
,
max_tokens
:
inputs
.
max_tokens
,
max_tokens
:
parseInt
(
inputs
.
max_tokens
)
,
temperature
:
inputs
.
temperature
,
temperature
:
inputs
.
temperature
,
};
};
};
};
...
...
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