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 = {
"header": {
"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": {
"chat": {

View File

@ -46,7 +46,7 @@ const DatasetCard = ({
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}>
<AppIcon size='small' className={cn(!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 />
<div>{t('appAnnotation.editModal.removeThisCache')}</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>
)
: undefined

View File

@ -54,7 +54,7 @@ const List: FC<Props> = ({
className='whitespace-nowrap overflow-hidden text-ellipsis max-w-[250px]'
title={item.answer}
>{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 className='w-[96px]' onClick={e => e.stopPropagation()}>
{/* Actions */}

View File

@ -142,7 +142,7 @@ const ViewAnnotationModal: FC<Props> = ({
>{item.response}</td>
<td>{item.source}</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>
))}
</tbody>
@ -214,7 +214,7 @@ const ViewAnnotationModal: FC<Props> = ({
<MessageCheckRemove />
<div>{t('appAnnotation.editModal.removeThisCache')}</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>
)
: undefined}

View File

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

View File

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

View File

@ -51,7 +51,7 @@
"mermaid": "10.4.0",
"negotiator": "^0.6.3",
"next": "^14.0.4",
"next-nprogress-bar": "^2.1.2",
"next-nprogress-bar": "^2.3.8",
"qrcode.react": "^3.1.0",
"qs": "^6.11.1",
"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"
integrity sha512-Yd3UES5mWCSqR+qNT93S3UoYUkqAZ9lLg8a7g9rimsWmYGK8cVToA4/sF3RrshdyV3sAGMXVUmpMYOw+dLpOuw==
next-nprogress-bar@^2.1.2:
version "2.1.2"
resolved "https://registry.npmjs.org/next-nprogress-bar/-/next-nprogress-bar-2.1.2.tgz"
integrity sha512-2Df5d7fr6uPx+BX8MkoWCfl+RjG+uWI5mA399e5sEe8mbT3q/GIUvCXLzBgJBIISpKuMmdLAOYEzqpjlsRVOWw==
next-nprogress-bar@^2.3.8:
version "2.3.9"
resolved "https://registry.yarnpkg.com/next-nprogress-bar/-/next-nprogress-bar-2.3.9.tgz#f271abb7e1f6bc95b024256f8dcec041dd63bcdb"
integrity sha512-X4nJqpyXcqpXwcSyCzed8hKWnOCqzLaINVHdwokKpuJ76Qj8EGB9mPqwCcFhgXsvIdlzPLAKxq6ajPI9tSYmig==
dependencies:
nprogress "^0.2.0"
@ -5369,7 +5369,7 @@ npm-run-path@^5.1.0:
nprogress@^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==
nth-check@^2.0.1: