Merge branch 'main' into feat/workflow

This commit is contained in:
JzoNg 2024-03-27 10:33:28 +08:00
commit 829a7b0d16
9 changed files with 27 additions and 16 deletions

View File

@ -148,7 +148,8 @@ class SparkLLMClient:
data = { data = {
"header": { "header": {
"app_id": self.app_id, "app_id": self.app_id,
"uid": user_id # resolve this error message => $.header.uid' length must be less or equal than 32
"uid": user_id[:32] if user_id else None
}, },
"parameter": { "parameter": {
"chat": { "chat": {

View File

@ -46,7 +46,7 @@ const DatasetCard = ({
return ( return (
<> <>
<Link href={`/datasets/${dataset.id}/documents`} className={cn(style.listItem)}> <Link href={`/datasets/${dataset.id}/documents`} className={cn(style.listItem)} data-disable-nprogress={true}>
<div className={style.listItemTitle}> <div className={style.listItemTitle}>
<AppIcon size='small' className={cn(!dataset.embedding_available && style.unavailable)} /> <AppIcon size='small' className={cn(!dataset.embedding_available && style.unavailable)} />
<div className={cn(style.listItemHeading, !dataset.embedding_available && style.unavailable)}> <div className={cn(style.listItemHeading, !dataset.embedding_available && style.unavailable)}>

View File

@ -117,7 +117,7 @@ const EditAnnotationModal: FC<Props> = ({
<MessageCheckRemove /> <MessageCheckRemove />
<div>{t('appAnnotation.editModal.removeThisCache')}</div> <div>{t('appAnnotation.editModal.removeThisCache')}</div>
</div> </div>
{createdAt && <div>{t('appAnnotation.editModal.createdAt')}&nbsp;{dayjs(createdAt * 1000).format('YYYY-MM-DD hh:mm')}</div>} {createdAt && <div>{t('appAnnotation.editModal.createdAt')}&nbsp;{dayjs(createdAt * 1000).format('YYYY-MM-DD HH:mm')}</div>}
</div> </div>
) )
: undefined : undefined

View File

@ -54,7 +54,7 @@ const List: FC<Props> = ({
className='whitespace-nowrap overflow-hidden text-ellipsis max-w-[250px]' className='whitespace-nowrap overflow-hidden text-ellipsis max-w-[250px]'
title={item.answer} title={item.answer}
>{item.answer}</td> >{item.answer}</td>
<td>{dayjs(item.created_at * 1000).format('YYYY-MM-DD hh:mm')}</td> <td>{dayjs(item.created_at * 1000).format('YYYY-MM-DD HH:mm')}</td>
<td>{item.hit_count}</td> <td>{item.hit_count}</td>
<td className='w-[96px]' onClick={e => e.stopPropagation()}> <td className='w-[96px]' onClick={e => e.stopPropagation()}>
{/* Actions */} {/* Actions */}

View File

@ -142,7 +142,7 @@ const ViewAnnotationModal: FC<Props> = ({
>{item.response}</td> >{item.response}</td>
<td>{item.source}</td> <td>{item.source}</td>
<td>{item.score ? item.score.toFixed(2) : '-'}</td> <td>{item.score ? item.score.toFixed(2) : '-'}</td>
<td>{dayjs(item.created_at * 1000).format('YYYY-MM-DD hh:mm')}</td> <td>{dayjs(item.created_at * 1000).format('YYYY-MM-DD HH:mm')}</td>
</tr> </tr>
))} ))}
</tbody> </tbody>
@ -214,7 +214,7 @@ const ViewAnnotationModal: FC<Props> = ({
<MessageCheckRemove /> <MessageCheckRemove />
<div>{t('appAnnotation.editModal.removeThisCache')}</div> <div>{t('appAnnotation.editModal.removeThisCache')}</div>
</div> </div>
<div>{t('appAnnotation.editModal.createdAt')}&nbsp;{dayjs(createdAt * 1000).format('YYYY-MM-DD hh:mm')}</div> <div>{t('appAnnotation.editModal.createdAt')}&nbsp;{dayjs(createdAt * 1000).format('YYYY-MM-DD HH:mm')}</div>
</div> </div>
) )
: undefined} : undefined}

View File

@ -10,7 +10,6 @@ import {
useState, useState,
} from 'react' } from 'react'
import { useTranslation } from 'react-i18next' import { useTranslation } from 'react-i18next'
import { useThrottleEffect } from 'ahooks'
import { debounce } from 'lodash-es' import { debounce } from 'lodash-es'
import type { import type {
ChatConfig, ChatConfig,
@ -100,10 +99,19 @@ const Chat: FC<ChatProps> = ({
chatFooterInnerRef.current.style.width = `${chatContainerInnerRef.current.clientWidth}px` chatFooterInnerRef.current.style.width = `${chatContainerInnerRef.current.clientWidth}px`
}, []) }, [])
useThrottleEffect(() => { useEffect(() => {
handleScrolltoBottom() handleScrolltoBottom()
handleWindowResize() handleWindowResize()
}, [chatList], { wait: 500 }) }, [handleScrolltoBottom, handleWindowResize])
useEffect(() => {
if (chatContainerRef.current) {
requestAnimationFrame(() => {
handleScrolltoBottom()
handleWindowResize()
})
}
})
useEffect(() => { useEffect(() => {
window.addEventListener('resize', debounce(handleWindowResize)) window.addEventListener('resize', debounce(handleWindowResize))

View File

@ -76,7 +76,9 @@ const NavSelector = ({ curNav, navs, createText, onCreate, onLoadmore }: INavSel
<Indicator /> <Indicator />
</div> </div>
</div> </div>
{nav.name} <div className='truncate'>
{nav.name}
</div>
</div> </div>
</Menu.Item> </Menu.Item>
)) ))

View File

@ -51,7 +51,7 @@
"mermaid": "10.4.0", "mermaid": "10.4.0",
"negotiator": "^0.6.3", "negotiator": "^0.6.3",
"next": "^14.0.4", "next": "^14.0.4",
"next-nprogress-bar": "^2.1.2", "next-nprogress-bar": "^2.3.8",
"qrcode.react": "^3.1.0", "qrcode.react": "^3.1.0",
"qs": "^6.11.1", "qs": "^6.11.1",
"rc-textarea": "^1.5.2", "rc-textarea": "^1.5.2",

View File

@ -5292,10 +5292,10 @@ neo-async@^2.6.2:
resolved "https://registry.npmjs.org/neo-async/-/neo-async-2.6.2.tgz" resolved "https://registry.npmjs.org/neo-async/-/neo-async-2.6.2.tgz"
integrity sha512-Yd3UES5mWCSqR+qNT93S3UoYUkqAZ9lLg8a7g9rimsWmYGK8cVToA4/sF3RrshdyV3sAGMXVUmpMYOw+dLpOuw== integrity sha512-Yd3UES5mWCSqR+qNT93S3UoYUkqAZ9lLg8a7g9rimsWmYGK8cVToA4/sF3RrshdyV3sAGMXVUmpMYOw+dLpOuw==
next-nprogress-bar@^2.1.2: next-nprogress-bar@^2.3.8:
version "2.1.2" version "2.3.9"
resolved "https://registry.npmjs.org/next-nprogress-bar/-/next-nprogress-bar-2.1.2.tgz" resolved "https://registry.yarnpkg.com/next-nprogress-bar/-/next-nprogress-bar-2.3.9.tgz#f271abb7e1f6bc95b024256f8dcec041dd63bcdb"
integrity sha512-2Df5d7fr6uPx+BX8MkoWCfl+RjG+uWI5mA399e5sEe8mbT3q/GIUvCXLzBgJBIISpKuMmdLAOYEzqpjlsRVOWw== integrity sha512-X4nJqpyXcqpXwcSyCzed8hKWnOCqzLaINVHdwokKpuJ76Qj8EGB9mPqwCcFhgXsvIdlzPLAKxq6ajPI9tSYmig==
dependencies: dependencies:
nprogress "^0.2.0" nprogress "^0.2.0"
@ -5369,7 +5369,7 @@ npm-run-path@^5.1.0:
nprogress@^0.2.0: nprogress@^0.2.0:
version "0.2.0" version "0.2.0"
resolved "https://registry.npmjs.org/nprogress/-/nprogress-0.2.0.tgz" resolved "https://registry.yarnpkg.com/nprogress/-/nprogress-0.2.0.tgz#cb8f34c53213d895723fcbab907e9422adbcafb1"
integrity sha512-I19aIingLgR1fmhftnbWWO3dXc0hSxqHQHQb3H8m+K3TnEn/iSeTZZOyvKXWqQESMwuUVnatlCnZdLBZZt2VSA== integrity sha512-I19aIingLgR1fmhftnbWWO3dXc0hSxqHQHQb3H8m+K3TnEn/iSeTZZOyvKXWqQESMwuUVnatlCnZdLBZZt2VSA==
nth-check@^2.0.1: nth-check@^2.0.1: