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
3baf231a
authored
Nov 27, 2023
by
CaIon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
移除检查更新
parent
633f1eff
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
28 additions
and
23 deletions
+28
-23
controller/relay-image.go
+3
-0
controller/relay-openai.go
+2
-0
web/src/components/OtherSetting.js
+23
-23
No files found.
controller/relay-image.go
View file @
3baf231a
...
@@ -36,6 +36,9 @@ func relayImageHelper(c *gin.Context, relayMode int) *OpenAIErrorWithStatusCode
...
@@ -36,6 +36,9 @@ func relayImageHelper(c *gin.Context, relayMode int) *OpenAIErrorWithStatusCode
if
imageRequest
.
Size
==
""
{
if
imageRequest
.
Size
==
""
{
imageRequest
.
Size
=
"1024x1024"
imageRequest
.
Size
=
"1024x1024"
}
}
if
imageRequest
.
N
==
0
{
imageRequest
.
N
=
1
}
// Prompt validation
// Prompt validation
if
imageRequest
.
Prompt
==
""
{
if
imageRequest
.
Prompt
==
""
{
return
errorWrapper
(
errors
.
New
(
"prompt is required"
),
"required_field_missing"
,
http
.
StatusBadRequest
)
return
errorWrapper
(
errors
.
New
(
"prompt is required"
),
"required_field_missing"
,
http
.
StatusBadRequest
)
...
...
controller/relay-openai.go
View file @
3baf231a
...
@@ -54,6 +54,7 @@ func openaiStreamHandler(c *gin.Context, resp *http.Response, relayMode int) (*O
...
@@ -54,6 +54,7 @@ func openaiStreamHandler(c *gin.Context, resp *http.Response, relayMode int) (*O
err
:=
json
.
Unmarshal
(
common
.
StringToByteSlice
(
streamResp
),
&
streamResponses
)
err
:=
json
.
Unmarshal
(
common
.
StringToByteSlice
(
streamResp
),
&
streamResponses
)
if
err
!=
nil
{
if
err
!=
nil
{
common
.
SysError
(
"error unmarshalling stream response: "
+
err
.
Error
())
common
.
SysError
(
"error unmarshalling stream response: "
+
err
.
Error
())
wg
.
Done
()
return
// just ignore the error
return
// just ignore the error
}
}
for
_
,
streamResponse
:=
range
streamResponses
{
for
_
,
streamResponse
:=
range
streamResponses
{
...
@@ -66,6 +67,7 @@ func openaiStreamHandler(c *gin.Context, resp *http.Response, relayMode int) (*O
...
@@ -66,6 +67,7 @@ func openaiStreamHandler(c *gin.Context, resp *http.Response, relayMode int) (*O
err
:=
json
.
Unmarshal
(
common
.
StringToByteSlice
(
streamResp
),
&
streamResponses
)
err
:=
json
.
Unmarshal
(
common
.
StringToByteSlice
(
streamResp
),
&
streamResponses
)
if
err
!=
nil
{
if
err
!=
nil
{
common
.
SysError
(
"error unmarshalling stream response: "
+
err
.
Error
())
common
.
SysError
(
"error unmarshalling stream response: "
+
err
.
Error
())
wg
.
Done
()
return
// just ignore the error
return
// just ignore the error
}
}
for
_
,
streamResponse
:=
range
streamResponses
{
for
_
,
streamResponse
:=
range
streamResponses
{
...
...
web/src/components/OtherSetting.js
View file @
3baf231a
...
@@ -108,7 +108,7 @@ const OtherSetting = () => {
...
@@ -108,7 +108,7 @@ const OtherSetting = () => {
<
Grid
.
Column
>
<
Grid
.
Column
>
<
Form
loading
=
{
loading
}
>
<
Form
loading
=
{
loading
}
>
<
Header
as
=
'h3'
>
通用设置
<
/Header
>
<
Header
as
=
'h3'
>
通用设置
<
/Header
>
<
Form
.
Button
onClick
=
{
checkUpdate
}
>
检查更新
<
/Form.Button
>
{
/*<Form.Button onClick={checkUpdate}>检查更新</Form.Button>*/
}
<
Form
.
Group
widths
=
'equal'
>
<
Form
.
Group
widths
=
'equal'
>
<
Form
.
TextArea
<
Form
.
TextArea
label
=
'公告'
label
=
'公告'
...
@@ -178,28 +178,28 @@ const OtherSetting = () => {
...
@@ -178,28 +178,28 @@ const OtherSetting = () => {
<
Form
.
Button
onClick
=
{
submitFooter
}
>
设置页脚
<
/Form.Button
>
<
Form
.
Button
onClick
=
{
submitFooter
}
>
设置页脚
<
/Form.Button
>
<
/Form
>
<
/Form
>
<
/Grid.Column
>
<
/Grid.Column
>
<
Modal
{
/*<Modal*/
}
onClose
=
{()
=>
setShowUpdateModal
(
false
)
}
{
/* onClose={() => setShowUpdateModal(false)}*/
}
onOpen
=
{()
=>
setShowUpdateModal
(
true
)
}
{
/* onOpen={() => setShowUpdateModal(true)}*/
}
open
=
{
showUpdateModal
}
{
/* open={showUpdateModal}*/
}
>
{
/*>*/
}
<
Modal
.
Header
>
新版本:
{
updateData
.
tag_name
}
<
/Modal.Header
>
{
/* <Modal.Header>新版本:{updateData.tag_name}</Modal.Header>*/
}
<
Modal
.
Content
>
{
/* <Modal.Content>*/
}
<
Modal
.
Description
>
{
/* <Modal.Description>*/
}
<
div
dangerouslySetInnerHTML
=
{{
__html
:
updateData
.
content
}}
><
/div
>
{
/* <div dangerouslySetInnerHTML={{ __html: updateData.content }}></div>*/
}
<
/Modal.Description
>
{
/* </Modal.Description>*/
}
<
/Modal.Content
>
{
/* </Modal.Content>*/
}
<
Modal
.
Actions
>
{
/* <Modal.Actions>*/
}
<
Button
onClick
=
{()
=>
setShowUpdateModal
(
false
)}
>
关闭
<
/Button
>
{
/* <Button onClick={() => setShowUpdateModal(false)}>关闭</Button>*/
}
<
Button
{
/* <Button*/
}
content
=
'详情'
{
/* content='详情'*/
}
onClick
=
{()
=>
{
{
/* onClick={() => {*/
}
setShowUpdateModal
(
false
);
{
/* setShowUpdateModal(false);*/
}
openGitHubRelease
();
{
/* openGitHubRelease();*/
}
}
}
{
/* }}*/
}
/
>
{
/* />*/
}
<
/Modal.Actions
>
{
/* </Modal.Actions>*/
}
<
/Modal
>
{
/*</Modal>*/
}
<
/Grid
>
<
/Grid
>
);
);
};
};
...
...
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