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
87c5cb6b
authored
May 30, 2023
by
archer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: quote source
parent
746b9af2
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
6 additions
and
10 deletions
+6
-10
src/pages/api/chat/history/updateHistoryQuote.ts
+1
-1
src/pages/api/chat/saveChat.ts
+1
-5
src/pages/api/openapi/kb/appKbSearch.ts
+2
-2
src/pages/chat/components/QuoteModal.tsx
+1
-1
src/service/models/chat.ts
+1
-1
No files found.
src/pages/api/chat/history/updateHistoryQuote.ts
View file @
87c5cb6b
...
...
@@ -27,7 +27,7 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse)
},
{
$set
:
{
'content.$.quote.$[quoteElem].
isEdit'
:
true
'content.$.quote.$[quoteElem].
source'
:
'手动修改'
}
},
{
...
...
src/pages/api/chat/saveChat.ts
View file @
87c5cb6b
...
...
@@ -58,11 +58,7 @@ export async function saveChat({
obj
:
item
.
obj
,
value
:
item
.
value
,
systemPrompt
:
item
.
systemPrompt
,
quote
:
item
.
quote
?.
map
((
item
)
=>
({
...
item
,
isEdit
:
false
}))
||
[]
quote
:
item
.
quote
||
[]
}));
const
[
id
]
=
await
Promise
.
all
([
...
...
src/pages/api/openapi/kb/appKbSearch.ts
View file @
87c5cb6b
...
...
@@ -12,7 +12,7 @@ import { ChatRoleEnum } from '@/constants/chat';
import
{
openaiEmbedding
}
from
'../plugin/openaiEmbedding'
;
import
{
modelToolMap
}
from
'@/utils/plugin'
;
export
type
QuoteItemType
=
{
id
:
string
;
q
:
string
;
a
:
string
;
isEdit
:
boolean
};
export
type
QuoteItemType
=
{
id
:
string
;
q
:
string
;
a
:
string
;
source
?:
string
};
type
Props
=
{
prompts
:
ChatItemSimpleType
[];
similarity
:
number
;
...
...
@@ -92,7 +92,7 @@ export async function appKbSearch({
// search kb
const
{
rows
:
searchRes
}
=
await
PgClient
.
select
<
QuoteItemType
>
(
'modelData'
,
{
fields
:
[
'id'
,
'q'
,
'a'
],
fields
:
[
'id'
,
'q'
,
'a'
,
'source'
],
where
:
[
`kb_id IN (
${
model
.
chat
.
relatedKbs
.
map
((
item
)
=>
`'
${
item
}
'`
).
join
(
','
)}
)`
,
'AND'
,
...
...
src/pages/chat/components/QuoteModal.tsx
View file @
87c5cb6b
...
...
@@ -126,7 +126,7 @@ const QuoteModal = ({
position=
{
'relative'
}
_hover=
{
{
'& .edit'
:
{
display
:
'flex'
}
}
}
>
{
item
.
isEdit
&&
<
Box
color=
{
'myGray.600'
}
>
(编辑过
)
</
Box
>
}
{
item
.
source
&&
<
Box
color=
{
'myGray.600'
}
>
(
{
item
.
source
}
)
</
Box
>
}
<
Box
>
{
item
.
q
}
</
Box
>
<
Box
>
{
item
.
a
}
</
Box
>
<
Box
...
...
src/service/models/chat.ts
View file @
87c5cb6b
...
...
@@ -60,7 +60,7 @@ const ChatSchema = new Schema({
id
:
String
,
q
:
String
,
a
:
String
,
isEdit
:
Boolean
source
:
String
}
],
default
:
[]
...
...
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