Fix variable typo (#8084)

This commit is contained in:
Nam Vu
2024-09-08 12:14:11 +07:00
committed by GitHub
parent b1918dae5e
commit 2d7954c7da
215 changed files with 599 additions and 597 deletions

View File

@@ -108,7 +108,7 @@ const AppDetailLayout: FC<IAppDetailLayoutProps> = (props) => {
useEffect(() => {
setAppDetail()
fetchAppDetail({ url: '/apps', id: appId }).then((res) => {
// redirections
// redirection
if ((res.mode === 'workflow' || res.mode === 'advanced-chat') && (pathname).endsWith('configuration')) {
router.replace(`/app/${appId}/workflow`)
}

View File

@@ -21,7 +21,7 @@ import Divider from '@/app/components/base/divider'
import { getRedirection } from '@/utils/app-redirection'
import { useProviderContext } from '@/context/provider-context'
import { NEED_REFRESH_APP_LIST_KEY } from '@/config'
import { AiText, ChatBot, CuteRobote } from '@/app/components/base/icons/src/vender/solid/communication'
import { AiText, ChatBot, CuteRobot } from '@/app/components/base/icons/src/vender/solid/communication'
import { Route } from '@/app/components/base/icons/src/vender/solid/mapsAndTravel'
import type { CreateAppModalProps } from '@/app/components/explore/create-app-modal'
import EditAppModal from '@/app/components/explore/create-app-modal'
@@ -273,7 +273,7 @@ const AppCard = ({ app, onRefresh }: AppCardProps) => {
<ChatBot className='w-3 h-3 text-[#1570EF]' />
)}
{app.mode === 'agent-chat' && (
<CuteRobote className='w-3 h-3 text-indigo-600' />
<CuteRobot className='w-3 h-3 text-indigo-600' />
)}
{app.mode === 'chat' && (
<ChatBot className='w-3 h-3 text-[#1570EF]' />

View File

@@ -35,7 +35,7 @@ import { DataSourceType } from '@/models/datasets'
import useBreakpoints, { MediaType } from '@/hooks/use-breakpoints'
import { LanguagesSupported } from '@/i18n/language'
import { useStore } from '@/app/components/app/store'
import { AiText, ChatBot, CuteRobote } from '@/app/components/base/icons/src/vender/solid/communication'
import { AiText, ChatBot, CuteRobot } from '@/app/components/base/icons/src/vender/solid/communication'
import { Route } from '@/app/components/base/icons/src/vender/solid/mapsAndTravel'
import { getLocaleOnClient } from '@/i18n'
import { useAppContext } from '@/context/app-context'
@@ -67,7 +67,7 @@ const LikedItem = ({
<ChatBot className='w-2.5 h-2.5 text-[#1570EF]' />
)}
{detail.mode === 'agent-chat' && (
<CuteRobote className='w-2.5 h-2.5 text-indigo-600' />
<CuteRobot className='w-2.5 h-2.5 text-indigo-600' />
)}
{detail.mode === 'chat' && (
<ChatBot className='w-2.5 h-2.5 text-[#1570EF]' />

View File

@@ -148,7 +148,7 @@ import { Row, Col, Properties, Property, Heading, SubProperty, Paragraph } from
- original_document_id Source document ID (optional)
- Used to re-upload the document or modify the document cleaning and segmentation configuration. The missing information is copied from the source document
- The source document cannot be an archived document
- When original_document_id is passed in, the update operation is performed on behalf of the document. process_rule is a fillable item. If not filled in, the segmentation method of the source document will be used by defaul
- When original_document_id is passed in, the update operation is performed on behalf of the document. process_rule is a fillable item. If not filled in, the segmentation method of the source document will be used by default
- When original_document_id is not passed in, the new operation is performed on behalf of the document, and process_rule is required
- indexing_technique Index mode

View File

@@ -142,7 +142,7 @@ import { Row, Col, Properties, Property, Heading, SubProperty, Paragraph } from
</Property>
</Properties>
### Request Bodys
### Request Body
<Properties>
<Property name='data' type='multipart/form-data json string' key='data'>
- original_document_id 源文档 ID (选填)

View File

@@ -22,7 +22,7 @@ import { copyApp, deleteApp, exportAppConfig, updateAppInfo } from '@/service/ap
import DuplicateAppModal from '@/app/components/app/duplicate-modal'
import type { DuplicateAppModalProps } from '@/app/components/app/duplicate-modal'
import CreateAppModal from '@/app/components/explore/create-app-modal'
import { AiText, ChatBot, CuteRobote } from '@/app/components/base/icons/src/vender/solid/communication'
import { AiText, ChatBot, CuteRobot } from '@/app/components/base/icons/src/vender/solid/communication'
import { Route } from '@/app/components/base/icons/src/vender/solid/mapsAndTravel'
import type { CreateAppModalProps } from '@/app/components/explore/create-app-modal'
import { NEED_REFRESH_APP_LIST_KEY } from '@/config'
@@ -214,7 +214,7 @@ const AppInfo = ({ expand }: IAppInfoProps) => {
<ChatBot className={cn('w-3 h-3 text-[#1570EF]', !expand && '!w-2.5 !h-2.5')} />
)}
{appDetail.mode === 'agent-chat' && (
<CuteRobote className={cn('w-3 h-3 text-indigo-600', !expand && '!w-2.5 !h-2.5')} />
<CuteRobot className={cn('w-3 h-3 text-indigo-600', !expand && '!w-2.5 !h-2.5')} />
)}
{appDetail.mode === 'chat' && (
<ChatBot className={cn('w-3 h-3 text-[#1570EF]', !expand && '!w-2.5 !h-2.5')} />
@@ -280,7 +280,7 @@ const AppInfo = ({ expand }: IAppInfoProps) => {
<ChatBot className='w-3 h-3 text-[#1570EF]' />
)}
{appDetail.mode === 'agent-chat' && (
<CuteRobote className='w-3 h-3 text-indigo-600' />
<CuteRobot className='w-3 h-3 text-indigo-600' />
)}
{appDetail.mode === 'chat' && (
<ChatBot className='w-3 h-3 text-[#1570EF]' />
@@ -323,7 +323,7 @@ const AppInfo = ({ expand }: IAppInfoProps) => {
</div>
</div>
</div>
{/* desscription */}
{/* description */}
{appDetail.description && (
<div className='px-4 py-2 text-gray-500 text-xs leading-[18px]'>{appDetail.description}</div>
)}

View File

@@ -232,8 +232,8 @@ const Annotation: FC<Props> = ({
middlePagesSiblingCount={1}
setCurrentPage={setCurrPage}
totalPages={Math.ceil(total / APP_PAGE_LIMIT)}
truncableClassName="w-8 px-0.5 text-center"
truncableText="..."
truncatableClassName="w-8 px-0.5 text-center"
truncatableText="..."
>
<Pagination.PrevButton
disabled={currPage === 0}

View File

@@ -156,8 +156,8 @@ const ViewAnnotationModal: FC<Props> = ({
middlePagesSiblingCount={1}
setCurrentPage={setCurrPage}
totalPages={Math.ceil(total / APP_PAGE_LIMIT)}
truncableClassName="w-8 px-0.5 text-center"
truncableText="..."
truncatableClassName="w-8 px-0.5 text-center"
truncatableText="..."
>
<Pagination.PrevButton
disabled={currPage === 0}

View File

@@ -262,7 +262,7 @@ const AdvancedPromptInput: FC<Props> = ({
{isShowConfirmAddVar && (
<ConfirmAddVar
varNameArr={newPromptVariables.map(v => v.name)}
onConfrim={handleAutoAdd(true)}
onConfirm={handleAutoAdd(true)}
onCancel={handleAutoAdd(false)}
onHide={hideConfirmAddVar}
/>

View File

@@ -7,7 +7,7 @@ import Button from '@/app/components/base/button'
export type IConfirmAddVarProps = {
varNameArr: string[]
onConfrim: () => void
onConfirm: () => void
onCancel: () => void
onHide: () => void
}
@@ -22,7 +22,7 @@ const VarIcon = (
const ConfirmAddVar: FC<IConfirmAddVarProps> = ({
varNameArr,
onConfrim,
onConfirm,
onCancel,
// onHide,
}) => {
@@ -63,7 +63,7 @@ const ConfirmAddVar: FC<IConfirmAddVarProps> = ({
</div>
<div className='mt-7 flex justify-end space-x-2'>
<Button onClick={onCancel}>{t('common.operation.cancel')}</Button>
<Button variant='primary' onClick={onConfrim}>{t('common.operation.add')}</Button>
<Button variant='primary' onClick={onConfirm}>{t('common.operation.add')}</Button>
</div>
</div>

View File

@@ -33,7 +33,7 @@ export type ISimplePromptInput = {
promptTemplate: string
promptVariables: PromptVariable[]
readonly?: boolean
onChange?: (promp: string, promptVariables: PromptVariable[]) => void
onChange?: (prompt: string, promptVariables: PromptVariable[]) => void
noTitle?: boolean
gradientBorder?: boolean
editorHeight?: number
@@ -239,7 +239,7 @@ const Prompt: FC<ISimplePromptInput> = ({
{isShowConfirmAddVar && (
<ConfirmAddVar
varNameArr={newPromptVariables.map(v => v.name)}
onConfrim={handleAutoAdd(true)}
onConfirm={handleAutoAdd(true)}
onCancel={handleAutoAdd(false)}
onHide={hideConfirmAddVar}
/>

View File

@@ -5,7 +5,7 @@ import { useTranslation } from 'react-i18next'
import { RiCloseLine } from '@remixicon/react'
import ItemPanel from './item-panel'
import Button from '@/app/components/base/button'
import { CuteRobote } from '@/app/components/base/icons/src/vender/solid/communication'
import { CuteRobot } from '@/app/components/base/icons/src/vender/solid/communication'
import { Unblur } from '@/app/components/base/icons/src/vender/solid/education'
import Slider from '@/app/components/base/slider'
import type { AgentConfig } from '@/models/debug'
@@ -65,7 +65,7 @@ const AgentSetting: FC<Props> = ({
<ItemPanel
className='mb-4'
icon={
<CuteRobote className='w-4 h-4 text-indigo-600' />
<CuteRobot className='w-4 h-4 text-indigo-600' />
}
name={t('appDebug.agent.agentMode')}
description={t('appDebug.agent.agentModeDes')}

View File

@@ -12,7 +12,7 @@ import {
} from '@/app/components/base/portal-to-follow-elem'
import { BubbleText } from '@/app/components/base/icons/src/vender/solid/education'
import Radio from '@/app/components/base/radio/ui'
import { CuteRobote } from '@/app/components/base/icons/src/vender/solid/communication'
import { CuteRobot } from '@/app/components/base/icons/src/vender/solid/communication'
import { Settings04 } from '@/app/components/base/icons/src/vender/line/general'
import { ArrowUpRight } from '@/app/components/base/icons/src/vender/line/arrows'
import type { AgentConfig } from '@/models/debug'
@@ -117,7 +117,7 @@ const AssistantTypePicker: FC<Props> = ({
>
<PortalToFollowElemTrigger onClick={() => setOpen(v => !v)}>
<div className={cn(open && 'bg-gray-50', 'flex items-center h-8 px-3 border border-black/5 rounded-lg cursor-pointer select-none space-x-1 text-indigo-600')}>
{isAgent ? <BubbleText className='w-3 h-3' /> : <CuteRobote className='w-3 h-3' />}
{isAgent ? <BubbleText className='w-3 h-3' /> : <CuteRobot className='w-3 h-3' />}
<div className='text-xs font-medium'>{t(`appDebug.assistantType.${isAgent ? 'agentAssistant' : 'chatAssistant'}.name`)}</div>
<RiArrowDownSLine className='w-3 h-3' />
</div>
@@ -135,7 +135,7 @@ const AssistantTypePicker: FC<Props> = ({
onClick={handleChange}
/>
<SelectItem
Icon={CuteRobote}
Icon={CuteRobot}
value='agent'
disabled={disabled}
text={t('appDebug.assistantType.agentAssistant.name')}

View File

@@ -35,7 +35,7 @@ function useFeature({
moderation: boolean
setModeration: (moderation: boolean) => void
}) {
const [tempshowOpeningStatement, setTempShowOpeningStatement] = React.useState(!!introduction)
const [tempShowOpeningStatement, setTempShowOpeningStatement] = React.useState(!!introduction)
useEffect(() => {
// wait to api data back
if (introduction)
@@ -48,7 +48,7 @@ function useFeature({
// }, [moreLikeThis])
const featureConfig = {
openingStatement: tempshowOpeningStatement,
openingStatement: tempShowOpeningStatement,
moreLikeThis,
suggestedQuestionsAfterAnswer,
speechToText,

View File

@@ -7,9 +7,9 @@ import { useBoolean, useScroll } from 'ahooks'
import { useFormattingChangedDispatcher } from '../debug/hooks'
import DatasetConfig from '../dataset-config'
import ChatGroup from '../features/chat-group'
import ExperienceEnchanceGroup from '../features/experience-enchance-group'
import ExperienceEnhanceGroup from '../features/experience-enhance-group'
import Toolbox from '../toolbox'
import HistoryPanel from '../config-prompt/conversation-histroy/history-panel'
import HistoryPanel from '../config-prompt/conversation-history/history-panel'
import ConfigVision from '../config-vision'
import useAnnotationConfig from '../toolbox/annotation/use-annotation-config'
import AddFeatureBtn from './feature/add-feature-btn'
@@ -254,7 +254,7 @@ const Config: FC = () => {
/>
)}
{/* ChatConifig */}
{/* ChatConfig */}
{
hasChatConfig && (
<ChatGroup
@@ -277,7 +277,7 @@ const Config: FC = () => {
{/* Text Generation config */}{
hasCompletionConfig && (
<ExperienceEnchanceGroup
<ExperienceEnhanceGroup
isShowMoreLike={moreLikeThisConfig.enabled}
isShowTextToSpeech={featureConfig.textToSpeech && !!text2speechDefaultModel}
/>

View File

@@ -70,13 +70,13 @@ const ParamsConfig = ({
const {
defaultModel: rerankDefaultModel,
currentModel: isRerankDefaultModelVaild,
currentModel: isRerankDefaultModelValid,
} = useModelListAndDefaultModelAndCurrentProviderAndModel(ModelTypeEnum.rerank)
const isValid = () => {
let errMsg = ''
if (tempDataSetConfigs.retrieval_model === RETRIEVE_TYPE.multiWay) {
if (!tempDataSetConfigs.reranking_model?.reranking_model_name && (!rerankDefaultModel && isRerankDefaultModelVaild))
if (!tempDataSetConfigs.reranking_model?.reranking_model_name && (!rerankDefaultModel && isRerankDefaultModelValid))
errMsg = t('appDebug.datasetConfig.rerankModelRequired')
}
if (errMsg) {

View File

@@ -135,7 +135,7 @@ const SelectDataSet: FC<ISelectDataSetProps> = ({
</div>
<div className={cn('max-w-[200px] text-[13px] font-medium text-gray-800 overflow-hidden text-ellipsis whitespace-nowrap', !item.embedding_available && 'opacity-50 !max-w-[120px]')}>{item.name}</div>
{!item.embedding_available && (
<span className='ml-1 shrink-0 px-1 border boder-gray-200 rounded-md text-gray-500 text-xs font-normal leading-[18px]'>{t('dataset.unavailable')}</span>
<span className='ml-1 shrink-0 px-1 border border-gray-200 rounded-md text-gray-500 text-xs font-normal leading-[18px]'>{t('dataset.unavailable')}</span>
)}
</div>
{

View File

@@ -51,7 +51,7 @@ const SettingsModal: FC<SettingsModalProps> = ({
const {
modelList: rerankModelList,
defaultModel: rerankDefaultModel,
currentModel: isRerankDefaultModelVaild,
currentModel: isRerankDefaultModelValid,
} = useModelListAndDefaultModelAndCurrentProviderAndModel(ModelTypeEnum.rerank)
const { t } = useTranslation()
const { notify } = useToastContext()
@@ -83,7 +83,7 @@ const SettingsModal: FC<SettingsModalProps> = ({
if (
!isReRankModelSelected({
rerankDefaultModel,
isRerankDefaultModelVaild: !!isRerankDefaultModelVaild,
isRerankDefaultModelValid: !!isRerankDefaultModelValid,
rerankModelList,
retrievalConfig,
indexMethod,

View File

@@ -89,7 +89,7 @@ const ChatItem: FC<ChatItemProps> = ({
`apps/${appId}/chat-messages`,
data,
{
onGetConvesationMessages: (conversationId, getAbortController) => fetchConversationMessages(appId, conversationId, getAbortController),
onGetConversationMessages: (conversationId, getAbortController) => fetchConversationMessages(appId, conversationId, getAbortController),
onGetSuggestedQuestions: (responseItemId, getAbortController) => fetchSuggestedQuestions(appId, responseItemId, getAbortController),
},
)

View File

@@ -94,7 +94,7 @@ const DebugWithSingleModel = forwardRef<DebugWithSingleModelRefType, DebugWithSi
`apps/${appId}/chat-messages`,
data,
{
onGetConvesationMessages: (conversationId, getAbortController) => fetchConversationMessages(appId, conversationId, getAbortController),
onGetConversationMessages: (conversationId, getAbortController) => fetchConversationMessages(appId, conversationId, getAbortController),
onGetSuggestedQuestions: (responseItemId, getAbortController) => fetchSuggestedQuestions(appId, responseItemId, getAbortController),
},
)

View File

@@ -287,7 +287,7 @@ const OpeningStatement: FC<IOpeningStatementProps> = ({
{isShowConfirmAddVar && (
<ConfirmAddVar
varNameArr={notIncludeKeys}
onConfrim={autoAddVar}
onConfirm={autoAddVar}
onCancel={cancelAutoAddVar}
onHide={hideConfirmAddVar}
/>

View File

@@ -16,7 +16,7 @@ type ExperienceGroupProps = {
isShowMoreLike: boolean
}
const ExperienceEnchanceGroup: FC<ExperienceGroupProps> = ({
const ExperienceEnhanceGroup: FC<ExperienceGroupProps> = ({
isShowTextToSpeech,
isShowMoreLike,
}) => {
@@ -40,4 +40,4 @@ const ExperienceEnchanceGroup: FC<ExperienceGroupProps> = ({
</div>
)
}
export default React.memo(ExperienceEnchanceGroup)
export default React.memo(ExperienceEnhanceGroup)

View File

@@ -14,7 +14,7 @@ import Loading from '../../base/loading'
import AppPublisher from '../app-publisher'
import AgentSettingButton from './config/agent-setting-button'
import useAdvancedPromptConfig from './hooks/use-advanced-prompt-config'
import EditHistoryModal from './config-prompt/conversation-histroy/edit-modal'
import EditHistoryModal from './config-prompt/conversation-history/edit-modal'
import {
useDebugWithSingleOrMultipleModel,
useFormattingChangedDispatcher,

View File

@@ -64,7 +64,7 @@ const ModerationSettingModal: FC<ModerationSettingModalProps> = ({
const systemOpenaiProviderQuota = systemOpenaiProviderEnabled ? openaiProvider?.system_configuration.quota_configurations.find(item => item.quota_type === openaiProvider.system_configuration.current_quota_type) : undefined
const systemOpenaiProviderCanUse = systemOpenaiProviderQuota?.is_valid
const customOpenaiProvidersCanUse = openaiProvider?.custom_configuration.status === CustomConfigurationStatusEnum.active
const openaiProviderConfiged = customOpenaiProvidersCanUse || systemOpenaiProviderCanUse
const isOpenAIProviderConfigured = customOpenaiProvidersCanUse || systemOpenaiProviderCanUse
const providers: Provider[] = [
{
key: 'openai_moderation',
@@ -190,7 +190,7 @@ const ModerationSettingModal: FC<ModerationSettingModalProps> = ({
}
const handleSave = () => {
if (localeData.type === 'openai_moderation' && !openaiProviderConfiged)
if (localeData.type === 'openai_moderation' && !isOpenAIProviderConfigured)
return
if (!localeData.config?.inputs_config?.enabled && !localeData.config?.outputs_config?.enabled) {
@@ -254,7 +254,7 @@ const ModerationSettingModal: FC<ModerationSettingModalProps> = ({
className={`
flex items-center px-3 py-2 rounded-lg text-sm text-gray-900 cursor-pointer
${localeData.type === provider.key ? 'bg-white border-[1.5px] border-primary-400 shadow-sm' : 'border border-gray-100 bg-gray-25'}
${localeData.type === 'openai_moderation' && provider.key === 'openai_moderation' && !openaiProviderConfiged && 'opacity-50'}
${localeData.type === 'openai_moderation' && provider.key === 'openai_moderation' && !isOpenAIProviderConfigured && 'opacity-50'}
`}
onClick={() => handleDataTypeChange(provider.key)}
>
@@ -267,7 +267,7 @@ const ModerationSettingModal: FC<ModerationSettingModalProps> = ({
}
</div>
{
!isLoading && !openaiProviderConfiged && localeData.type === 'openai_moderation' && (
!isLoading && !isOpenAIProviderConfigured && localeData.type === 'openai_moderation' && (
<div className='flex items-center mt-2 px-3 py-2 bg-[#FFFAEB] rounded-lg border border-[#FEF0C7]'>
<InfoCircle className='mr-1 w-4 h-4 text-[#F79009]' />
<div className='flex items-center text-xs font-medium text-gray-700'>
@@ -361,7 +361,7 @@ const ModerationSettingModal: FC<ModerationSettingModalProps> = ({
<Button
variant='primary'
onClick={handleSave}
disabled={localeData.type === 'openai_moderation' && !openaiProviderConfiged}
disabled={localeData.type === 'openai_moderation' && !isOpenAIProviderConfigured}
>
{t('common.operation.save')}
</Button>

View File

@@ -172,12 +172,12 @@ const ExternalDataToolModal: FC<ExternalDataToolModalProps> = ({
}
}
const formatedData = formatData(localeData)
const formattedData = formatData(localeData)
if (onValidateBeforeSave && !onValidateBeforeSave(formatedData))
if (onValidateBeforeSave && !onValidateBeforeSave(formattedData))
return
onSave(formatData(formatedData))
onSave(formatData(formattedData))
}
const action = data.type ? t('common.operation.edit') : t('common.operation.add')

View File

@@ -21,7 +21,7 @@ import Modal from '@/app/components/base/modal'
import Button from '@/app/components/base/button'
import AppIcon from '@/app/components/base/app-icon'
import AppsFull from '@/app/components/billing/apps-full-in-dialog'
import { AiText, ChatBot, CuteRobote } from '@/app/components/base/icons/src/vender/solid/communication'
import { AiText, ChatBot, CuteRobot } from '@/app/components/base/icons/src/vender/solid/communication'
import { Route } from '@/app/components/base/icons/src/vender/solid/mapsAndTravel'
import Tooltip from '@/app/components/base/tooltip'
import { NEED_REFRESH_APP_LIST_KEY } from '@/config'
@@ -158,7 +158,7 @@ const CreateAppModal = ({ show, onSuccess, onClose }: CreateAppDialogProps) => {
setShowChatBotType(false)
}}
>
<CuteRobote className='w-6 h-6 text-indigo-600' />
<CuteRobot className='w-6 h-6 text-indigo-600' />
<div className='h-5 text-[13px] font-medium leading-[18px]'>{t('app.types.agent')}</div>
</div>
</Tooltip>

View File

@@ -119,8 +119,8 @@ const Logs: FC<ILogsProps> = ({ appDetail }) => {
middlePagesSiblingCount={1}
setCurrentPage={setCurrPage}
totalPages={Math.ceil(total / APP_PAGE_LIMIT)}
truncableClassName="w-8 px-0.5 text-center"
truncableText="..."
truncatableClassName="w-8 px-0.5 text-center"
truncatableText="..."
>
<Pagination.PrevButton
disabled={currPage === 0}

View File

@@ -19,7 +19,7 @@ import { useTranslation } from 'react-i18next'
import s from './style.module.css'
import VarPanel from './var-panel'
import cn from '@/utils/classnames'
import type { FeedbackFunc, Feedbacktype, IChatItem, SubmitAnnotationFunc } from '@/app/components/base/chat/chat/type'
import type { FeedbackFunc, FeedbackType, IChatItem, SubmitAnnotationFunc } from '@/app/components/base/chat/chat/type'
import type { Annotation, ChatConversationFullDetailResponse, ChatConversationGeneralDetail, ChatConversationsResponse, ChatMessage, ChatMessagesRequest, CompletionConversationFullDetailResponse, CompletionConversationGeneralDetail, CompletionConversationsResponse, LogAnnotation } from '@/models/log'
import type { App } from '@/types/app'
import Loading from '@/app/components/base/loading'
@@ -541,7 +541,7 @@ const CompletionConversationDetailComp: FC<{ appId?: string; conversationId?: st
const { notify } = useContext(ToastContext)
const { t } = useTranslation()
const handleFeedback = async (mid: string, { rating }: Feedbacktype): Promise<boolean> => {
const handleFeedback = async (mid: string, { rating }: FeedbackType): Promise<boolean> => {
try {
await updateLogMessageFeedbacks({ url: `/apps/${appId}/feedbacks`, body: { message_id: mid, rating } })
conversationDetailMutate()
@@ -586,7 +586,7 @@ const ChatConversationDetailComp: FC<{ appId?: string; conversationId?: string }
const { notify } = useContext(ToastContext)
const { t } = useTranslation()
const handleFeedback = async (mid: string, { rating }: Feedbacktype): Promise<boolean> => {
const handleFeedback = async (mid: string, { rating }: FeedbackType): Promise<boolean> => {
try {
await updateLogMessageFeedbacks({ url: `/apps/${appId}/feedbacks`, body: { message_id: mid, rating } })
notify({ type: 'success', message: t('common.actionMsg.modifiedSuccessfully') })

View File

@@ -16,13 +16,13 @@ import { Markdown } from '@/app/components/base/markdown'
import Loading from '@/app/components/base/loading'
import Toast from '@/app/components/base/toast'
import AudioBtn from '@/app/components/base/audio-btn'
import type { Feedbacktype } from '@/app/components/base/chat/chat/type'
import type { FeedbackType } from '@/app/components/base/chat/chat/type'
import { fetchMoreLikeThis, updateFeedback } from '@/service/share'
import { File02 } from '@/app/components/base/icons/src/vender/line/files'
import { Bookmark } from '@/app/components/base/icons/src/vender/line/general'
import { Stars02 } from '@/app/components/base/icons/src/vender/line/weather'
import { RefreshCcw01 } from '@/app/components/base/icons/src/vender/line/arrows'
import { fetchTextGenerationMessge } from '@/service/debug'
import { fetchTextGenerationMessage } from '@/service/debug'
import AnnotationCtrlBtn from '@/app/components/app/configuration/toolbox/annotation/annotation-ctrl-btn'
import EditReplyModal from '@/app/components/app/annotation/edit-annotation-modal'
import { useStore as useAppStore } from '@/app/components/app/store'
@@ -47,8 +47,8 @@ export type IGenerationItemProps = {
isInWebApp?: boolean
moreLikeThis?: boolean
depth?: number
feedback?: Feedbacktype
onFeedback?: (feedback: Feedbacktype) => void
feedback?: FeedbackType
onFeedback?: (feedback: FeedbackType) => void
onSave?: (messageId: string) => void
isMobile?: boolean
isInstalledApp: boolean
@@ -125,7 +125,7 @@ const GenerationItem: FC<IGenerationItemProps> = ({
const [completionRes, setCompletionRes] = useState('')
const [childMessageId, setChildMessageId] = useState<string | null>(null)
const hasChild = !!childMessageId
const [childFeedback, setChildFeedback] = useState<Feedbacktype>({
const [childFeedback, setChildFeedback] = useState<FeedbackType>({
rating: null,
})
const {
@@ -135,7 +135,7 @@ const GenerationItem: FC<IGenerationItemProps> = ({
const setCurrentLogItem = useAppStore(s => s.setCurrentLogItem)
const setShowPromptLogModal = useAppStore(s => s.setShowPromptLogModal)
const handleFeedback = async (childFeedback: Feedbacktype) => {
const handleFeedback = async (childFeedback: FeedbackType) => {
await updateFeedback({ url: `/messages/${childMessageId}/feedbacks`, body: { rating: childFeedback.rating } }, isInstalledApp, installedAppId)
setChildFeedback(childFeedback)
}
@@ -205,7 +205,7 @@ const GenerationItem: FC<IGenerationItemProps> = ({
}, [isLoading])
const handleOpenLogModal = async () => {
const data = await fetchTextGenerationMessge({
const data = await fetchTextGenerationMessage({
appId: params.appId as string,
messageId: messageId!,
})

View File

@@ -9,7 +9,7 @@ import {
} from '@/app/components/base/portal-to-follow-elem'
import { Check, DotsGrid } from '@/app/components/base/icons/src/vender/line/general'
import { XCircle } from '@/app/components/base/icons/src/vender/solid/general'
import { ChatBot, CuteRobote } from '@/app/components/base/icons/src/vender/solid/communication'
import { ChatBot, CuteRobot } from '@/app/components/base/icons/src/vender/solid/communication'
import { Route } from '@/app/components/base/icons/src/vender/solid/mapsAndTravel'
export type AppSelectorProps = {
value: string
@@ -65,7 +65,7 @@ const AppTypeSelector = ({ value, onChange }: AppSelectorProps) => {
{value === 'agent' && (
<>
<div className='w-4 h-4 p-[1px]'>
<CuteRobote className='w-3.5 h-3.5 text-indigo-600' />
<CuteRobot className='w-3.5 h-3.5 text-indigo-600' />
</div>
<div className=''>{t('app.typeSelector.agent')}</div>
<div className='w-4 h-4 p-[1px]' onClick={(e) => {
@@ -106,7 +106,7 @@ const AppTypeSelector = ({ value, onChange }: AppSelectorProps) => {
onChange('agent')
setOpen(false)
}}>
<CuteRobote className='mr-2 w-4 h-4 text-indigo-600' />
<CuteRobot className='mr-2 w-4 h-4 text-indigo-600' />
<div className='grow text-gray-700 text-[13px] font-medium leading-[18px]'>{t('app.typeSelector.agent')}</div>
{value === 'agent' && <Check className='w-4 h-4 text-primary-600' />}
</div>

View File

@@ -93,8 +93,8 @@ const Logs: FC<ILogsProps> = ({ appDetail }) => {
middlePagesSiblingCount={1}
setCurrentPage={setCurrPage}
totalPages={Math.ceil(total / APP_PAGE_LIMIT)}
truncableClassName="w-8 px-0.5 text-center"
truncableText="..."
truncatableClassName="w-8 px-0.5 text-center"
truncatableText="..."
>
<Pagination.PrevButton
disabled={currPage === 0}

View File

@@ -97,7 +97,7 @@ const AgentLogDetail: FC<AgentLogDetailProps> = ({
onClick={() => switchTab('TRACING')}
>{t('runLog.tracing')}</div>
</div>
{/* panel detal */}
{/* panel detail */}
<div className={cn('grow bg-white h-0 overflow-y-auto rounded-b-2xl', currentTab !== 'DETAIL' && '!bg-gray-50')}>
{loading && (
<div className='flex h-full items-center justify-center bg-white'>

View File

@@ -53,7 +53,7 @@ const BlockInput: FC<IBlockInputProps> = ({
const [isEditing, setIsEditing] = useState<boolean>(false)
useEffect(() => {
if (isEditing && contentEditableRef.current) {
// TODO: Focus at the click positon
// TODO: Focus at the click position
if (currentValue)
contentEditableRef.current.setSelectionRange(currentValue.length, currentValue.length)
@@ -119,7 +119,7 @@ const BlockInput: FC<IBlockInputProps> = ({
onBlur={() => {
blur()
setIsEditing(false)
// click confirm also make blur. Then outter value is change. So below code has problem.
// click confirm also make blur. Then outer value is change. So below code has problem.
// setTimeout(() => {
// handleCancel()
// }, 1000)

View File

@@ -217,12 +217,12 @@ export const useChatWithHistory = (installedAppInfo?: InstalledApp) => {
}, [newConversation])
const currentConversationItem = useMemo(() => {
let coversationItem = conversationList.find(item => item.id === currentConversationId)
let conversationItem = conversationList.find(item => item.id === currentConversationId)
if (!coversationItem && pinnedConversationList.length)
coversationItem = pinnedConversationList.find(item => item.id === currentConversationId)
if (!conversationItem && pinnedConversationList.length)
conversationItem = pinnedConversationList.find(item => item.id === currentConversationId)
return coversationItem
return conversationItem
}, [conversationList, currentConversationId, pinnedConversationList])
const { notify } = useToastContext()

View File

@@ -24,7 +24,7 @@ const Citation: FC<CitationProps> = ({
}) => {
const { t } = useTranslation()
const elesRef = useRef<HTMLDivElement[]>([])
const [limitNumberInOneLine, setlimitNumberInOneLine] = useState(0)
const [limitNumberInOneLine, setLimitNumberInOneLine] = useState(0)
const [showMore, setShowMore] = useState(false)
const resources = useMemo(() => data.reduce((prev: Resources[], next) => {
const documentId = next.document_id
@@ -57,14 +57,14 @@ const Citation: FC<CitationProps> = ({
totalWidth -= elesRef.current[i].clientWidth
if (totalWidth + 34 > containerWidth!)
setlimitNumberInOneLine(i - 1)
setLimitNumberInOneLine(i - 1)
else
setlimitNumberInOneLine(i)
setLimitNumberInOneLine(i)
break
}
else {
setlimitNumberInOneLine(i + 1)
setLimitNumberInOneLine(i + 1)
}
}
}

View File

@@ -26,7 +26,7 @@ import { AudioPlayerManager } from '@/app/components/base/audio-btn/audio.player
type GetAbortController = (abortController: AbortController) => void
type SendCallback = {
onGetConvesationMessages?: (conversationId: string, getAbortController: GetAbortController) => Promise<any>
onGetConversationMessages?: (conversationId: string, getAbortController: GetAbortController) => Promise<any>
onGetSuggestedQuestions?: (responseItemId: string, getAbortController: GetAbortController) => Promise<any>
onConversationComplete?: (conversationId: string) => void
isPublicAPI?: boolean
@@ -198,7 +198,7 @@ export const useChat = (
url: string,
data: any,
{
onGetConvesationMessages,
onGetConversationMessages,
onGetSuggestedQuestions,
onConversationComplete,
isPublicAPI,
@@ -324,8 +324,8 @@ export const useChat = (
if (onConversationComplete)
onConversationComplete(conversationId.current)
if (conversationId.current && !hasStopResponded.current && onGetConvesationMessages) {
const { data }: any = await onGetConvesationMessages(
if (conversationId.current && !hasStopResponded.current && onGetConversationMessages) {
const { data }: any = await onGetConversationMessages(
conversationId.current,
newAbortController => conversationMessagesAbortControllerRef.current = newAbortController,
)

View File

@@ -106,7 +106,7 @@ const Chat: FC<ChatProps> = ({
const chatFooterInnerRef = useRef<HTMLDivElement>(null)
const userScrolledRef = useRef(false)
const handleScrolltoBottom = useCallback(() => {
const handleScrollToBottom = useCallback(() => {
if (chatContainerRef.current && !userScrolledRef.current)
chatContainerRef.current.scrollTop = chatContainerRef.current.scrollHeight
}, [])
@@ -123,14 +123,14 @@ const Chat: FC<ChatProps> = ({
}, [])
useEffect(() => {
handleScrolltoBottom()
handleScrollToBottom()
handleWindowResize()
}, [handleScrolltoBottom, handleWindowResize])
}, [handleScrollToBottom, handleWindowResize])
useEffect(() => {
if (chatContainerRef.current) {
requestAnimationFrame(() => {
handleScrolltoBottom()
handleScrollToBottom()
handleWindowResize()
})
}
@@ -148,7 +148,7 @@ const Chat: FC<ChatProps> = ({
const { blockSize } = entry.borderBoxSize[0]
chatContainerRef.current!.style.paddingBottom = `${blockSize}px`
handleScrolltoBottom()
handleScrollToBottom()
}
})
@@ -158,7 +158,7 @@ const Chat: FC<ChatProps> = ({
resizeObserver.disconnect()
}
}
}, [handleScrolltoBottom])
}, [handleScrollToBottom])
useEffect(() => {
const chatContainer = chatContainerRef.current

View File

@@ -3,15 +3,15 @@ import type { FC } from 'react'
import React from 'react'
import s from './style.module.css'
export type ILoaidingAnimProps = {
export type ILoadingAnimProps = {
type: 'text' | 'avatar'
}
const LoaidingAnim: FC<ILoaidingAnimProps> = ({
const LoadingAnim: FC<ILoadingAnimProps> = ({
type,
}) => {
return (
<div className={`${s['dot-flashing']} ${s[type]}`}></div>
)
}
export default React.memo(LoaidingAnim)
export default React.memo(LoadingAnim)

View File

@@ -8,14 +8,14 @@ export type MessageMore = {
latency: number | string
}
export type Feedbacktype = {
export type FeedbackType = {
rating: MessageRating
content?: string | null
}
export type FeedbackFunc = (
messageId: string,
feedback: Feedbacktype
feedback: FeedbackType
) => Promise<any>
export type SubmitAnnotationFunc = (
messageId: string,
@@ -71,11 +71,11 @@ export type IChatItem = {
/**
* The user feedback result of this message
*/
feedback?: Feedbacktype
feedback?: FeedbackType
/**
* The admin feedback result of this message
*/
adminFeedback?: Feedbacktype
adminFeedback?: FeedbackType
/**
* Whether to hide the feedback area
*/

View File

@@ -14,7 +14,7 @@ import {
getUrl,
stopChatMessageResponding,
} from '@/service/share'
import LogoAvatar from '@/app/components/base/logo/logo-embeded-chat-avatar'
import LogoAvatar from '@/app/components/base/logo/logo-embedded-chat-avatar'
import AnswerIcon from '@/app/components/base/answer-icon'
const ChatWrapper = () => {

View File

@@ -17,7 +17,7 @@ import { checkOrSetAccessToken } from '@/app/components/share/utils'
import AppUnavailable from '@/app/components/base/app-unavailable'
import useBreakpoints, { MediaType } from '@/hooks/use-breakpoints'
import Loading from '@/app/components/base/loading'
import LogoHeader from '@/app/components/base/logo/logo-embeded-chat-header'
import LogoHeader from '@/app/components/base/logo/logo-embedded-chat-header'
import Header from '@/app/components/base/chat/embedded-chatbot/header'
import ConfigPanel from '@/app/components/base/chat/embedded-chatbot/config-panel'
import ChatWrapper from '@/app/components/base/chat/embedded-chatbot/chat-wrapper'

View File

@@ -22,7 +22,7 @@ export type UserInputForm = {
}
export type UserInputFormTextInput = {
'text-inpput': UserInputForm & {
'text-input': UserInputForm & {
max_length: number
}
}

View File

@@ -67,7 +67,7 @@ const ModerationSettingModal: FC<ModerationSettingModalProps> = ({
const systemOpenaiProviderQuota = systemOpenaiProviderEnabled ? openaiProvider?.system_configuration.quota_configurations.find(item => item.quota_type === openaiProvider.system_configuration.current_quota_type) : undefined
const systemOpenaiProviderCanUse = systemOpenaiProviderQuota?.is_valid
const customOpenaiProvidersCanUse = openaiProvider?.custom_configuration.status === CustomConfigurationStatusEnum.active
const openaiProviderConfiged = customOpenaiProvidersCanUse || systemOpenaiProviderCanUse
const isOpenAIProviderConfigured = customOpenaiProvidersCanUse || systemOpenaiProviderCanUse
const providers: Provider[] = [
{
key: 'openai_moderation',
@@ -193,7 +193,7 @@ const ModerationSettingModal: FC<ModerationSettingModalProps> = ({
}
const handleSave = () => {
if (localeData.type === 'openai_moderation' && !openaiProviderConfiged)
if (localeData.type === 'openai_moderation' && !isOpenAIProviderConfigured)
return
if (!localeData.config?.inputs_config?.enabled && !localeData.config?.outputs_config?.enabled) {
@@ -257,7 +257,7 @@ const ModerationSettingModal: FC<ModerationSettingModalProps> = ({
className={`
flex items-center px-3 py-2 rounded-lg text-sm text-gray-900 cursor-pointer
${localeData.type === provider.key ? 'bg-white border-[1.5px] border-primary-400 shadow-sm' : 'border border-gray-100 bg-gray-25'}
${localeData.type === 'openai_moderation' && provider.key === 'openai_moderation' && !openaiProviderConfiged && 'opacity-50'}
${localeData.type === 'openai_moderation' && provider.key === 'openai_moderation' && !isOpenAIProviderConfigured && 'opacity-50'}
`}
onClick={() => handleDataTypeChange(provider.key)}
>
@@ -270,7 +270,7 @@ const ModerationSettingModal: FC<ModerationSettingModalProps> = ({
}
</div>
{
!isLoading && !openaiProviderConfiged && localeData.type === 'openai_moderation' && (
!isLoading && !isOpenAIProviderConfigured && localeData.type === 'openai_moderation' && (
<div className='flex items-center mt-2 px-3 py-2 bg-[#FFFAEB] rounded-lg border border-[#FEF0C7]'>
<InfoCircle className='mr-1 w-4 h-4 text-[#F79009]' />
<div className='flex items-center text-xs font-medium text-gray-700'>
@@ -364,7 +364,7 @@ const ModerationSettingModal: FC<ModerationSettingModalProps> = ({
<Button
variant='primary'
onClick={handleSave}
disabled={localeData.type === 'openai_moderation' && !openaiProviderConfiged}
disabled={localeData.type === 'openai_moderation' && !isOpenAIProviderConfigured}
>
{t('common.operation.save')}
</Button>

View File

@@ -308,7 +308,7 @@ const OpeningStatement: FC<OpeningStatementProps> = ({
{isShowConfirmAddVar && (
<ConfirmAddVar
varNameArr={notIncludeKeys}
onConfrim={autoAddVar}
onConfirm={autoAddVar}
onCancel={cancelAutoAddVar}
onHide={hideConfirmAddVar}
/>

View File

@@ -8,7 +8,7 @@ import {
Md,
Pdf,
Txt,
Unknow,
Unknown,
Xlsx,
} from '@/app/components/base/icons/src/public/files'
import { Notion } from '@/app/components/base/icons/src/public/common'
@@ -47,7 +47,7 @@ const FileIcon: FC<FileIconProps> = ({
case 'notion':
return <Notion className={className} />
default:
return <Unknow className={className} />
return <Unknown className={className} />
}
}

View File

@@ -1,5 +1,5 @@
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
<g id="cute-robote">
<g id="cute-robot">
<path id="Icon" fill-rule="evenodd" clip-rule="evenodd" d="M12 1C12.5523 1 13 1.44772 13 2V3H17C18.6569 3 20 4.34315 20 6V11C20 11.8885 19.6138 12.6868 19 13.2361V14.5858L20.7071 16.2929C21.0976 16.6834 21.0976 17.3166 20.7071 17.7071C20.3166 18.0976 19.6834 18.0976 19.2929 17.7071L18.681 17.0952C17.7905 19.9377 15.1361 22 12 22C8.8639 22 6.20948 19.9377 5.31897 17.0952L4.70711 17.7071C4.31658 18.0976 3.68342 18.0976 3.29289 17.7071C2.90237 17.3166 2.90237 16.6834 3.29289 16.2929L5 14.5858V13.2361C4.38625 12.6868 4 11.8885 4 11V6C4 4.34315 5.34315 3 7 3H11V2C11 1.44772 11.4477 1 12 1ZM7 5C6.44772 5 6 5.44772 6 6V11C6 11.5523 6.44772 12 7 12H17C17.5523 12 18 11.5523 18 11V6C18 5.44772 17.5523 5 17 5H7ZM9 7C9.55228 7 10 7.44772 10 8V9C10 9.55228 9.55228 10 9 10C8.44772 10 8 9.55228 8 9V8C8 7.44772 8.44772 7 9 7ZM15 7C15.5523 7 16 7.44772 16 8V9C16 9.55228 15.5523 10 15 10C14.4477 10 14 9.55228 14 9V8C14 7.44772 14.4477 7 15 7Z" fill="black"/>
</g>
</svg>

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

View File

@@ -2,7 +2,7 @@
// DON NOT EDIT IT MANUALLY
import * as React from 'react'
import data from './Unknow.json'
import data from './Unknown.json'
import IconBase from '@/app/components/base/icons/IconBase'
import type { IconBaseProps, IconData } from '@/app/components/base/icons/IconBase'
@@ -11,6 +11,6 @@ const Icon = React.forwardRef<React.MutableRefObject<SVGElement>, Omit<IconBaseP
ref,
) => <IconBase {...props} ref={ref} data={data as IconData} />)
Icon.displayName = 'Unknow'
Icon.displayName = 'Unknown'
export default Icon

View File

@@ -6,6 +6,6 @@ export { default as Json } from './Json'
export { default as Md } from './Md'
export { default as Pdf } from './Pdf'
export { default as Txt } from './Txt'
export { default as Unknow } from './Unknow'
export { default as Unknown } from './Unknown'
export { default as Xlsx } from './Xlsx'
export { default as Yaml } from './Yaml'

View File

@@ -15,7 +15,7 @@
"type": "element",
"name": "g",
"attributes": {
"id": "cute-robote"
"id": "cute-robot"
},
"children": [
{
@@ -34,5 +34,5 @@
}
]
},
"name": "CuteRobote"
"name": "CuteRobot"
}

View File

@@ -2,7 +2,7 @@
// DON NOT EDIT IT MANUALLY
import * as React from 'react'
import data from './CuteRobote.json'
import data from './CuteRobot.json'
import IconBase from '@/app/components/base/icons/IconBase'
import type { IconBaseProps, IconData } from '@/app/components/base/icons/IconBase'
@@ -11,6 +11,6 @@ const Icon = React.forwardRef<React.MutableRefObject<SVGElement>, Omit<IconBaseP
ref,
) => <IconBase {...props} ref={ref} data={data as IconData} />)
Icon.displayName = 'CuteRobote'
Icon.displayName = 'CuteRobot'
export default Icon

View File

@@ -1,6 +1,6 @@
export { default as AiText } from './AiText'
export { default as ChatBot } from './ChatBot'
export { default as CuteRobote } from './CuteRobote'
export { default as CuteRobot } from './CuteRobot'
export { default as EditList } from './EditList'
export { default as MessageDotsCircle } from './MessageDotsCircle'
export { default as MessageFast } from './MessageFast'

View File

@@ -199,7 +199,7 @@ export const useClipboardUploader = ({ visionConfig, onUpload, files }: useClipb
const handleClipboardPaste = useCallback((e: ClipboardEvent<HTMLTextAreaElement>) => {
// reserve native text copy behavior
const file = e.clipboardData?.files[0]
// when copyed file, prevent default action
// when copied file, prevent default action
if (file) {
e.preventDefault()
handleLocalFileUpload(file)

View File

@@ -0,0 +1,18 @@
import type { FC } from 'react'
type LogoEmbeddedChatAvatarProps = {
className?: string
}
const LogoEmbeddedChatAvatar: FC<LogoEmbeddedChatAvatarProps> = ({
className,
}) => {
return (
<img
src='/logo/logo-embedded-chat-avatar.png'
className={`block w-10 h-10 ${className}`}
alt='logo'
/>
)
}
export default LogoEmbeddedChatAvatar

View File

@@ -0,0 +1,19 @@
import type { FC } from 'react'
type LogoEmbeddedChatHeaderProps = {
className?: string
}
const LogoEmbeddedChatHeader: FC<LogoEmbeddedChatHeaderProps> = ({
className,
}) => {
return (
<img
src='/logo/logo-embedded-chat-header.png'
className={`block w-auto h-6 ${className}`}
alt='logo'
/>
)
}
export default LogoEmbeddedChatHeader

View File

@@ -1,18 +0,0 @@
import type { FC } from 'react'
type LogoEmbededChatAvatarProps = {
className?: string
}
const LogoEmbededChatAvatar: FC<LogoEmbededChatAvatarProps> = ({
className,
}) => {
return (
<img
src='/logo/logo-embeded-chat-avatar.png'
className={`block w-10 h-10 ${className}`}
alt='logo'
/>
)
}
export default LogoEmbededChatAvatar

View File

@@ -1,18 +0,0 @@
import type { FC } from 'react'
type LogoEmbededChatHeaderProps = {
className?: string
}
const LogoEmbededChatHeader: FC<LogoEmbededChatHeaderProps> = ({
className,
}) => {
return (
<img
src='/logo/logo-embeded-chat-header.png'
className={`block w-auto h-6 ${className}`}
alt='logo'
/>
)
}
export default LogoEmbededChatHeader

View File

@@ -72,7 +72,7 @@ const NotionPageSelector = ({
const handleSelectWorkspace = useCallback((workspaceId: string) => {
setCurrentWorkspaceId(workspaceId)
}, [])
const handleSelecPages = (newSelectedPagesId: Set<string>) => {
const handleSelectPages = (newSelectedPagesId: Set<string>) => {
const selectedPages = Array.from(newSelectedPagesId).map(pageId => getPagesMapAndSelectedPagesId[0][pageId])
setSelectedPagesId(new Set(Array.from(newSelectedPagesId)))
@@ -117,7 +117,7 @@ const NotionPageSelector = ({
searchValue={searchValue}
list={currentWorkspace?.pages || []}
pagesMap={getPagesMapAndSelectedPagesId[0]}
onSelect={handleSelecPages}
onSelect={handleSelectPages}
canPreview={canPreview}
previewPageId={previewPageId}
onPreview={handlePreviewPage}

View File

@@ -22,13 +22,13 @@ type PageSelectorProps = {
type NotionPageTreeItem = {
children: Set<string>
descendants: Set<string>
deepth: number
depth: number
ancestors: string[]
} & DataSourceNotionPage
type NotionPageTreeMap = Record<string, NotionPageTreeItem>
type NotionPageItem = {
expand: boolean
deepth: number
depth: number
} & DataSourceNotionPage
const recursivePushInParentDescendants = (
@@ -51,7 +51,7 @@ const recursivePushInParentDescendants = (
...pagesMap[parentId],
children,
descendants,
deepth: 0,
depth: 0,
ancestors: [],
}
}
@@ -60,7 +60,7 @@ const recursivePushInParentDescendants = (
listTreeMap[parentId].descendants.add(pageId)
listTreeMap[parentId].descendants.add(leafItem.page_id)
}
leafItem.deepth++
leafItem.depth++
leafItem.ancestors.unshift(listTreeMap[parentId].page_name)
if (listTreeMap[parentId].parent_id !== 'root')
@@ -95,7 +95,7 @@ const ItemComponent = ({ index, style, data }: ListChildComponentProps<{
return (
<div
className={cn(s.arrow, current.expand && s['arrow-expand'], 'shrink-0 mr-1 w-5 h-5 hover:bg-gray-200 rounded-md')}
style={{ marginLeft: current.deepth * 8 }}
style={{ marginLeft: current.depth * 8 }}
onClick={() => handleToggle(index)}
/>
)
@@ -106,7 +106,7 @@ const ItemComponent = ({ index, style, data }: ListChildComponentProps<{
)
}
return (
<div className='shrink-0 mr-1 w-5 h-5' style={{ marginLeft: current.deepth * 8 }} />
<div className='shrink-0 mr-1 w-5 h-5' style={{ marginLeft: current.depth * 8 }} />
)
}
@@ -185,7 +185,7 @@ const PageSelector = ({
return {
...item,
expand: false,
deepth: 0,
depth: 0,
}
}))
}
@@ -195,7 +195,7 @@ const PageSelector = ({
return {
...item,
expand: false,
deepth: 0,
depth: 0,
}
})
const currentDataList = searchValue ? searchDataList : dataList
@@ -205,7 +205,7 @@ const PageSelector = ({
return list.reduce((prev: NotionPageTreeMap, next: DataSourceNotionPage) => {
const pageId = next.page_id
if (!prev[pageId])
prev[pageId] = { ...next, children: new Set(), descendants: new Set(), deepth: 0, ancestors: [] }
prev[pageId] = { ...next, children: new Set(), descendants: new Set(), depth: 0, ancestors: [] }
recursivePushInParentDescendants(pagesMap, prev, prev[pageId], prev[pageId])
return prev
@@ -233,7 +233,7 @@ const PageSelector = ({
...childrenIds.map(item => ({
...pagesMap[item],
expand: false,
deepth: listMapWithChildrenAndDescendants[item].deepth,
depth: listMapWithChildrenAndDescendants[item].depth,
})),
...dataList.slice(index + 1)]
}

View File

@@ -23,8 +23,8 @@ const CustomizedPagination: FC<Props> = ({ current, onChange, total, limit = 10
middlePagesSiblingCount={1}
setCurrentPage={onChange}
totalPages={totalPages}
truncableClassName="w-8 px-0.5 text-center"
truncableText="..."
truncatableClassName="w-8 px-0.5 text-center"
truncatableText="..."
>
<Pagination.PrevButton
disabled={current === 0}

View File

@@ -35,8 +35,8 @@ import { DELETE_QUERY_BLOCK_COMMAND } from './plugins/query-block'
import type { CustomTextNode } from './plugins/custom-text/node'
import { registerLexicalTextEntity } from './utils'
export type UseSelectOrDeleteHanlder = (nodeKey: string, command?: LexicalCommand<undefined>) => [RefObject<HTMLDivElement>, boolean]
export const useSelectOrDelete: UseSelectOrDeleteHanlder = (nodeKey: string, command?: LexicalCommand<undefined>) => {
export type UseSelectOrDeleteHandler = (nodeKey: string, command?: LexicalCommand<undefined>) => [RefObject<HTMLDivElement>, boolean]
export const useSelectOrDelete: UseSelectOrDeleteHandler = (nodeKey: string, command?: LexicalCommand<undefined>) => {
const ref = useRef<HTMLDivElement>(null)
const [editor] = useLexicalComposerContext()
const [isSelected, setSelected, clearSelection] = useLexicalNodeSelection(nodeKey)

View File

@@ -25,9 +25,9 @@ const SearchInput: FC<SearchInputProps> = ({
return (
<div className={cn(
'group flex items-center px-2 h-8 rounded-lg bg-gray-200 hover:bg-gray-300 border border-transparent overflow-hidden',
focus && '!bg-white hover:bg-white shawdow-xs !border-gray-300',
!focus && value && 'hover:!bg-gray-200 hover:!shawdow-xs hover:!border-black/5',
white && '!bg-white hover:!bg-white shawdow-xs !border-gray-300 hover:!border-gray-300',
focus && '!bg-white hover:bg-white shadow-xs !border-gray-300',
!focus && value && 'hover:!bg-gray-200 hover:!shadow-xs hover:!border-black/5',
white && '!bg-white hover:!bg-white shadow-xs !border-gray-300 hover:!border-gray-300',
className,
)}>
<div className="pointer-events-none shrink-0 flex items-center mr-1.5 justify-center w-4 h-4">

View File

@@ -77,7 +77,7 @@ export function InputSelect({
<div className="w-full">
<Menu as="div" className="w-full">
<div>
<Menu.Button className="iappearance-none block w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm placeholder-gray-400 sm:text-sm h-[38px] text-left">
<Menu.Button className="appearance-none block w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm placeholder-gray-400 sm:text-sm h-[38px] text-left">
{item?.name}
</Menu.Button>
</div>

View File

@@ -32,7 +32,7 @@ const Slider: React.FC<ISliderProps> = ({
max={max || 100}
step={step || 1}
className={cn('relative slider', className)}
thumbClassName={cn('absolute top-[-9px] w-2 h-5 border-[0.5px] border-components-silder-knob-border rounded-[3px] bg-components-silder-knob shadow-sm focus:outline-none', !disabled && 'cursor-pointer', thumbClassName)}
thumbClassName={cn('absolute top-[-9px] w-2 h-5 border-[0.5px] border-components-slider-knob-border rounded-[3px] bg-components-slider-knob shadow-sm focus:outline-none', !disabled && 'cursor-pointer', thumbClassName)}
trackClassName={cn('h-0.5 rounded-full slider-track', trackClassName)}
onChange={onChange}
/>

View File

@@ -3,9 +3,9 @@
}
.slider-track {
background-color: var(--color-components-silder-range);
background-color: var(--color-components-slider-range);
}
.slider-track-1 {
background-color: var(--color-components-silder-track);
background-color: var(--color-components-slider-track);
}

View File

@@ -46,16 +46,16 @@ const TagInput: FC<TagInputProps> = ({
if (isSpecialMode)
e.preventDefault()
const valueTrimed = value.trim()
if (!valueTrimed || (items.find(item => item === valueTrimed)))
const valueTrimmed = value.trim()
if (!valueTrimmed || (items.find(item => item === valueTrimmed)))
return
if (valueTrimed.length > 20) {
if (valueTrimmed.length > 20) {
notify({ type: 'error', message: t('datasetDocuments.segment.keywordError') })
return
}
onChange([...items, valueTrimed])
onChange([...items, valueTrimmed])
setTimeout(() => {
setValue('')
})

View File

@@ -15,7 +15,7 @@ export type UserInputForm = {
}
export type UserInputFormTextInput = {
'text-inpput': UserInputForm & {
'text-input': UserInputForm & {
max_length: number
}
}

View File

@@ -43,10 +43,10 @@ Object.defineProperty(globalThis, 'sessionStorage', {
value: sessionStorage,
})
const BrowerInitor = ({
const BrowserInitor = ({
children,
}: { children: React.ReactElement }) => {
return children
}
export default BrowerInitor
export default BrowserInitor

View File

@@ -7,13 +7,13 @@ import { RerankingModeEnum } from '@/models/datasets'
export const isReRankModelSelected = ({
rerankDefaultModel,
isRerankDefaultModelVaild,
isRerankDefaultModelValid,
retrievalConfig,
rerankModelList,
indexMethod,
}: {
rerankDefaultModel?: DefaultModelResponse
isRerankDefaultModelVaild: boolean
isRerankDefaultModelValid: boolean
retrievalConfig: RetrievalConfig
rerankModelList: Model[]
indexMethod?: string
@@ -25,7 +25,7 @@ export const isReRankModelSelected = ({
return provider?.models.find(({ model }) => model === retrievalConfig.reranking_model?.reranking_model_name)
}
if (isRerankDefaultModelVaild)
if (isRerankDefaultModelValid)
return !!rerankDefaultModel
return false

View File

Before

Width:  |  Height:  |  Size: 4.5 KiB

After

Width:  |  Height:  |  Size: 4.5 KiB

View File

@@ -83,7 +83,7 @@
.fileIcon {
@apply w-4 h-4 mr-1 bg-center bg-no-repeat;
background-image: url(../assets/unknow.svg);
background-image: url(../assets/unknown.svg);
background-size: 16px;
}
.fileIcon.csv {

View File

@@ -32,7 +32,7 @@ const EmptyDatasetCreationModal = ({
return
}
if (inputValue.length > 40) {
notify({ type: 'error', message: t('datasetCreation.stepOne.modal.nameLengthInvaild') })
notify({ type: 'error', message: t('datasetCreation.stepOne.modal.nameLengthInvalid') })
return
}
try {

View File

@@ -104,7 +104,7 @@
.fileIcon {
@apply shrink-0 w-6 h-6 mr-2 bg-center bg-no-repeat;
background-image: url(../assets/unknow.svg);
background-image: url(../assets/unknown.svg);
background-size: 24px;
}

View File

@@ -306,7 +306,7 @@ const StepTwo = ({
const {
modelList: rerankModelList,
defaultModel: rerankDefaultModel,
currentModel: isRerankDefaultModelVaild,
currentModel: isRerankDefaultModelValid,
} = useModelListAndDefaultModelAndCurrentProviderAndModel(ModelTypeEnum.rerank)
const { data: embeddingModelList } = useModelList(ModelTypeEnum.textEmbedding)
const { data: defaultEmbeddingModel } = useDefaultModel(ModelTypeEnum.textEmbedding)
@@ -344,7 +344,7 @@ const StepTwo = ({
if (
!isReRankModelSelected({
rerankDefaultModel,
isRerankDefaultModelVaild: !!isRerankDefaultModelVaild,
isRerankDefaultModelValid: !!isRerankDefaultModelValid,
rerankModelList,
// eslint-disable-next-line @typescript-eslint/no-use-before-define
retrievalConfig,

View File

@@ -41,14 +41,14 @@ const PreviewItem: FC<IPreviewItemProps> = ({
const charNums = type === PreviewType.TEXT
? (content || '').length
: (qa?.answer || '').length + (qa?.question || '').length
const formatedIndex = (() => String(index).padStart(3, '0'))()
const formattedIndex = (() => String(index).padStart(3, '0'))()
return (
<div className='p-4 rounded-xl bg-gray-50'>
<div className='flex items-center justify-between h-5 text-xs text-gray-500'>
<div className='flex items-center h-[18px] space-x-1 border border-gray-200 box-border rounded-md italic pl-1 pr-1.5 font-medium'>
{sharpIcon}
<span>{formatedIndex}</span>
<span>{formattedIndex}</span>
</div>
<div className='flex items-center space-x-1'>
{textIcon}

View File

@@ -24,7 +24,7 @@ import { ToastContext } from '@/app/components/base/toast'
import type { Item } from '@/app/components/base/select'
import { SimpleSelect } from '@/app/components/base/select'
import { deleteSegment, disableSegment, enableSegment, fetchSegments, updateSegment } from '@/service/datasets'
import type { SegmentDetailModel, SegmentUpdator, SegmentsQuery, SegmentsResponse } from '@/models/datasets'
import type { SegmentDetailModel, SegmentUpdater, SegmentsQuery, SegmentsResponse } from '@/models/datasets'
import { asyncRunSafe } from '@/utils'
import type { CommonResponse } from '@/models/common'
import AutoHeightTextarea from '@/app/components/base/auto-height-textarea/common'
@@ -322,7 +322,7 @@ const Completed: FC<ICompletedProps> = ({
}
const handleUpdateSegment = async (segmentId: string, question: string, answer: string, keywords: string[]) => {
const params: SegmentUpdator = { content: '' }
const params: SegmentUpdater = { content: '' }
if (docForm === 'qa_model') {
if (!question.trim())
return notify({ type: 'error', message: t('datasetDocuments.segment.questionEmpty') })

View File

@@ -9,7 +9,7 @@ import Button from '@/app/components/base/button'
import AutoHeightTextarea from '@/app/components/base/auto-height-textarea/common'
import { Hash02 } from '@/app/components/base/icons/src/vender/line/general'
import { ToastContext } from '@/app/components/base/toast'
import type { SegmentUpdator } from '@/models/datasets'
import type { SegmentUpdater } from '@/models/datasets'
import { addSegment } from '@/service/datasets'
import TagInput from '@/app/components/base/tag-input'
@@ -42,7 +42,7 @@ const NewSegmentModal: FC<NewSegmentModalProps> = ({
}
const handleSave = async () => {
const params: SegmentUpdator = { content: '' }
const params: SegmentUpdater = { content: '' }
if (docForm === 'qa_model') {
if (!question.trim())
return notify({ type: 'error', message: t('datasetDocuments.segment.questionEmpty') })

View File

@@ -109,15 +109,15 @@ const Documents: FC<IDocumentsProps> = ({ datasetId }) => {
let percent = 0
const documentsData = documentsRes?.data?.map((documentItem) => {
const { indexing_status, completed_segments, total_segments } = documentItem
const isEmbeddinged = indexing_status === 'completed' || indexing_status === 'paused' || indexing_status === 'error'
const isEmbedded = indexing_status === 'completed' || indexing_status === 'paused' || indexing_status === 'error'
if (isEmbeddinged)
if (isEmbedded)
completedNum++
const completedCount = completed_segments || 0
const totalCount = total_segments || 0
if (totalCount === 0 && completedCount === 0) {
percent = isEmbeddinged ? 100 : 0
percent = isEmbedded ? 100 : 0
}
else {
const per = Math.round(completedCount * 100 / totalCount)

View File

@@ -39,14 +39,14 @@ const ModifyRetrievalModal: FC<Props> = ({
const {
modelList: rerankModelList,
defaultModel: rerankDefaultModel,
currentModel: isRerankDefaultModelVaild,
currentModel: isRerankDefaultModelValid,
} = useModelListAndDefaultModelAndCurrentProviderAndModel(ModelTypeEnum.rerank)
const handleSave = () => {
if (
!isReRankModelSelected({
rerankDefaultModel,
isRerankDefaultModelVaild: !!isRerankDefaultModelVaild,
isRerankDefaultModelValid: !!isRerankDefaultModelValid,
rerankModelList,
retrievalConfig,
indexMethod,

View File

@@ -73,7 +73,7 @@ const Form = () => {
const {
modelList: rerankModelList,
defaultModel: rerankDefaultModel,
currentModel: isRerankDefaultModelVaild,
currentModel: isRerankDefaultModelValid,
} = useModelListAndDefaultModelAndCurrentProviderAndModel(ModelTypeEnum.rerank)
const { data: embeddingModelList } = useModelList(ModelTypeEnum.textEmbedding)
@@ -99,7 +99,7 @@ const Form = () => {
if (
!isReRankModelSelected({
rerankDefaultModel,
isRerankDefaultModelVaild: !!isRerankDefaultModelVaild,
isRerankDefaultModelValid: !!isRerankDefaultModelValid,
rerankModelList,
retrievalConfig,
indexMethod,

View File

@@ -3,7 +3,7 @@ import { Row, Col, Properties, Property, Heading, SubProperty, Paragraph } from
# Advanced Chat App API
Chat applications support session persistence, allowing previous chat history to be used as context for responses. This can be applicable for chatbots, customer service AI, etc.
Chat applications support session persistence, allowing previous chat history to be used as context for responses. This can be applicable for chatbot, customer service AI, etc.
<div>
### Base URL
@@ -60,7 +60,7 @@ Chat applications support session persistence, allowing previous chat history to
Should be uniquely defined by the developer within the application.
</Property>
<Property name='conversation_id' type='string' key='conversation_id'>
Converation ID, to continue the conversation based on previous chat records, it is necessary to pass the previous message's conversation_id.
Conversation ID, to continue the conversation based on previous chat records, it is necessary to pass the previous message's conversation_id.
</Property>
<Property name='files' type='array[object]' key='files'>
File list, suitable for inputting files (images) combined with text understanding and answering questions, available only when the model supports Vision capability.
@@ -239,7 +239,7 @@ Chat applications support session persistence, allowing previous chat history to
"message_id": "9da23599-e713-473b-982c-4328d4f5c78a",
"conversation_id": "45701982-8118-4bc5-8e9b-64562b4555f2",
"mode": "chat",
"answer": "iPhone 13 Pro Max specs are listed heere:...",
"answer": "iPhone 13 Pro Max specs are listed here:...",
"metadata": {
"usage": {
"prompt_tokens": 1033,
@@ -732,7 +732,7 @@ Chat applications support session persistence, allowing previous chat history to
<CodeGroup title="Request" tag="DELETE" label="/conversations/:conversation_id" targetCode={`curl -X DELETE '${props.appDetail.api_base_url}/conversations/:conversation_id' \\\n--header 'Authorization: Bearer {api_key}' \\\n--header 'Content-Type: application/json' \\\n--data-raw '{ \n "user": "abc-123"\n}'`}>
```bash {{ title: 'cURL' }}
curl -X DELETE '${props.appDetail.api_base_url}/conversations/{convsation_id}' \
curl -X DELETE '${props.appDetail.api_base_url}/conversations/{conversation_id}' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer {api_key}' \

View File

@@ -250,7 +250,7 @@ import { Row, Col, Properties, Property, Heading, SubProperty } from '../md.tsx'
"message_id": "9da23599-e713-473b-982c-4328d4f5c78a",
"conversation_id": "45701982-8118-4bc5-8e9b-64562b4555f2",
"mode": "chat",
"answer": "iPhone 13 Pro Max specs are listed heere:...",
"answer": "iPhone 13 Pro Max specs are listed here:...",
"metadata": {
"usage": {
"prompt_tokens": 1033,
@@ -767,7 +767,7 @@ import { Row, Col, Properties, Property, Heading, SubProperty } from '../md.tsx'
<CodeGroup title="Request" tag="DELETE" label="/conversations/:conversation_id" targetCode={`curl -X DELETE '${props.appDetail.api_base_url}/conversations/:conversation_id' \\\n--header 'Authorization: Bearer {api_key}' \\\n--header 'Content-Type: application/json' \\\n--data-raw '{ \n "user": "abc-123"\n}'`}>
```bash {{ title: 'cURL' }}
curl -X DELETE '${props.appDetail.api_base_url}/conversations/{convsation_id}' \
curl -X DELETE '${props.appDetail.api_base_url}/conversations/{conversation_id}' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer {api_key}' \

View File

@@ -3,7 +3,7 @@ import { Row, Col, Properties, Property, Heading, SubProperty, Paragraph } from
# Chat App API
Chat applications support session persistence, allowing previous chat history to be used as context for responses. This can be applicable for chatbots, customer service AI, etc.
Chat applications support session persistence, allowing previous chat history to be used as context for responses. This can be applicable for chatbot, customer service AI, etc.
<div>
### Base URL
@@ -61,7 +61,7 @@ Chat applications support session persistence, allowing previous chat history to
Should be uniquely defined by the developer within the application.
</Property>
<Property name='conversation_id' type='string' key='conversation_id'>
Converation ID, to continue the conversation based on previous chat records, it is necessary to pass the previous message's conversation_id.
Conversation ID, to continue the conversation based on previous chat records, it is necessary to pass the previous message's conversation_id.
</Property>
<Property name='files' type='array[object]' key='files'>
File list, suitable for inputting files (images) combined with text understanding and answering questions, available only when the model supports Vision capability.
@@ -200,7 +200,7 @@ Chat applications support session persistence, allowing previous chat history to
"message_id": "9da23599-e713-473b-982c-4328d4f5c78a",
"conversation_id": "45701982-8118-4bc5-8e9b-64562b4555f2",
"mode": "chat",
"answer": "iPhone 13 Pro Max specs are listed heere:...",
"answer": "iPhone 13 Pro Max specs are listed here:...",
"metadata": {
"usage": {
"prompt_tokens": 1033,
@@ -534,7 +534,7 @@ Chat applications support session persistence, allowing previous chat history to
- `id` (string) ID
- `type` (string) File type, image for images
- `url` (string) Preview image URL
- `belongs_to` (string) belongs touser orassistant
- `belongs_to` (string) belongs touser or assistant
- `agent_thoughts` (array[object]) Agent thoughtEmpty if it's a Basic Assistant
- `id` (string) Agent thought ID, every iteration has a unique agent thought ID
- `message_id` (string) Unique message ID
@@ -772,7 +772,7 @@ Chat applications support session persistence, allowing previous chat history to
<CodeGroup title="Request" tag="DELETE" label="/conversations/:conversation_id" targetCode={`curl -X DELETE '${props.appDetail.api_base_url}/conversations/:conversation_id' \\\n--header 'Authorization: Bearer {api_key}' \\\n--header 'Content-Type: application/json' \\\n--data-raw '{ \n "user": "abc-123"\n}'`}>
```bash {{ title: 'cURL' }}
curl -X DELETE '${props.appDetail.api_base_url}/conversations/{convsation_id}' \
curl -X DELETE '${props.appDetail.api_base_url}/conversations/{conversation_id}' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer {api_key}' \

View File

@@ -213,7 +213,7 @@ import { Row, Col, Properties, Property, Heading, SubProperty } from '../md.tsx'
"message_id": "9da23599-e713-473b-982c-4328d4f5c78a",
"conversation_id": "45701982-8118-4bc5-8e9b-64562b4555f2",
"mode": "chat",
"answer": "iPhone 13 Pro Max specs are listed heere:...",
"answer": "iPhone 13 Pro Max specs are listed here:...",
"metadata": {
"usage": {
"prompt_tokens": 1033,
@@ -786,7 +786,7 @@ import { Row, Col, Properties, Property, Heading, SubProperty } from '../md.tsx'
<CodeGroup title="Request" tag="DELETE" label="/conversations/:conversation_id" targetCode={`curl -X DELETE '${props.appDetail.api_base_url}/conversations/:conversation_id' \\\n--header 'Authorization: Bearer {api_key}' \\\n--header 'Content-Type: application/json' \\\n--data-raw '{ \n "user": "abc-123"\n}'`}>
```bash {{ title: 'cURL' }}
curl -X DELETE '${props.appDetail.api_base_url}/conversations/{convsation_id}' \
curl -X DELETE '${props.appDetail.api_base_url}/conversations/{conversation_id}' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer {api_key}' \

View File

@@ -5,7 +5,7 @@ import Button from '../../base/button'
import cn from '@/utils/classnames'
import type { App } from '@/models/explore'
import AppIcon from '@/app/components/base/app-icon'
import { AiText, ChatBot, CuteRobote } from '@/app/components/base/icons/src/vender/solid/communication'
import { AiText, ChatBot, CuteRobot } from '@/app/components/base/icons/src/vender/solid/communication'
import { Route } from '@/app/components/base/icons/src/vender/solid/mapsAndTravel'
export type AppCardProps = {
app: App
@@ -38,7 +38,7 @@ const AppCard = ({
<ChatBot className='w-3 h-3 text-[#1570EF]' />
)}
{appBasicInfo.mode === 'agent-chat' && (
<CuteRobote className='w-3 h-3 text-indigo-600' />
<CuteRobot className='w-3 h-3 text-indigo-600' />
)}
{appBasicInfo.mode === 'chat' && (
<ChatBot className='w-3 h-3 text-[#1570EF]' />

View File

@@ -15,7 +15,7 @@ export type ICategoryProps = {
value: string
onChange: (value: AppCategory | string) => void
/**
* default value for searchparam 'category' in en
* default value for search param 'category' in en
*/
allCategoriesEn: string
}

View File

@@ -22,11 +22,11 @@ import { LanguagesSupported } from '@/i18n/language'
import { useProviderContext } from '@/context/provider-context'
import { Plan } from '@/app/components/billing/type'
export type IAppSelecotr = {
export type IAppSelector = {
isMobile: boolean
}
export default function AppSelector({ isMobile }: IAppSelecotr) {
export default function AppSelector({ isMobile }: IAppSelector) {
const itemClassName = `
flex items-center w-full h-9 px-3 text-gray-700 text-[14px]
rounded-lg font-normal hover:bg-gray-50 cursor-pointer

View File

@@ -90,7 +90,7 @@ export default function AccountPage() {
setPassword('')
setConfirmPassword('')
}
const handleSavePassowrd = async () => {
const handleSavePassword = async () => {
if (!valid())
return
try {
@@ -235,7 +235,7 @@ export default function AccountPage() {
<Button
disabled={editing}
variant='primary'
onClick={handleSavePassowrd}
onClick={handleSavePassword}
>
{userProfile.is_password_set ? t('common.operation.reset') : t('common.operation.save')}
</Button>

View File

@@ -15,7 +15,7 @@ import I18n from '@/context/i18n'
import { useAppContext } from '@/context/app-context'
import Avatar from '@/app/components/base/avatar'
import type { InvitationResult } from '@/models/common'
import LogoEmbededChatHeader from '@/app/components/base/logo/logo-embeded-chat-header'
import LogoEmbeddedChatHeader from '@/app/components/base/logo/logo-embedded-chat-header'
import { useProviderContext } from '@/context/provider-context'
import { Plan } from '@/app/components/billing/type'
import UpgradeBtn from '@/app/components/billing/upgrade-btn'
@@ -49,7 +49,7 @@ const MembersPage = () => {
<>
<div className='flex flex-col'>
<div className='flex items-center mb-4 p-3 bg-gray-50 rounded-2xl'>
<LogoEmbededChatHeader className='!w-10 !h-10' />
<LogoEmbeddedChatHeader className='!w-10 !h-10' />
<div className='grow mx-2'>
<div className='text-sm font-medium text-gray-900'>{currentWorkspace?.name}</div>
{enableBilling && (

View File

@@ -35,9 +35,9 @@ const ModelProviderPage = () => {
const { modelProviders: providers } = useProviderContext()
const setShowModelModal = useModalContextSelector(state => state.setShowModelModal)
const defaultModelNotConfigured = !textGenerationDefaultModel && !embeddingsDefaultModel && !speech2textDefaultModel && !rerankDefaultModel && !ttsDefaultModel
const [configedProviders, notConfigedProviders] = useMemo(() => {
const configedProviders: ModelProvider[] = []
const notConfigedProviders: ModelProvider[] = []
const [configuredProviders, notConfiguredProviders] = useMemo(() => {
const configuredProviders: ModelProvider[] = []
const notConfiguredProviders: ModelProvider[] = []
providers.forEach((provider) => {
if (
@@ -47,12 +47,12 @@ const ModelProviderPage = () => {
&& provider.system_configuration.quota_configurations.find(item => item.quota_type === provider.system_configuration.current_quota_type)
)
)
configedProviders.push(provider)
configuredProviders.push(provider)
else
notConfigedProviders.push(provider)
notConfiguredProviders.push(provider)
})
return [configedProviders, notConfigedProviders]
return [configuredProviders, notConfiguredProviders]
}, [providers])
const handleOpenModal = (
@@ -110,10 +110,10 @@ const ModelProviderPage = () => {
/>
</div>
{
!!configedProviders?.length && (
!!configuredProviders?.length && (
<div className='pb-3'>
{
configedProviders?.map(provider => (
configuredProviders?.map(provider => (
<ProviderAddedCard
key={provider.provider}
provider={provider}
@@ -125,7 +125,7 @@ const ModelProviderPage = () => {
)
}
{
!!notConfigedProviders?.length && (
!!notConfiguredProviders?.length && (
<>
<div className='flex items-center mb-2 text-xs font-semibold text-gray-500'>
+ {t('common.modelProvider.addMoreModelProvider')}
@@ -133,7 +133,7 @@ const ModelProviderPage = () => {
</div>
<div className='grid grid-cols-3 gap-2'>
{
notConfigedProviders?.map(provider => (
notConfiguredProviders?.map(provider => (
<ProviderCard
key={provider.provider}
provider={provider}

View File

@@ -91,7 +91,7 @@ const Form: FC<FormProps> = ({
if (show_on.length && !show_on.every(showOnItem => value[showOnItem.variable] === showOnItem.value))
return null
const disabed = readonly || (isEditMode && (variable === '__model_type' || variable === '__model_name'))
const disabled = readonly || (isEditMode && (variable === '__model_type' || variable === '__model_name'))
return (
<div key={variable} className={cn(itemClassName, 'py-3')}>
<div className={cn(fieldLabelClassName, 'flex items-center py-2 text-sm text-gray-900')}>
@@ -104,12 +104,12 @@ const Form: FC<FormProps> = ({
{tooltipContent}
</div>
<Input
className={cn(inputClassName, `${disabed && 'cursor-not-allowed opacity-60'}`)}
className={cn(inputClassName, `${disabled && 'cursor-not-allowed opacity-60'}`)}
value={(isShowDefaultValue && ((value[variable] as string) === '' || value[variable] === undefined || value[variable] === null)) ? formSchema.default : value[variable]}
onChange={val => handleFormChange(variable, val)}
validated={validatedSuccess}
placeholder={placeholder?.[language] || placeholder?.en_US}
disabled={disabed}
disabled={disabled}
type={formSchema.type === FormTypeEnum.textNumber ? 'number' : 'text'}
{...(formSchema.type === FormTypeEnum.textNumber ? { min: (formSchema as CredentialFormSchemaNumberInput).min, max: (formSchema as CredentialFormSchemaNumberInput).max } : {})}
/>
@@ -131,7 +131,7 @@ const Form: FC<FormProps> = ({
if (show_on.length && !show_on.every(showOnItem => value[showOnItem.variable] === showOnItem.value))
return null
const disabed = isEditMode && (variable === '__model_type' || variable === '__model_name')
const disabled = isEditMode && (variable === '__model_type' || variable === '__model_name')
return (
<div key={variable} className={cn(itemClassName, 'py-3')}>
@@ -156,7 +156,7 @@ const Form: FC<FormProps> = ({
className={`
flex items-center px-3 py-2 rounded-lg border border-gray-100 bg-gray-25 cursor-pointer
${value[variable] === option.value && 'bg-white border-[1.5px] border-primary-400 shadow-sm'}
${disabed && '!cursor-not-allowed opacity-60'}
${disabled && '!cursor-not-allowed opacity-60'}
`}
onClick={() => handleFormChange(variable, option.value)}
key={`${variable}-${option.value}`}

View File

@@ -36,7 +36,7 @@ const CredentialPanel: FC<CredentialPanelProps> = ({
const customConfig = provider.custom_configuration
const systemConfig = provider.system_configuration
const priorityUseType = provider.preferred_provider_type
const customConfiged = customConfig.status === CustomConfigurationStatusEnum.active
const isCustomConfigured = customConfig.status === CustomConfigurationStatusEnum.active
const configurateMethods = provider.configurate_methods
const handleChangePriority = async (key: PreferredProviderTypeEnum) => {
@@ -69,7 +69,7 @@ const CredentialPanel: FC<CredentialPanelProps> = ({
<div className='shrink-0 relative ml-1 p-1 w-[112px] rounded-lg bg-white/[0.3] border-[0.5px] border-black/5'>
<div className='flex items-center justify-between mb-1 pt-1 pl-2 pr-[7px] h-5 text-xs font-medium text-gray-500'>
API-KEY
<Indicator color={customConfiged ? 'green' : 'gray'} />
<Indicator color={isCustomConfigured ? 'green' : 'gray'} />
</div>
<div className='flex items-center gap-0.5'>
<Button
@@ -81,7 +81,7 @@ const CredentialPanel: FC<CredentialPanelProps> = ({
{t('common.operation.setup')}
</Button>
{
systemConfig.enabled && customConfiged && (
systemConfig.enabled && isCustomConfigured && (
<PrioritySelector
value={priorityUseType}
onSelect={handleChangePriority}
@@ -98,7 +98,7 @@ const CredentialPanel: FC<CredentialPanelProps> = ({
)
}
{
systemConfig.enabled && customConfiged && !provider.provider_credential_schema && (
systemConfig.enabled && isCustomConfigured && !provider.provider_credential_schema && (
<div className='ml-1'>
<PrioritySelector
value={priorityUseType}

View File

@@ -17,16 +17,16 @@ const ExploreNav = ({
}: ExploreNavProps) => {
const { t } = useTranslation()
const selectedSegment = useSelectedLayoutSegment()
const actived = selectedSegment === 'explore'
const activated = selectedSegment === 'explore'
return (
<Link href="/explore/apps" className={classNames(
className, 'group',
actived && 'bg-components-main-nav-nav-button-bg-active shadow-md',
actived ? 'text-components-main-nav-nav-button-text-active' : 'text-components-main-nav-nav-button-text hover:bg-components-main-nav-nav-button-bg-hover',
activated && 'bg-components-main-nav-nav-button-bg-active shadow-md',
activated ? 'text-components-main-nav-nav-button-text-active' : 'text-components-main-nav-nav-button-text hover:bg-components-main-nav-nav-button-bg-hover',
)}>
{
actived
activated
? <RiPlanetFill className='mr-2 w-4 h-4' />
: <RiPlanetLine className='mr-2 w-4 h-4' />
}

View File

@@ -34,21 +34,21 @@ const Nav = ({
const setAppDetail = useAppStore(state => state.setAppDetail)
const [hovered, setHovered] = useState(false)
const segment = useSelectedLayoutSegment()
const isActived = Array.isArray(activeSegment) ? activeSegment.includes(segment!) : segment === activeSegment
const isActivated = Array.isArray(activeSegment) ? activeSegment.includes(segment!) : segment === activeSegment
return (
<div className={`
flex items-center h-8 mr-0 sm:mr-3 px-0.5 rounded-xl text-sm shrink-0 font-medium
${isActived && 'bg-components-main-nav-nav-button-bg-active shadow-md font-semibold'}
${!curNav && !isActived && 'hover:bg-components-main-nav-nav-button-bg-hover'}
${isActivated && 'bg-components-main-nav-nav-button-bg-active shadow-md font-semibold'}
${!curNav && !isActivated && 'hover:bg-components-main-nav-nav-button-bg-hover'}
`}>
<Link href={link}>
<div
onClick={() => setAppDetail()}
className={classNames(`
flex items-center h-7 px-2.5 cursor-pointer rounded-[10px]
${isActived ? 'text-components-main-nav-nav-button-text-active' : 'text-components-main-nav-nav-button-text'}
${curNav && isActived && 'hover:bg-components-main-nav-nav-button-bg-active-hover'}
${isActivated ? 'text-components-main-nav-nav-button-text-active' : 'text-components-main-nav-nav-button-text'}
${curNav && isActivated && 'hover:bg-components-main-nav-nav-button-bg-active-hover'}
`)}
onMouseEnter={() => setHovered(true)}
onMouseLeave={() => setHovered(false)}
@@ -57,7 +57,7 @@ const Nav = ({
{
(hovered && curNav)
? <ArrowNarrowLeft className='w-4 h-4' />
: isActived
: isActivated
? activeIcon
: icon
}
@@ -66,7 +66,7 @@ const Nav = ({
</div>
</Link>
{
curNav && isActived && (
curNav && isActivated && (
<>
<div className='font-light text-gray-300 '>/</div>
<NavSelector

View File

@@ -11,7 +11,7 @@ import { useRouter } from 'next/navigation'
import { debounce } from 'lodash-es'
import cn from '@/utils/classnames'
import AppIcon from '@/app/components/base/app-icon'
import { AiText, ChatBot, CuteRobote } from '@/app/components/base/icons/src/vender/solid/communication'
import { AiText, ChatBot, CuteRobot } from '@/app/components/base/icons/src/vender/solid/communication'
import { Route } from '@/app/components/base/icons/src/vender/solid/mapsAndTravel'
import { useAppContext } from '@/context/app-context'
import { useStore as useAppStore } from '@/app/components/app/store'
@@ -94,7 +94,7 @@ const NavSelector = ({ curNav, navs, createText, isApp, onCreate, onLoadmore }:
<ChatBot className='w-2.5 h-2.5 text-[#1570EF]' />
)}
{nav.mode === 'agent-chat' && (
<CuteRobote className='w-2.5 h-2.5 text-indigo-600' />
<CuteRobot className='w-2.5 h-2.5 text-indigo-600' />
)}
{nav.mode === 'chat' && (
<ChatBot className='w-2.5 h-2.5 text-[#1570EF]' />

View File

@@ -17,16 +17,16 @@ const ToolsNav = ({
}: ToolsNavProps) => {
const { t } = useTranslation()
const selectedSegment = useSelectedLayoutSegment()
const actived = selectedSegment === 'tools'
const activated = selectedSegment === 'tools'
return (
<Link href="/tools" className={classNames(
className, 'group',
actived && 'bg-white shadow-md',
actived ? 'text-primary-600' : 'text-gray-500 hover:bg-gray-200',
activated && 'bg-white shadow-md',
activated ? 'text-primary-600' : 'text-gray-500 hover:bg-gray-200',
)}>
{
actived
activated
? <RiHammerFill className='mr-2 w-4 h-4' />
: <RiHammerLine className='mr-2 w-4 h-4' />
}

View File

@@ -163,8 +163,8 @@ const TextGeneration: FC<IMainProps> = ({
}
const allSuccessTaskList = allTaskList.filter(task => task.status === TaskStatus.completed)
const allFailedTaskList = allTaskList.filter(task => task.status === TaskStatus.failed)
const allTaskFinished = allTaskList.every(task => task.status === TaskStatus.completed)
const allTaskRuned = allTaskList.every(task => [TaskStatus.completed, TaskStatus.failed].includes(task.status))
const allTasksFinished = allTaskList.every(task => task.status === TaskStatus.completed)
const allTasksRun = allTaskList.every(task => [TaskStatus.completed, TaskStatus.failed].includes(task.status))
const [batchCompletionRes, doSetBatchCompletionRes] = useState<Record<string, string>>({})
const batchCompletionResRef = useRef<Record<string, string>>({})
const setBatchCompletionRes = (res: Record<string, string>) => {
@@ -286,7 +286,7 @@ const TextGeneration: FC<IMainProps> = ({
const handleRunBatch = (data: string[][]) => {
if (!checkBatchInputs(data))
return
if (!allTaskFinished) {
if (!allTasksFinished) {
notify({ type: 'info', message: t('appDebug.errorMessage.waitForBatchResponse') })
return
}
@@ -318,17 +318,17 @@ const TextGeneration: FC<IMainProps> = ({
showResSidebar()
}
const handleCompleted = (completionRes: string, taskId?: number, isSuccess?: boolean) => {
const allTasklistLatest = getLatestTaskList()
const allTaskListLatest = getLatestTaskList()
const batchCompletionResLatest = getBatchCompletionRes()
const pendingTaskList = allTasklistLatest.filter(task => task.status === TaskStatus.pending)
const hadRunedTaskNum = 1 + allTasklistLatest.filter(task => [TaskStatus.completed, TaskStatus.failed].includes(task.status)).length
const needToAddNextGroupTask = (getCurrGroupNum() !== hadRunedTaskNum) && pendingTaskList.length > 0 && (hadRunedTaskNum % GROUP_SIZE === 0 || (allTasklistLatest.length - hadRunedTaskNum < GROUP_SIZE))
const pendingTaskList = allTaskListLatest.filter(task => task.status === TaskStatus.pending)
const runTasksCount = 1 + allTaskListLatest.filter(task => [TaskStatus.completed, TaskStatus.failed].includes(task.status)).length
const needToAddNextGroupTask = (getCurrGroupNum() !== runTasksCount) && pendingTaskList.length > 0 && (runTasksCount % GROUP_SIZE === 0 || (allTaskListLatest.length - runTasksCount < GROUP_SIZE))
// avoid add many task at the same time
if (needToAddNextGroupTask)
setCurrGroupNum(hadRunedTaskNum)
setCurrGroupNum(runTasksCount)
const nextPendingTaskIds = needToAddNextGroupTask ? pendingTaskList.slice(0, GROUP_SIZE).map(item => item.id) : []
const newAllTaskList = allTasklistLatest.map((item) => {
const newAllTaskList = allTaskListLatest.map((item) => {
if (item.id === taskId) {
return {
...item,
@@ -393,7 +393,7 @@ const TextGeneration: FC<IMainProps> = ({
})
const prompt_variables = userInputsFormToPromptVariables(user_input_form)
setPromptConfig({
prompt_template: '', // placeholder for feture
prompt_template: '', // placeholder for future
prompt_variables,
} as PromptConfig)
setMoreLikeThisConfig(more_like_this)
@@ -587,7 +587,7 @@ const TextGeneration: FC<IMainProps> = ({
isRight: true,
extra: savedMessages.length > 0
? (
<div className='ml-1 flext items-center h-5 px-1.5 rounded-md border border-gray-200 text-gray-500 text-xs font-medium'>
<div className='ml-1 flex items-center h-5 px-1.5 rounded-md border border-gray-200 text-gray-500 text-xs font-medium'>
{savedMessages.length}
</div>
)
@@ -614,7 +614,7 @@ const TextGeneration: FC<IMainProps> = ({
<RunBatch
vars={promptConfig.prompt_variables}
onSend={handleRunBatch}
isAllFinished={allTaskRuned}
isAllFinished={allTasksRun}
/>
</div>

Some files were not shown because too many files have changed in this diff Show More