Commit 23838125 by Finley Ge Committed by GitHub

feat: custom-censor-check (#2437)

* feat: custom-censor-check

* chore: adjust
parent 5fab3734
import { POST } from './plusRequest';
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) => {
if (res?.code === 5000) {
return Promise.reject(res);
......
......@@ -112,17 +112,17 @@ export const dispatchChatCompletion = async (props: ChatProps): Promise<ChatResp
systemPrompt,
stringQuoteText
}),
async () => {
(async () => {
// censor model and system key
if (modelConstantsData.censor && !user.openaiAccount?.key) {
await postTextCensor({
return postTextCensor({
text: `${systemPrompt}
${datasetQuoteText}
${userChatInput}
`
});
}
}
})()
]);
// Get the request messages
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment