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
821e1934
Commit
821e1934
authored
Aug 02, 2023
by
John Wang
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'fix/resort-sengment-in-dataset-retrieve' into deploy/dev
parents
cee92d9d
1c380da1
Changes
8
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
38 additions
and
36 deletions
+38
-36
dataset_retriever_tool.py
api/core/tool/dataset_retriever_tool.py
+5
-1
index.tsx
web/app/components/app/chat/index.tsx
+1
-1
style.module.css
web/app/components/app/chat/style.module.css
+1
-1
index.module.css
web/app/components/datasets/create/step-two/index.module.css
+25
-23
index.tsx
web/app/components/explore/app-list/index.tsx
+1
-1
index.tsx
web/app/components/explore/create-app-modal/index.tsx
+1
-1
index.tsx
...ents/header/account-dropdown/workplace-selector/index.tsx
+4
-3
use-copy-to-clipboard.ts
web/hooks/use-copy-to-clipboard.ts
+0
-5
No files found.
api/core/tool/dataset_retriever_tool.py
View file @
821e1934
...
@@ -109,7 +109,11 @@ class DatasetRetrieverTool(BaseTool):
...
@@ -109,7 +109,11 @@ class DatasetRetrieverTool(BaseTool):
)
.
all
()
)
.
all
()
if
segments
:
if
segments
:
for
segment
in
segments
:
index_node_id_to_position
=
{
id
:
position
for
position
,
id
in
enumerate
(
index_node_ids
)}
sorted_segments
=
sorted
(
segments
,
key
=
lambda
segment
:
index_node_id_to_position
.
get
(
segment
.
index_node_id
,
float
(
'inf'
)))
for
segment
in
sorted_segments
:
if
segment
.
answer
:
if
segment
.
answer
:
document_context_list
.
append
(
f
'question:{segment.content}
\n
answer:{segment.answer}'
)
document_context_list
.
append
(
f
'question:{segment.content}
\n
answer:{segment.answer}'
)
else
:
else
:
...
...
web/app/components/app/chat/index.tsx
View file @
821e1934
...
@@ -193,7 +193,7 @@ const Chat: FC<IChatProps> = ({
...
@@ -193,7 +193,7 @@ const Chat: FC<IChatProps> = ({
)
}
)
}
{
{
isShowSuggestion
&&
(
isShowSuggestion
&&
(
<
div
className=
'pt-2
mb-2
'
>
<
div
className=
'pt-2'
>
<
div
className=
'flex items-center justify-center mb-2.5'
>
<
div
className=
'flex items-center justify-center mb-2.5'
>
<
div
className=
'grow h-[1px]'
<
div
className=
'grow h-[1px]'
style=
{
{
style=
{
{
...
...
web/app/components/app/chat/style.module.css
View file @
821e1934
.answerIcon
{
.answerIcon
{
position
:
relative
;
position
:
relative
;
background
:
url(./icons/robot.svg)
;
background
:
url(./icons/robot.svg)
100%
/
100%
;
}
}
.typeingIcon
{
.typeingIcon
{
...
...
web/app/components/datasets/create/step-two/index.module.css
View file @
821e1934
...
@@ -13,29 +13,6 @@
...
@@ -13,29 +13,6 @@
z-index
:
10
;
z-index
:
10
;
}
}
.fixed
{
padding-top
:
12px
;
font-size
:
12px
;
line-height
:
18px
;
background
:
rgba
(
255
,
255
,
255
,
0.9
);
border-bottom
:
0.5px
solid
#EAECF0
;
backdrop-filter
:
blur
(
4px
);
animation
:
fix
0.5s
;
}
@keyframes
fix
{
from
{
padding-top
:
42px
;
font-size
:
18px
;
line-height
:
28px
;
}
to
{
padding-top
:
12px
;
font-size
:
12px
;
line-height
:
18px
;
}
}
.form
{
.form
{
@apply
px-16
pb-8;
@apply
px-16
pb-8;
}
}
...
@@ -416,3 +393,28 @@
...
@@ -416,3 +393,28 @@
color
:
#101828
;
color
:
#101828
;
z-index
:
10
;
z-index
:
10
;
}
}
/*
* `fixed` must under `previewHeader` because of style override would not work
*/
.fixed
{
padding-top
:
12px
;
font-size
:
12px
;
line-height
:
18px
;
background
:
rgba
(
255
,
255
,
255
,
0.9
);
border-bottom
:
0.5px
solid
#EAECF0
;
backdrop-filter
:
blur
(
4px
);
animation
:
fix
0.5s
;
}
@keyframes
fix
{
from
{
padding-top
:
42px
;
font-size
:
18px
;
line-height
:
28px
;
}
to
{
padding-top
:
12px
;
font-size
:
12px
;
line-height
:
18px
;
}
}
web/app/components/explore/app-list/index.tsx
View file @
821e1934
...
@@ -95,7 +95,7 @@ const Apps: FC = () => {
...
@@ -95,7 +95,7 @@ const Apps: FC = () => {
onChange=
{
setCurrCategory
}
onChange=
{
setCurrCategory
}
/>
/>
<
div
<
div
className=
'flex mt-6 flex-col overflow-auto bg-gray-100 shrink-0 grow'
className=
'flex mt-6
pb-6
flex-col overflow-auto bg-gray-100 shrink-0 grow'
style=
{
{
style=
{
{
maxHeight
:
'calc(100vh - 243px)'
,
maxHeight
:
'calc(100vh - 243px)'
,
}
}
}
}
...
...
web/app/components/explore/create-app-modal/index.tsx
View file @
821e1934
...
@@ -45,7 +45,7 @@ const CreateAppModal = ({
...
@@ -45,7 +45,7 @@ const CreateAppModal = ({
<>
<>
<
Modal
<
Modal
isShow=
{
show
}
isShow=
{
show
}
onClose=
{
onHide
}
onClose=
{
()
=>
{}
}
className=
{
cn
(
s
.
modal
,
'!max-w-[480px]'
,
'px-8'
)
}
className=
{
cn
(
s
.
modal
,
'!max-w-[480px]'
,
'px-8'
)
}
>
>
<
span
className=
{
s
.
close
}
onClick=
{
onHide
}
/>
<
span
className=
{
s
.
close
}
onClick=
{
onHide
}
/>
...
...
web/app/components/header/account-dropdown/workplace-selector/index.tsx
View file @
821e1934
...
@@ -27,10 +27,11 @@ const WorkplaceSelector = () => {
...
@@ -27,10 +27,11 @@ const WorkplaceSelector = () => {
const
{
t
}
=
useTranslation
()
const
{
t
}
=
useTranslation
()
const
{
notify
}
=
useContext
(
ToastContext
)
const
{
notify
}
=
useContext
(
ToastContext
)
const
{
workspaces
}
=
useWorkspacesContext
()
const
{
workspaces
}
=
useWorkspacesContext
()
const
currentW
rokspace
=
workspaces
.
filter
(
item
=>
item
.
current
)?.[
0
]
const
currentW
orkspace
=
workspaces
.
find
(
v
=>
v
.
current
)
const
handleSwitchWorkspace
=
async
(
tenant_id
:
string
)
=>
{
const
handleSwitchWorkspace
=
async
(
tenant_id
:
string
)
=>
{
try
{
try
{
if
(
currentWorkspace
?.
id
===
tenant_id
)
return
await
switchWorkspace
({
url
:
'/workspaces/switch'
,
body
:
{
tenant_id
}
})
await
switchWorkspace
({
url
:
'/workspaces/switch'
,
body
:
{
tenant_id
}
})
notify
({
type
:
'success'
,
message
:
t
(
'common.actionMsg.modifiedSuccessfully'
)
})
notify
({
type
:
'success'
,
message
:
t
(
'common.actionMsg.modifiedSuccessfully'
)
})
location
.
assign
(
`
${
location
.
origin
}
`
)
location
.
assign
(
`
${
location
.
origin
}
`
)
...
@@ -51,8 +52,8 @@ const WorkplaceSelector = () => {
...
@@ -51,8 +52,8 @@ const WorkplaceSelector = () => {
group hover:bg-gray-50 cursor-pointer ${open && 'bg-gray-50'} rounded-lg
group hover:bg-gray-50 cursor-pointer ${open && 'bg-gray-50'} rounded-lg
`
,
`
,
)
}
>
)
}
>
<
div
className=
{
itemIconClassName
}
>
{
currentW
ro
kspace
?.
name
[
0
].
toLocaleUpperCase
()
}
</
div
>
<
div
className=
{
itemIconClassName
}
>
{
currentW
or
kspace
?.
name
[
0
].
toLocaleUpperCase
()
}
</
div
>
<
div
className=
{
`${itemNameClassName} truncate`
}
>
{
currentW
ro
kspace
?.
name
}
</
div
>
<
div
className=
{
`${itemNameClassName} truncate`
}
>
{
currentW
or
kspace
?.
name
}
</
div
>
<
ChevronRight
className=
'shrink-0 w-[14px] h-[14px] text-gray-500'
/>
<
ChevronRight
className=
'shrink-0 w-[14px] h-[14px] text-gray-500'
/>
</
Menu
.
Button
>
</
Menu
.
Button
>
<
Transition
<
Transition
...
...
web/hooks/use-copy-to-clipboard.ts
View file @
821e1934
...
@@ -8,11 +8,6 @@ function useCopyToClipboard(): [CopiedValue, CopyFn] {
...
@@ -8,11 +8,6 @@ function useCopyToClipboard(): [CopiedValue, CopyFn] {
const
[
copiedText
,
setCopiedText
]
=
useState
<
CopiedValue
>
(
null
)
const
[
copiedText
,
setCopiedText
]
=
useState
<
CopiedValue
>
(
null
)
const
copy
:
CopyFn
=
useCallback
(
async
(
text
:
string
)
=>
{
const
copy
:
CopyFn
=
useCallback
(
async
(
text
:
string
)
=>
{
if
(
!
navigator
?.
clipboard
)
{
console
.
warn
(
'Clipboard not supported'
)
return
false
}
try
{
try
{
writeText
(
text
)
writeText
(
text
)
setCopiedText
(
text
)
setCopiedText
(
text
)
...
...
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