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
ab108d61
Commit
ab108d61
authored
Jul 24, 2023
by
金伟强
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'feat/universal-chat-fe' into deploy/dev
parents
f9072510
71f96123
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
40 additions
and
4 deletions
+40
-4
index.tsx
web/app/components/app/chat/thought/index.tsx
+22
-4
type.ts
web/app/components/app/chat/type.ts
+1
-0
index.tsx
web/app/components/explore/universal-chat/index.tsx
+1
-0
explore.en.ts
web/i18n/lang/explore.en.ts
+8
-0
explore.zh.ts
web/i18n/lang/explore.zh.ts
+8
-0
No files found.
web/app/components/app/chat/thought/index.tsx
View file @
ab108d61
...
...
@@ -30,14 +30,32 @@ const Thought: FC<IThoughtProps> = ({
})
=>
{
const
{
t
}
=
useTranslation
()
const
[
isShowDetail
,
setIsShowDetail
]
=
React
.
useState
(
false
)
const
getThoughtText
=
(
item
:
ThoughtItem
)
=>
{
try
{
const
input
=
JSON
.
parse
(
item
.
tool_input
)
switch
(
item
.
tool
)
{
case
'dataset'
:
// debugger
return
t
(
'explore.universalChat.thought.res.dataset'
,
{
input
:
input
.
dataset_id
})
case
'web_reader'
:
return
t
(
`explore.universalChat.thought.res.webReader.
${
!
input
.
cursor
?
'normal'
:
'hasPageInfo'
}
`
).
replace
(
'{url}'
,
`<a href="
${
input
.
url
}
" class="text-[#155EEF]">
${
input
.
url
}
</a>`
)
default
:
// google, wikipedia
return
t
(
'explore.universalChat.thought.res.search'
,
{
query
:
input
.
query
})
}
}
catch
(
error
)
{
console
.
error
(
error
)
return
item
}
}
const
renderItem
=
(
item
:
ThoughtItem
)
=>
(
<
div
className=
'flex space-x-1 py-[3px] leading-[18px]'
key=
{
item
.
id
}
>
<
div
className=
'flex items-center h-[18px] shrink-0'
>
{
getIcon
(
item
.
tool
)
}
</
div
>
<
div
dangerouslySetInnerHTML=
{
{
__html
:
item
.
thought
.
replace
(
urlRegex
,
(
url
)
=>
{
return
`<a href="${url}" class="text-[#155EEF]">${url}</a>`
}),
__html
:
getThoughtText
(
item
),
// item.thought.replace(urlRegex, (url) =>
{
// return `<a href="$
{
url
}
" class="
text
-
[
#
155
EEF
]
">${url}</a>`
// }),
}
}
></
div
>
</
div
>
)
...
...
web/app/components/app/chat/type.ts
View file @
ab108d61
...
...
@@ -20,6 +20,7 @@ export type ThoughtItem = {
id
:
string
tool
:
string
// plugin or dataset
thought
:
string
tool_input
:
string
}
export
type
IChatItem
=
{
id
:
string
...
...
web/app/components/explore/universal-chat/index.tsx
View file @
ab108d61
...
...
@@ -506,6 +506,7 @@ const Main: FC<IMainProps> = () => {
}
},
onThought
(
thought
)
{
// debugger
// thought then start to return message
(
responseItem
as
any
).
agent_thoughts
.
push
(
thought
)
},
...
...
web/i18n/lang/explore.en.ts
View file @
ab108d61
...
...
@@ -60,6 +60,14 @@ const translation = {
show
:
'Show'
,
hide
:
'Hide'
,
processOfThought
:
' the process of thinking'
,
res
:
{
webReader
:
{
normal
:
'Reading {url}'
,
hasPageInfo
:
'Reading next page of {url}'
,
},
search
:
'Searching {{query}}'
,
dataset
:
'Retrieving dataset {{datasetName}}'
,
},
},
viewConfigDetailTip
:
'In conversation, cannot change above settings'
,
},
...
...
web/i18n/lang/explore.zh.ts
View file @
ab108d61
...
...
@@ -59,6 +59,14 @@ const translation = {
show
:
'显示'
,
hide
:
'隐藏'
,
processOfThought
:
'思考过程'
,
res
:
{
webReader
:
{
normal
:
'解析链接 {url}'
,
hasPageInfo
:
'解析链接 {url} 的下一页'
,
},
search
:
'搜索 {{query}}'
,
dataset
:
'检索数据集 {{dataset}}'
,
},
},
viewConfigDetailTip
:
'在对话中,无法更改上述设置'
,
},
...
...
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