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
488e2f47
authored
Apr 11, 2023
by
archer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: 重名模型高亮;perf: 未匹配到问题时输出
parent
915b104b
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
12 additions
and
16 deletions
+12
-16
src/pages/api/chat/vectorGpt.ts
+10
-10
src/pages/chat/components/SlideBar.tsx
+2
-4
src/pages/chat/index.tsx
+0
-2
No files found.
src/pages/api/chat/vectorGpt.ts
View file @
488e2f47
...
...
@@ -96,17 +96,17 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse)
}
}
if
(
formatRedisPrompt
.
length
===
0
)
{
throw
new
Error
(
'对不起,我没有找到你的问题'
);
}
// textArr 筛选,最多 2800 tokens
const
systemPrompt
=
systemPromptFilter
(
formatRedisPrompt
,
2800
);
if
(
formatRedisPrompt
.
length
>
0
)
{
// textArr 筛选,最多 2800 tokens
const
systemPrompt
=
systemPromptFilter
(
formatRedisPrompt
,
2800
);
prompts
.
unshift
({
obj
:
'SYSTEM'
,
value
:
`
${
model
.
systemPrompt
}
知识库内容是最新的,知识库内容为: "
${
systemPrompt
}
"`
});
prompts
.
unshift
({
obj
:
'SYSTEM'
,
value
:
`
${
model
.
systemPrompt
}
知识库内容是最新的,知识库内容为: "
${
systemPrompt
}
"`
});
}
else
{
return
res
.
send
(
'对不起,你的问题不在知识库中。'
);
}
// 控制在 tokens 数量,防止超出
const
filterPrompts
=
openaiChatFilter
(
prompts
,
modelConstantsData
.
contextMaxToken
);
...
...
src/pages/chat/components/SlideBar.tsx
View file @
488e2f47
...
...
@@ -35,13 +35,11 @@ import WxConcat from '@/components/WxConcat';
import
{
useMarkdown
}
from
'@/hooks/useMarkdown'
;
const
SlideBar
=
({
name
,
chatId
,
modelId
,
resetChat
,
onClose
}:
{
name
?:
string
;
chatId
:
string
;
modelId
:
string
;
resetChat
:
()
=>
void
;
...
...
@@ -188,14 +186,14 @@ const SlideBar = ({
}
}
fontSize=
{
'xs'
}
border=
{
'1px solid transparent'
}
{
...
(
item
.
name
===
name
{
...
(
item
.
_id
===
modelId
?
{
borderColor
:
'
rgba
(255,255,255,0
.
5)',
backgroundColor
:
'
rgba
(255,255,255,0
.
1)'
}
:
{})}
onClick=
{
async
()
=>
{
if
(
item
.
name
===
name
)
return
;
if
(
item
.
_id
===
modelId
)
return
;
router
.
replace
(
`/chat?chatId=${await getChatSiteId(item._id)}`
);
onClose
();
}
}
...
...
src/pages/chat/index.tsx
View file @
488e2f47
...
...
@@ -362,7 +362,6 @@ const Chat = ({ chatId }: { chatId: string }) => {
<
Box
flex=
{
'0 0 250px'
}
w=
{
0
}
h=
{
'100%'
}
>
<
SlideBar
resetChat=
{
resetChat
}
name=
{
chatData
?.
name
}
chatId=
{
chatId
}
modelId=
{
chatData
.
modelId
}
onClose=
{
onCloseSlider
}
...
...
@@ -394,7 +393,6 @@ const Chat = ({ chatId }: { chatId: string }) => {
<
DrawerContent
maxWidth=
{
'250px'
}
>
<
SlideBar
resetChat=
{
resetChat
}
name=
{
chatData
?.
name
}
chatId=
{
chatId
}
modelId=
{
chatData
.
modelId
}
onClose=
{
onCloseSlider
}
...
...
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