feat: add api-based extension & external data tool & moderation (#1459)

This commit is contained in:
zxhlyh 2023-11-06 19:36:32 +08:00 • committed by GitHub
commit 32747641e4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
84 changed files with 3327 additions and 167 deletions

View file

@ -368,7 +368,7 @@ const Main: FC<IMainProps> = ({
const isNotNewConversation = allConversations.some(item => item.id === _conversationId)
setAllConversationList(allConversations)
// fetch new conversation info
const { user_input_form, opening_statement: introduction, suggested_questions_after_answer, speech_to_text, retriever_resource }: any = appParams
const { user_input_form, opening_statement: introduction, suggested_questions_after_answer, speech_to_text, retriever_resource, sensitive_word_avoidance }: any = appParams
const prompt_variables = userInputsFormToPromptVariables(user_input_form)
if (siteInfo.default_language)
changeLanguage(siteInfo.default_language)
@ -555,6 +555,22 @@ const Main: FC<IMainProps> = ({
setChatList(newListWithAnswer)
}
: undefined,
onMessageReplace: (messageReplace) => {
if (isInstalledApp) {
responseItem.content = messageReplace.answer
}
else {
setChatList(produce(
getChatList(),
(draft) => {
const current = draft.find(item => item.id === messageReplace.id)
if (current)
current.content = messageReplace.answer
},
))
}
},
onError() {
setResponsingFalse()
// role back placeholder answer