Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
D
dify
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ai-tech
dify
Commits
301e0496
Unverified
Commit
301e0496
authored
Jan 25, 2024
by
Joel
Committed by
GitHub
Jan 25, 2024
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: chatbot support agent (#2201)
parent
98660e1f
Changes
4
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
194 additions
and
37 deletions
+194
-37
utils.ts
web/app/components/base/voice-input/utils.ts
+5
-3
index.tsx
web/app/components/share/chat/index.tsx
+0
-2
use-conversation.ts
web/app/components/share/chatbot/hooks/use-conversation.ts
+3
-1
index.tsx
web/app/components/share/chatbot/index.tsx
+186
-31
No files found.
web/app/components/base/voice-input/utils.ts
View file @
301e0496
...
...
@@ -3,9 +3,11 @@ import MPEGMode from 'lamejs/src/js/MPEGMode'
import
Lame
from
'lamejs/src/js/Lame'
import
BitStream
from
'lamejs/src/js/BitStream'
(
window
as
any
).
MPEGMode
=
MPEGMode
;(
window
as
any
).
Lame
=
Lame
;(
window
as
any
).
BitStream
=
BitStream
if
(
globalThis
)
{
(
globalThis
as
any
).
MPEGMode
=
MPEGMode
;(
globalThis
as
any
).
Lame
=
Lame
;(
globalThis
as
any
).
BitStream
=
BitStream
}
export
const
convertToMp3
=
(
recorder
:
any
)
=>
{
const
wav
=
lamejs
.
WavHeader
.
readHeader
(
recorder
.
getWAV
())
...
...
web/app/components/share/chat/index.tsx
View file @
301e0496
...
...
@@ -660,8 +660,6 @@ const Main: FC<IMainProps> = ({
})
},
onThought
(
thought
)
{
// console.log(`${thought.id};${thought.thought};${thought.tool};${thought.tool_input}`)
isAgentMode
=
true
const
response
=
responseItem
as
any
if
(
thought
.
message_id
&&
!
hasSetResponseId
)
{
...
...
web/app/components/share/chatbot/hooks/use-conversation.ts
View file @
301e0496
import
{
useState
}
from
'react'
import
produce
from
'immer'
import
{
useGetState
}
from
'ahooks'
import
type
{
ConversationItem
}
from
'@/models/share'
const
storageConversationIdKey
=
'conversationIdInfo'
...
...
@@ -8,7 +9,7 @@ type ConversationInfoType = Omit<ConversationItem, 'inputs' | 'id'>
function
useConversation
()
{
const
[
conversationList
,
setConversationList
]
=
useState
<
ConversationItem
[]
>
([])
const
[
pinnedConversationList
,
setPinnedConversationList
]
=
useState
<
ConversationItem
[]
>
([])
const
[
currConversationId
,
doSetCurrConversationId
]
=
use
State
<
string
>
(
'-1'
)
const
[
currConversationId
,
doSetCurrConversationId
,
getCurrConversationId
]
=
useGet
State
<
string
>
(
'-1'
)
// when set conversation id, we do not have set appId
const
setCurrConversationId
=
(
id
:
string
,
appId
:
string
,
isSetToLocalStroge
=
true
,
newConversationName
=
''
)
=>
{
doSetCurrConversationId
(
id
)
...
...
@@ -53,6 +54,7 @@ function useConversation() {
pinnedConversationList
,
setPinnedConversationList
,
currConversationId
,
getCurrConversationId
,
setCurrConversationId
,
getConversationIdFromStorage
,
isNewConversation
,
...
...
web/app/components/share/chatbot/index.tsx
View file @
301e0496
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment