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
2c03e162
Commit
2c03e162
authored
Jul 19, 2023
by
Joel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: to new conversation bug
parent
d0684a09
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
13 deletions
+6
-13
index.tsx
web/app/components/app/chat/index.tsx
+4
-2
index.tsx
web/app/components/explore/universal-chat/index.tsx
+2
-11
No files found.
web/app/components/app/chat/index.tsx
View file @
2c03e162
...
...
@@ -509,11 +509,13 @@ const Chat: FC<IChatProps> = ({
})
}
const
hasChatStart
=
chatList
.
some
(
item
=>
!
item
.
isAnswer
)
return
(
<
div
className=
{
cn
(
'px-3.5'
,
'h-full'
)
}
>
{
chatList
.
length
===
0
&&
(
configElem
||
null
)
}
{
!
hasChatStart
&&
(
configElem
||
null
)
}
{
/* Chat List */
}
<
div
className=
{
cn
((
chatList
.
length
===
0
&&
configElem
)
?
'h-0'
:
'h-full'
,
'space-y-[30px]'
)
}
>
<
div
className=
{
cn
((
!
hasChatStart
&&
configElem
)
?
'h-0'
:
'h-full'
,
'space-y-[30px]'
)
}
>
{
chatList
.
map
((
item
)
=>
{
if
(
item
.
isAnswer
)
{
const
isLast
=
item
.
id
===
chatList
[
chatList
.
length
-
1
].
id
...
...
web/app/components/explore/universal-chat/index.tsx
View file @
2c03e162
...
...
@@ -155,15 +155,6 @@ const Main: FC<IMainProps> = () => {
const
[
speechToTextConfig
,
setSpeechToTextConfig
]
=
useState
<
SuggestedQuestionsAfterAnswerConfig
|
null
>
(
null
)
const
[
conversationIdChangeBecauseOfNew
,
setConversationIdChangeBecauseOfNew
,
getConversationIdChangeBecauseOfNew
]
=
useGetState
(
false
)
const
[
isChatStarted
,
{
setTrue
:
setChatStarted
,
setFalse
:
setChatNotStarted
}]
=
useBoolean
(
false
)
const
handleStartChat
=
(
inputs
:
Record
<
string
,
any
>
)
=>
{
createNewChat
()
setConversationIdChangeBecauseOfNew
(
true
)
setCurrInputs
(
inputs
)
setChatStarted
()
// parse variables in introduction
setChatList
(
generateNewChatListWithOpenstatement
(
''
,
inputs
))
}
const
conversationName
=
currConversationInfo
?.
name
||
t
(
'share.chat.newChatDefaultName'
)
as
string
const
conversationIntroduction
=
currConversationInfo
?.
introduction
||
''
...
...
@@ -175,6 +166,7 @@ const Main: FC<IMainProps> = () => {
// update inputs of current conversation
let
notSyncToStateIntroduction
=
''
let
notSyncToStateInputs
:
Record
<
string
,
any
>
|
undefined
|
null
=
{}
// debugger
if
(
!
isNewConversation
)
{
const
item
=
allConversationList
.
find
(
item
=>
item
.
id
===
currConversationId
)
notSyncToStateInputs
=
item
?.
inputs
||
{}
...
...
@@ -213,7 +205,7 @@ const Main: FC<IMainProps> = () => {
})
}
if
(
isNewConversation
&&
isChatStarted
)
if
(
isNewConversation
)
setChatList
(
generateNewChatListWithOpenstatement
())
setControlFocus
(
Date
.
now
())
...
...
@@ -459,7 +451,6 @@ const Main: FC<IMainProps> = () => {
}
setConversationIdChangeBecauseOfNew
(
false
)
resetNewConversationInputs
()
setChatNotStarted
()
setCurrConversationId
(
tempNewConversationId
,
APP_ID
,
true
)
if
(
suggestedQuestionsAfterAnswerConfig
?.
enabled
&&
!
getHasStopResponded
())
{
const
{
data
}:
any
=
await
fetchSuggestedQuestions
(
responseItem
.
id
)
...
...
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