Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
赵月辉
/
fastgpt-migrated
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
Unverified
Commit
138b607a
authored
Mar 13, 2023
by
Archer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
perf:提示文案;错误处理
parent
b204c55b
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
13 additions
and
26 deletions
+13
-26
src/components/Layout/index.tsx
+0
-14
src/constants/theme.ts
+3
-0
src/pages/_app.tsx
+2
-2
src/pages/api/chat/chatGpt.ts
+6
-8
src/pages/api/user/update.ts
+1
-1
src/service/errorCode.ts
+1
-1
No files found.
src/components/Layout/index.tsx
View file @
138b607a
...
...
@@ -80,20 +80,6 @@ const Layout = ({ children }: { children: JSX.Element }) => {
</
Box
>
</
Box
>
)
}
<
Box
textAlign=
{
'center'
}
backgroundColor=
{
'#fff'
}
p=
{
4
}
position=
{
'absolute'
}
bottom=
{
0
}
left=
{
0
}
right=
{
0
}
>
<
Box
>
@ Make by Archer
</
Box
>
<
Link
href=
{
'https://beian.miit.gov.cn/'
}
target=
{
'_blank'
}
>
桂ICP备19010228号-1
</
Link
>
</
Box
>
</
Box
>
)
:
(
<
Auth
>
...
...
src/constants/theme.ts
View file @
138b607a
...
...
@@ -82,6 +82,9 @@ export const theme = extendTheme({
'8xl'
:
'6rem'
,
'9xl'
:
'8rem'
},
fonts
:
{
body
:
'-apple-system,BlinkMacSystemFont,"Segoe UI",Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol"'
},
components
:
{
Modal
:
ModalTheme
,
Button
...
...
src/pages/_app.tsx
View file @
138b607a
...
...
@@ -30,8 +30,8 @@ export default function App({ Component, pageProps }: AppProps) {
return
(
<>
<
Head
>
<
title
>
日记分享
</
title
>
<
meta
name=
"description"
content=
"Generated by
Doc
GPT"
/>
<
title
>
Fast GPT
</
title
>
<
meta
name=
"description"
content=
"Generated by
Fast
GPT"
/>
<
meta
name=
"viewport"
content=
"width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0;"
...
...
src/pages/api/chat/chatGpt.ts
View file @
138b607a
...
...
@@ -18,6 +18,9 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse)
res
.
on
(
'close'
,
()
=>
{
res
.
end
();
});
req
.
on
(
'error'
,
()
=>
{
res
.
end
();
});
const
{
chatId
,
windowId
}
=
req
.
query
as
{
chatId
:
string
;
windowId
:
string
};
...
...
@@ -114,14 +117,9 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse)
}
};
try
{
for
await
(
const
chunk
of
chatResponse
.
data
as
any
)
{
const
parser
=
createParser
(
onParse
);
parser
.
feed
(
decoder
.
decode
(
chunk
));
}
}
catch
(
error
)
{
console
.
log
(
error
,
'===='
);
throw
new
Error
(
'错误了'
);
for
await
(
const
chunk
of
chatResponse
.
data
as
any
)
{
const
parser
=
createParser
(
onParse
);
parser
.
feed
(
decoder
.
decode
(
chunk
));
}
}
catch
(
err
:
any
)
{
console
.
log
(
'error->'
,
err
?.
response
,
'==='
);
...
...
src/pages/api/user/update.ts
View file @
138b607a
...
...
@@ -13,7 +13,7 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse<
const
{
authorization
}
=
req
.
headers
;
if
(
!
authorization
)
{
throw
new
Error
(
'
缺少参数
'
);
throw
new
Error
(
'
无权操作
'
);
}
const
userId
=
await
authToken
(
authorization
);
...
...
src/service/errorCode.ts
View file @
138b607a
...
...
@@ -2,5 +2,5 @@ export const openaiError: Record<string, string> = {
context_length_exceeded
:
'内容超长了,请重置对话'
,
Unauthorized
:
'API-KEY 不合法'
,
rate_limit_reached
:
'同时访问用户过多,请稍后再试'
,
'Bad Request'
:
'
内容太多了
~'
'Bad Request'
:
'
上下文太多了,请重开对话
~'
};
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