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
2c016606
Commit
2c016606
authored
Jun 27, 2023
by
Joel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: missing vars bind
parent
3df562d0
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
11 deletions
+14
-11
index.tsx
web/app/components/share/chat/index.tsx
+12
-8
share.ts
web/service/share.ts
+2
-3
No files found.
web/app/components/share/chat/index.tsx
View file @
2c016606
...
...
@@ -65,6 +65,7 @@ const Main: FC<IMainProps> = ({
/*
* conversation info
*/
const
[
allConversationList
,
setAllConversationList
]
=
useState
<
ConversationItem
[]
>
([])
const
{
conversationList
,
setConversationList
,
...
...
@@ -148,7 +149,7 @@ const Main: FC<IMainProps> = ({
let
notSyncToStateIntroduction
=
''
let
notSyncToStateInputs
:
Record
<
string
,
any
>
|
undefined
|
null
=
{}
if
(
!
isNewConversation
)
{
const
item
=
c
onversationList
.
find
(
item
=>
item
.
id
===
currConversationId
)
const
item
=
allC
onversationList
.
find
(
item
=>
item
.
id
===
currConversationId
)
notSyncToStateInputs
=
item
?.
inputs
||
{}
setCurrInputs
(
notSyncToStateInputs
)
notSyncToStateIntroduction
=
item
?.
introduction
||
''
...
...
@@ -256,6 +257,10 @@ const Main: FC<IMainProps> = ({
return
[]
}
const
fetchAllConversations
=
()
=>
{
return
fetchConversations
(
isInstalledApp
,
installedAppInfo
?.
id
,
undefined
,
undefined
,
100
)
}
const
fetchInitData
=
()
=>
{
return
Promise
.
all
([
isInstalledApp
?
{
...
...
@@ -267,7 +272,7 @@ const Main: FC<IMainProps> = ({
},
plan
:
'basic'
,
}
:
fetchAppInfo
(),
fetch
Conversations
(
isInstalledApp
,
installedAppInfo
?.
id
),
fetchAppParams
(
isInstalledApp
,
installedAppInfo
?.
id
)])
:
fetchAppInfo
(),
fetch
AllConversations
(
),
fetchAppParams
(
isInstalledApp
,
installedAppInfo
?.
id
)])
}
// init
...
...
@@ -282,10 +287,10 @@ const Main: FC<IMainProps> = ({
setIsPublicVersion
(
tempIsPublicVersion
)
const
prompt_template
=
''
// handle current conversation id
const
{
data
:
conversations
,
has_more
}
=
conversationData
as
{
data
:
ConversationItem
[];
has_more
:
boolean
}
const
{
data
:
allConversations
}
=
conversationData
as
{
data
:
ConversationItem
[];
has_more
:
boolean
}
const
_conversationId
=
getConversationIdFromStorage
(
appId
)
const
isNotNewConversation
=
c
onversations
.
some
(
item
=>
item
.
id
===
_conversationId
)
// setHasMore(has_more
)
const
isNotNewConversation
=
allC
onversations
.
some
(
item
=>
item
.
id
===
_conversationId
)
setAllConversationList
(
allConversations
)
// fetch new conversation info
const
{
user_input_form
,
opening_statement
:
introduction
,
suggested_questions_after_answer
}:
any
=
appParams
const
prompt_variables
=
userInputsFormToPromptVariables
(
user_input_form
)
...
...
@@ -431,9 +436,8 @@ const Main: FC<IMainProps> = ({
return
if
(
getConversationIdChangeBecauseOfNew
())
{
const
{
data
:
conversations
,
has_more
}:
any
=
await
fetchConversations
(
isInstalledApp
,
installedAppInfo
?.
id
)
// setHasMore(has_more)
// setConversationList(conversations as ConversationItem[])
const
{
data
:
allConversations
}:
any
=
await
fetchAllConversations
()
setAllConversationList
(
allConversations
)
setControlUpdateConversationList
(
Date
.
now
())
}
setConversationIdChangeBecauseOfNew
(
false
)
...
...
web/service/share.ts
View file @
2c016606
...
...
@@ -57,9 +57,8 @@ export const fetchAppInfo = async () => {
return
get
(
'/site'
)
}
export
const
fetchConversations
=
async
(
isInstalledApp
:
boolean
,
installedAppId
=
''
,
last_id
?:
string
,
pinned
?:
boolean
)
=>
{
console
.
log
(
pinned
)
return
getAction
(
'get'
,
isInstalledApp
)(
getUrl
(
'conversations'
,
isInstalledApp
,
installedAppId
),
{
params
:
{
...{
limit
:
20
},
...(
last_id
?
{
last_id
}
:
{}),
...(
pinned
!==
undefined
?
{
pinned
}
:
{})
}
})
export
const
fetchConversations
=
async
(
isInstalledApp
:
boolean
,
installedAppId
=
''
,
last_id
?:
string
,
pinned
?:
boolean
,
limit
?:
number
)
=>
{
return
getAction
(
'get'
,
isInstalledApp
)(
getUrl
(
'conversations'
,
isInstalledApp
,
installedAppId
),
{
params
:
{
...{
limit
:
limit
||
20
},
...(
last_id
?
{
last_id
}
:
{}),
...(
pinned
!==
undefined
?
{
pinned
}
:
{})
}
})
}
export
const
pinConversation
=
async
(
isInstalledApp
:
boolean
,
installedAppId
=
''
,
id
:
string
)
=>
{
...
...
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