|
@@ -139,18 +139,24 @@ const onReset = () => {
|
|
|
state.isWaiting = false
|
|
|
state.isStop = false
|
|
|
}
|
|
|
-const initChat = async (isPrologue = true) => {
|
|
|
- onReset()
|
|
|
- const { data }: any = await appModelConfigDetail(props.ID, props.test ? 0 : 1)
|
|
|
- state.params.modelConfig = data
|
|
|
- if (isPrologue && state.params.modelConfig.openingStatement?.trim()) {
|
|
|
- state.chats.push({
|
|
|
- type: 'answer',
|
|
|
- prologue: state.params.modelConfig.openingStatement,
|
|
|
- prologueNum: state.params.modelConfig.showAll || 0,
|
|
|
- prologueQuestions: state.params.modelConfig.suggestedQuestions || [],
|
|
|
- })
|
|
|
- }
|
|
|
+const initChat = (isPrologue = true) => {
|
|
|
+ return new Promise(async (resolve) => {
|
|
|
+ onReset()
|
|
|
+ const { data }: any = await appModelConfigDetail(
|
|
|
+ props.ID,
|
|
|
+ props.test ? 0 : 1,
|
|
|
+ )
|
|
|
+ state.params.modelConfig = data
|
|
|
+ if (isPrologue && state.params.modelConfig.openingStatement?.trim()) {
|
|
|
+ state.chats.push({
|
|
|
+ type: 'answer',
|
|
|
+ prologue: state.params.modelConfig.openingStatement,
|
|
|
+ prologueNum: state.params.modelConfig.showAll || 0,
|
|
|
+ prologueQuestions: state.params.modelConfig.suggestedQuestions || [],
|
|
|
+ })
|
|
|
+ }
|
|
|
+ resolve(null)
|
|
|
+ })
|
|
|
}
|
|
|
const initHistory = async (conversationId) => {
|
|
|
await initChat(false)
|