Unverified Commit 301e0496 authored by Joel's avatar Joel Committed by GitHub

fix: chatbot support agent (#2201)

parent 98660e1f
...@@ -3,9 +3,11 @@ import MPEGMode from 'lamejs/src/js/MPEGMode' ...@@ -3,9 +3,11 @@ import MPEGMode from 'lamejs/src/js/MPEGMode'
import Lame from 'lamejs/src/js/Lame' import Lame from 'lamejs/src/js/Lame'
import BitStream from 'lamejs/src/js/BitStream' import BitStream from 'lamejs/src/js/BitStream'
(window as any).MPEGMode = MPEGMode if (globalThis) {
;(window as any).Lame = Lame (globalThis as any).MPEGMode = MPEGMode
;(window as any).BitStream = BitStream ;(globalThis as any).Lame = Lame
;(globalThis as any).BitStream = BitStream
}
export const convertToMp3 = (recorder: any) => { export const convertToMp3 = (recorder: any) => {
const wav = lamejs.WavHeader.readHeader(recorder.getWAV()) const wav = lamejs.WavHeader.readHeader(recorder.getWAV())
......
...@@ -660,8 +660,6 @@ const Main: FC<IMainProps> = ({ ...@@ -660,8 +660,6 @@ const Main: FC<IMainProps> = ({
}) })
}, },
onThought(thought) { onThought(thought) {
// console.log(`${thought.id};${thought.thought};${thought.tool};${thought.tool_input}`)
isAgentMode = true isAgentMode = true
const response = responseItem as any const response = responseItem as any
if (thought.message_id && !hasSetResponseId) { if (thought.message_id && !hasSetResponseId) {
......
import { useState } from 'react' import { useState } from 'react'
import produce from 'immer' import produce from 'immer'
import { useGetState } from 'ahooks'
import type { ConversationItem } from '@/models/share' import type { ConversationItem } from '@/models/share'
const storageConversationIdKey = 'conversationIdInfo' const storageConversationIdKey = 'conversationIdInfo'
...@@ -8,7 +9,7 @@ type ConversationInfoType = Omit<ConversationItem, 'inputs' | 'id'> ...@@ -8,7 +9,7 @@ type ConversationInfoType = Omit<ConversationItem, 'inputs' | 'id'>
function useConversation() { function useConversation() {
const [conversationList, setConversationList] = useState<ConversationItem[]>([]) const [conversationList, setConversationList] = useState<ConversationItem[]>([])
const [pinnedConversationList, setPinnedConversationList] = useState<ConversationItem[]>([]) const [pinnedConversationList, setPinnedConversationList] = useState<ConversationItem[]>([])
const [currConversationId, doSetCurrConversationId] = useState<string>('-1') const [currConversationId, doSetCurrConversationId, getCurrConversationId] = useGetState<string>('-1')
// when set conversation id, we do not have set appId // when set conversation id, we do not have set appId
const setCurrConversationId = (id: string, appId: string, isSetToLocalStroge = true, newConversationName = '') => { const setCurrConversationId = (id: string, appId: string, isSetToLocalStroge = true, newConversationName = '') => {
doSetCurrConversationId(id) doSetCurrConversationId(id)
...@@ -53,6 +54,7 @@ function useConversation() { ...@@ -53,6 +54,7 @@ function useConversation() {
pinnedConversationList, pinnedConversationList,
setPinnedConversationList, setPinnedConversationList,
currConversationId, currConversationId,
getCurrConversationId,
setCurrConversationId, setCurrConversationId,
getConversationIdFromStorage, getConversationIdFromStorage,
isNewConversation, isNewConversation,
......
This diff is collapsed.
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 to comment