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
23838125
authored
Aug 20, 2024
by
Finley Ge
Committed by
GitHub
Aug 20, 2024
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: custom-censor-check (#2437)
* feat: custom-censor-check * chore: adjust
parent
5fab3734
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
4 deletions
+4
-4
packages/service/common/api/requestPlusApi.ts
+1
-1
packages/service/core/workflow/dispatch/chat/oneapi.ts
+3
-3
No files found.
packages/service/common/api/requestPlusApi.ts
View file @
23838125
import
{
POST
}
from
'./plusRequest'
;
import
{
POST
}
from
'./plusRequest'
;
export
const
postTextCensor
=
(
data
:
{
text
:
string
})
=>
export
const
postTextCensor
=
(
data
:
{
text
:
string
})
=>
POST
<
{
code
?:
number
;
message
:
string
}
>
(
'/common/censor/
text_baidu
'
,
data
)
POST
<
{
code
?:
number
;
message
:
string
}
>
(
'/common/censor/
check
'
,
data
)
.
then
((
res
)
=>
{
.
then
((
res
)
=>
{
if
(
res
?.
code
===
5000
)
{
if
(
res
?.
code
===
5000
)
{
return
Promise
.
reject
(
res
);
return
Promise
.
reject
(
res
);
...
...
packages/service/core/workflow/dispatch/chat/oneapi.ts
View file @
23838125
...
@@ -112,17 +112,17 @@ export const dispatchChatCompletion = async (props: ChatProps): Promise<ChatResp
...
@@ -112,17 +112,17 @@ export const dispatchChatCompletion = async (props: ChatProps): Promise<ChatResp
systemPrompt
,
systemPrompt
,
stringQuoteText
stringQuoteText
}),
}),
async
()
=>
{
(
async
()
=>
{
// censor model and system key
// censor model and system key
if
(
modelConstantsData
.
censor
&&
!
user
.
openaiAccount
?.
key
)
{
if
(
modelConstantsData
.
censor
&&
!
user
.
openaiAccount
?.
key
)
{
await
postTextCensor
({
return
postTextCensor
({
text
:
`
${
systemPrompt
}
text
:
`
${
systemPrompt
}
${
datasetQuoteText
}
${
datasetQuoteText
}
${
userChatInput
}
${
userChatInput
}
`
`
});
});
}
}
}
}
)()
]);
]);
// Get the request messages
// Get the request messages
...
...
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