Commit 821e1934 authored by John Wang's avatar John Wang

Merge branch 'fix/resort-sengment-in-dataset-retrieve' into deploy/dev

parents cee92d9d 1c380da1
...@@ -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} \nanswer:{segment.answer}') document_context_list.append(f'question:{segment.content} \nanswer:{segment.answer}')
else: else:
......
...@@ -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={{
......
.answerIcon { .answerIcon {
position: relative; position: relative;
background: url(./icons/robot.svg); background: url(./icons/robot.svg) 100%/100%;
} }
.typeingIcon { .typeingIcon {
......
...@@ -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;
}
}
...@@ -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)',
}} }}
......
...@@ -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}/>
......
...@@ -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 currentWrokspace = workspaces.filter(item => item.current)?.[0] const currentWorkspace = 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}>{currentWrokspace?.name[0].toLocaleUpperCase()}</div> <div className={itemIconClassName}>{currentWorkspace?.name[0].toLocaleUpperCase()}</div>
<div className={`${itemNameClassName} truncate`}>{currentWrokspace?.name}</div> <div className={`${itemNameClassName} truncate`}>{currentWorkspace?.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
......
...@@ -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)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment