|
@@ -116,10 +116,8 @@ const onSend = (text = '') => {
|
|
|
behavior: 'smooth'
|
|
|
});
|
|
|
},
|
|
|
- onFile(file) {
|
|
|
- },
|
|
|
- onThought(thought) {
|
|
|
- },
|
|
|
+ onFile(file) {},
|
|
|
+ onThought(thought) {},
|
|
|
onMessageEnd: (messageEnd) => {
|
|
|
if (!state.params.conversation_id) {
|
|
|
state.params.conversation_id = messageEnd.conversation_id
|
|
@@ -134,29 +132,58 @@ const onSend = (text = '') => {
|
|
|
})
|
|
|
}
|
|
|
},
|
|
|
- onMessageReplace: (messageReplace) => {
|
|
|
- },
|
|
|
- onError() {
|
|
|
- },
|
|
|
- onWorkflowStarted: ({ workflow_run_id, task_id }) => {
|
|
|
- },
|
|
|
- onWorkflowFinished: ({ data: workflowFinishedData }) => {
|
|
|
- },
|
|
|
- onIterationStart: ({ data: iterationStartedData }) => {
|
|
|
- },
|
|
|
- onIterationFinish: ({ data: iterationFinishedData }) => {
|
|
|
- },
|
|
|
- onNodeStarted: ({ data: nodeStartedData }) => {
|
|
|
- },
|
|
|
- onNodeFinished: ({ data: nodeFinishedData }) => {
|
|
|
- },
|
|
|
- onTTSChunk: (messageId: string, audio: string) => {
|
|
|
- },
|
|
|
- onTTSEnd: (messageId: string, audio: string) => {
|
|
|
- },
|
|
|
+ onMessageReplace: (messageReplace) => {},
|
|
|
+ onError() {},
|
|
|
+ onWorkflowStarted: ({ workflow_run_id, task_id }) => {},
|
|
|
+ onWorkflowFinished: ({ data: workflowFinishedData }) => {},
|
|
|
+ onIterationStart: ({ data: iterationStartedData }) => {},
|
|
|
+ onIterationFinish: ({ data: iterationFinishedData }) => {},
|
|
|
+ onNodeStarted: ({ data: nodeStartedData }) => {},
|
|
|
+ onNodeFinished: ({ data: nodeFinishedData }) => {},
|
|
|
+ onTTSChunk: (messageId: string, audio: string) => {},
|
|
|
+ onTTSEnd: (messageId: string, audio: string) => {},
|
|
|
})
|
|
|
+ getRelation(state.params.query)
|
|
|
}
|
|
|
}
|
|
|
+const getRelation = (text) => {
|
|
|
+ let relation = ''
|
|
|
+ ssePost(`/installed-apps/833b8e52-a909-4655-8e3d-22e7aaf13903/chat-messages`, {
|
|
|
+ body: {
|
|
|
+ response_mode: "blocking",
|
|
|
+ conversation_id: "",
|
|
|
+ files: [],
|
|
|
+ query: text,
|
|
|
+ inputs: {},
|
|
|
+ parent_message_id: null
|
|
|
+ },
|
|
|
+ }, {
|
|
|
+ onData: (message: string, isFirstMessage: boolean, { conversationId: newConversationId, messageId, taskId }: any) => {
|
|
|
+ relation += message
|
|
|
+ },
|
|
|
+ onFile(file) {},
|
|
|
+ onThought(thought) {},
|
|
|
+ onMessageEnd: (messageEnd) => {
|
|
|
+ console.log('回答完毕')
|
|
|
+ try {
|
|
|
+ const json = JSON.parse(relation)
|
|
|
+ console.log('原始数据', json)
|
|
|
+ } catch (e) {
|
|
|
+ console.log(e)
|
|
|
+ }
|
|
|
+ },
|
|
|
+ onMessageReplace: (messageReplace) => {},
|
|
|
+ onError() {},
|
|
|
+ onWorkflowStarted: ({ workflow_run_id, task_id }) => {},
|
|
|
+ onWorkflowFinished: ({ data: workflowFinishedData }) => {},
|
|
|
+ onIterationStart: ({ data: iterationStartedData }) => {},
|
|
|
+ onIterationFinish: ({ data: iterationFinishedData }) => {},
|
|
|
+ onNodeStarted: ({ data: nodeStartedData }) => {},
|
|
|
+ onNodeFinished: ({ data: nodeFinishedData }) => {},
|
|
|
+ onTTSChunk: (messageId: string, audio: string) => {},
|
|
|
+ onTTSEnd: (messageId: string, audio: string) => {},
|
|
|
+ })
|
|
|
+}
|
|
|
const onLoading = () => {
|
|
|
state.loading = true
|
|
|
}
|