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
60df9692
authored
Aug 11, 2023
by
JustSong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: update no route handler
parent
70fabcb3
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
4 deletions
+4
-4
controller/relay.go
+3
-3
router/web-router.go
+1
-1
No files found.
controller/relay.go
View file @
60df9692
...
...
@@ -207,10 +207,10 @@ func RelayNotImplemented(c *gin.Context) {
func
RelayNotFound
(
c
*
gin
.
Context
)
{
err
:=
OpenAIError
{
Message
:
fmt
.
Sprintf
(
"
API not found: %s:%s
"
,
c
.
Request
.
Method
,
c
.
Request
.
URL
.
Path
),
Type
:
"
one_api
_error"
,
Message
:
fmt
.
Sprintf
(
"
Invalid URL (%s %s)
"
,
c
.
Request
.
Method
,
c
.
Request
.
URL
.
Path
),
Type
:
"
invalid_request
_error"
,
Param
:
""
,
Code
:
"
api_not_found
"
,
Code
:
""
,
}
c
.
JSON
(
http
.
StatusNotFound
,
gin
.
H
{
"error"
:
err
,
...
...
router/web-router.go
View file @
60df9692
...
...
@@ -18,7 +18,7 @@ func SetWebRouter(router *gin.Engine, buildFS embed.FS, indexPage []byte) {
router
.
Use
(
middleware
.
Cache
())
router
.
Use
(
static
.
Serve
(
"/"
,
common
.
EmbedFolder
(
buildFS
,
"web/build"
)))
router
.
NoRoute
(
func
(
c
*
gin
.
Context
)
{
if
strings
.
HasPrefix
(
c
.
Request
.
RequestURI
,
"/v1"
)
{
if
strings
.
HasPrefix
(
c
.
Request
.
RequestURI
,
"/v1"
)
||
strings
.
HasPrefix
(
c
.
Request
.
RequestURI
,
"/api"
)
{
controller
.
RelayNotFound
(
c
)
return
}
...
...
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