mirror of https://github.com/langgenius/dify.git
chore: fix type check for i18n (#30058)
Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com> Co-authored-by: yyh <yuanyouhuilyz@gmail.com>
This commit is contained in:
parent
0f41924db4
commit
1e3823e605
|
|
@ -1,4 +1,4 @@
|
|||
name: Check i18n Files and Create PR
|
||||
name: Translate i18n Files Based on English
|
||||
|
||||
on:
|
||||
push:
|
||||
|
|
@ -67,25 +67,19 @@ jobs:
|
|||
working-directory: ./web
|
||||
run: pnpm run auto-gen-i18n ${{ env.FILE_ARGS }}
|
||||
|
||||
- name: Generate i18n type definitions
|
||||
if: env.FILES_CHANGED == 'true'
|
||||
working-directory: ./web
|
||||
run: pnpm run gen:i18n-types
|
||||
|
||||
- name: Create Pull Request
|
||||
if: env.FILES_CHANGED == 'true'
|
||||
uses: peter-evans/create-pull-request@v6
|
||||
with:
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
commit-message: 'chore(i18n): update translations based on en-US changes'
|
||||
title: 'chore(i18n): translate i18n files and update type definitions'
|
||||
title: 'chore(i18n): translate i18n files based on en-US changes'
|
||||
body: |
|
||||
This PR was automatically created to update i18n files and TypeScript type definitions based on changes in en-US locale.
|
||||
This PR was automatically created to update i18n translation files based on changes in en-US locale.
|
||||
|
||||
**Triggered by:** ${{ github.sha }}
|
||||
|
||||
**Changes included:**
|
||||
- Updated translation files for all locales
|
||||
- Regenerated TypeScript type definitions for type safety
|
||||
branch: chore/automated-i18n-updates-${{ github.sha }}
|
||||
delete-branch: true
|
||||
|
|
|
|||
|
|
@ -38,9 +38,6 @@ jobs:
|
|||
- name: Install dependencies
|
||||
run: pnpm install --frozen-lockfile
|
||||
|
||||
- name: Check i18n types synchronization
|
||||
run: pnpm run check:i18n-types
|
||||
|
||||
- name: Run tests
|
||||
run: pnpm test:coverage
|
||||
|
||||
|
|
|
|||
|
|
@ -104,7 +104,7 @@ const CardView: FC<ICardViewProps> = ({ appId, isInPanel, className }) => {
|
|||
|
||||
notify({
|
||||
type,
|
||||
message: t(`common.actionMsg.${message}`),
|
||||
message: t(`common.actionMsg.${message}` as any) as string,
|
||||
})
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -53,7 +53,7 @@ const LongTimeRangePicker: FC<Props> = ({
|
|||
|
||||
return (
|
||||
<SimpleSelect
|
||||
items={Object.entries(periodMapping).map(([k, v]) => ({ value: k, name: t(`appLog.filter.period.${v.name}`) }))}
|
||||
items={Object.entries(periodMapping).map(([k, v]) => ({ value: k, name: t(`appLog.filter.period.${v.name}` as any) as string }))}
|
||||
className="mt-0 !w-40"
|
||||
notClearable={true}
|
||||
onSelect={handleSelect}
|
||||
|
|
|
|||
|
|
@ -66,7 +66,7 @@ const RangeSelector: FC<Props> = ({
|
|||
}, [])
|
||||
return (
|
||||
<SimpleSelect
|
||||
items={ranges.map(v => ({ ...v, name: t(`appLog.filter.period.${v.name}`) }))}
|
||||
items={ranges.map(v => ({ ...v, name: t(`appLog.filter.period.${v.name}` as any) as string }))}
|
||||
className="mt-0 !w-40"
|
||||
notClearable={true}
|
||||
onSelect={handleSelectRange}
|
||||
|
|
|
|||
|
|
@ -1,15 +1,15 @@
|
|||
import * as React from 'react'
|
||||
import Form from '@/app/components/datasets/settings/form'
|
||||
import { getLocaleOnServer, useTranslation as translate } from '@/i18n-config/server'
|
||||
import { getLocaleOnServer, getTranslation } from '@/i18n-config/server'
|
||||
|
||||
const Settings = async () => {
|
||||
const locale = await getLocaleOnServer()
|
||||
const { t } = await translate(locale, 'dataset-settings')
|
||||
const { t } = await getTranslation(locale, 'dataset-settings')
|
||||
|
||||
return (
|
||||
<div className="h-full overflow-y-auto">
|
||||
<div className="flex flex-col gap-y-0.5 px-6 pb-2 pt-3">
|
||||
<div className="system-xl-semibold text-text-primary">{t('title')}</div>
|
||||
<div className="system-xl-semibold text-text-primary">{t('title') as any}</div>
|
||||
<div className="system-sm-regular text-text-tertiary">{t('desc')}</div>
|
||||
</div>
|
||||
<Form />
|
||||
|
|
|
|||
|
|
@ -73,7 +73,7 @@ const DatasetInfo: FC<DatasetInfoProps> = ({
|
|||
{isExternalProvider && t('dataset.externalTag')}
|
||||
{!isExternalProvider && isPipelinePublished && dataset.doc_form && dataset.indexing_technique && (
|
||||
<div className="flex items-center gap-x-2">
|
||||
<span>{t(`dataset.chunkingMode.${DOC_FORM_TEXT[dataset.doc_form]}`)}</span>
|
||||
<span>{t(`dataset.chunkingMode.${DOC_FORM_TEXT[dataset.doc_form]}` as any) as string}</span>
|
||||
<span>{formatIndexingTechniqueAndMethod(dataset.indexing_technique, dataset.retrieval_model_dict?.search_method)}</span>
|
||||
</div>
|
||||
)}
|
||||
|
|
|
|||
|
|
@ -116,7 +116,7 @@ const DatasetSidebarDropdown = ({
|
|||
{isExternalProvider && t('dataset.externalTag')}
|
||||
{!isExternalProvider && dataset.doc_form && dataset.indexing_technique && (
|
||||
<div className="flex items-center gap-x-2">
|
||||
<span>{t(`dataset.chunkingMode.${DOC_FORM_TEXT[dataset.doc_form]}`)}</span>
|
||||
<span>{t(`dataset.chunkingMode.${DOC_FORM_TEXT[dataset.doc_form]}` as any) as string}</span>
|
||||
<span>{formatIndexingTechniqueAndMethod(dataset.indexing_technique, dataset.retrieval_model_dict?.search_method)}</span>
|
||||
</div>
|
||||
)}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
import type { ComponentProps } from 'react'
|
||||
import type { AnnotationItemBasic } from '../type'
|
||||
import type { Locale } from '@/i18n-config'
|
||||
import { render, screen, waitFor } from '@testing-library/react'
|
||||
import userEvent from '@testing-library/user-event'
|
||||
import * as React from 'react'
|
||||
|
|
@ -166,7 +167,7 @@ type HeaderOptionsProps = ComponentProps<typeof HeaderOptions>
|
|||
|
||||
const renderComponent = (
|
||||
props: Partial<HeaderOptionsProps> = {},
|
||||
locale: string = LanguagesSupported[0] as string,
|
||||
locale: Locale = LanguagesSupported[0],
|
||||
) => {
|
||||
const defaultProps: HeaderOptionsProps = {
|
||||
appId: 'test-app-id',
|
||||
|
|
@ -353,7 +354,7 @@ describe('HeaderOptions', () => {
|
|||
})
|
||||
const revokeSpy = vi.spyOn(URL, 'revokeObjectURL').mockImplementation(vi.fn())
|
||||
|
||||
renderComponent({}, LanguagesSupported[1] as string)
|
||||
renderComponent({}, LanguagesSupported[1])
|
||||
|
||||
await expandExportMenu(user)
|
||||
|
||||
|
|
@ -441,7 +442,7 @@ describe('HeaderOptions', () => {
|
|||
view.rerender(
|
||||
<I18NContext.Provider
|
||||
value={{
|
||||
locale: LanguagesSupported[0] as string,
|
||||
locale: LanguagesSupported[0],
|
||||
i18n: {},
|
||||
setLocaleOnClient: vi.fn(),
|
||||
}}
|
||||
|
|
|
|||
|
|
@ -84,7 +84,7 @@ const AccessModeDisplay: React.FC<{ mode?: AccessMode }> = ({ mode }) => {
|
|||
<>
|
||||
<Icon className="h-4 w-4 shrink-0 text-text-secondary" />
|
||||
<div className="grow truncate">
|
||||
<span className="system-sm-medium text-text-secondary">{t(`app.accessControlDialog.accessItems.${label}`)}</span>
|
||||
<span className="system-sm-medium text-text-secondary">{t(`app.accessControlDialog.accessItems.${label}` as any) as string}</span>
|
||||
</div>
|
||||
</>
|
||||
)
|
||||
|
|
|
|||
|
|
@ -96,7 +96,7 @@ const ConfigModal: FC<IConfigModalProps> = ({
|
|||
if (!isValid) {
|
||||
Toast.notify({
|
||||
type: 'error',
|
||||
message: t(`appDebug.varKeyError.${errorMessageKey}`, { key: t('appDebug.variableConfig.varName') }),
|
||||
message: t(`appDebug.varKeyError.${errorMessageKey}` as any, { key: t('appDebug.variableConfig.varName') }) as string,
|
||||
})
|
||||
return false
|
||||
}
|
||||
|
|
@ -216,7 +216,7 @@ const ConfigModal: FC<IConfigModalProps> = ({
|
|||
if (!isValid) {
|
||||
Toast.notify({
|
||||
type: 'error',
|
||||
message: t(`appDebug.varKeyError.${errorMessageKey}`, { key: errorKey }),
|
||||
message: t(`appDebug.varKeyError.${errorMessageKey}` as any, { key: errorKey }) as string,
|
||||
})
|
||||
return
|
||||
}
|
||||
|
|
|
|||
|
|
@ -98,7 +98,7 @@ const ConfigVar: FC<IConfigVarProps> = ({ promptVariables, readonly, onPromptVar
|
|||
if (errorMsgKey) {
|
||||
Toast.notify({
|
||||
type: 'error',
|
||||
message: t(errorMsgKey, { key: t(typeName) }),
|
||||
message: t(errorMsgKey as any, { key: t(typeName as any) as string }) as string,
|
||||
})
|
||||
return false
|
||||
}
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ const SelectTypeItem: FC<ISelectTypeItemProps> = ({
|
|||
onClick,
|
||||
}) => {
|
||||
const { t } = useTranslation()
|
||||
const typeName = t(`appDebug.variableConfig.${i18nFileTypeMap[type] || type}`)
|
||||
const typeName = t(`appDebug.variableConfig.${i18nFileTypeMap[type] || type}` as any) as string
|
||||
|
||||
return (
|
||||
<div
|
||||
|
|
|
|||
|
|
@ -141,7 +141,7 @@ const GetAutomaticRes: FC<IGetAutomaticResProps> = ({
|
|||
const [editorKey, setEditorKey] = useState(`${flowId}-0`)
|
||||
const handleChooseTemplate = useCallback((key: string) => {
|
||||
return () => {
|
||||
const template = t(`appDebug.generate.template.${key}.instruction`)
|
||||
const template = t(`appDebug.generate.template.${key}.instruction` as any) as string
|
||||
setInstruction(template)
|
||||
setEditorKey(`${flowId}-${Date.now()}`)
|
||||
}
|
||||
|
|
@ -322,7 +322,7 @@ const GetAutomaticRes: FC<IGetAutomaticResProps> = ({
|
|||
<TryLabel
|
||||
key={item.key}
|
||||
Icon={item.icon}
|
||||
text={t(`appDebug.generate.template.${item.key}.name`)}
|
||||
text={t(`appDebug.generate.template.${item.key}.name` as any) as string}
|
||||
onClick={handleChooseTemplate(item.key)}
|
||||
/>
|
||||
))}
|
||||
|
|
|
|||
|
|
@ -295,7 +295,7 @@ const SettingsModal: FC<SettingsModalProps> = ({
|
|||
isExternal
|
||||
rowClass={rowClass}
|
||||
labelClass={labelClass}
|
||||
t={t}
|
||||
t={t as any}
|
||||
topK={topK}
|
||||
scoreThreshold={scoreThreshold}
|
||||
scoreThresholdEnabled={scoreThresholdEnabled}
|
||||
|
|
@ -308,7 +308,7 @@ const SettingsModal: FC<SettingsModalProps> = ({
|
|||
isExternal={false}
|
||||
rowClass={rowClass}
|
||||
labelClass={labelClass}
|
||||
t={t}
|
||||
t={t as any}
|
||||
indexMethod={indexMethod}
|
||||
retrievalConfig={retrievalConfig}
|
||||
showMultiModalTip={showMultiModalTip}
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@ const Filter: FC<IFilterProps> = ({ isChatMode, appId, queryParams, setQueryPara
|
|||
setQueryParams({ ...queryParams, period: item.value })
|
||||
}}
|
||||
onClear={() => setQueryParams({ ...queryParams, period: '9' })}
|
||||
items={Object.entries(TIME_PERIOD_MAPPING).map(([k, v]) => ({ value: k, name: t(`appLog.filter.period.${v.name}`) }))}
|
||||
items={Object.entries(TIME_PERIOD_MAPPING).map(([k, v]) => ({ value: k, name: t(`appLog.filter.period.${v.name}` as any) as string }))}
|
||||
/>
|
||||
<Chip
|
||||
className="min-w-[150px]"
|
||||
|
|
|
|||
|
|
@ -55,7 +55,7 @@ const Filter: FC<IFilterProps> = ({ queryParams, setQueryParams }: IFilterProps)
|
|||
setQueryParams({ ...queryParams, period: item.value })
|
||||
}}
|
||||
onClear={() => setQueryParams({ ...queryParams, period: '9' })}
|
||||
items={Object.entries(TIME_PERIOD_MAPPING).map(([k, v]) => ({ value: k, name: t(`appLog.filter.period.${v.name}`) }))}
|
||||
items={Object.entries(TIME_PERIOD_MAPPING).map(([k, v]) => ({ value: k, name: t(`appLog.filter.period.${v.name}` as any) as string }))}
|
||||
/>
|
||||
<Input
|
||||
wrapperClassName="w-[200px]"
|
||||
|
|
|
|||
|
|
@ -94,7 +94,7 @@ const BlockInput: FC<IBlockInputProps> = ({
|
|||
if (!isValid) {
|
||||
Toast.notify({
|
||||
type: 'error',
|
||||
message: t(`appDebug.varKeyError.${errorMessageKey}`, { key: errorKey }),
|
||||
message: t(`appDebug.varKeyError.${errorMessageKey}` as any, { key: errorKey }) as string,
|
||||
})
|
||||
return
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ import type {
|
|||
ChatItem,
|
||||
Feedback,
|
||||
} from '../types'
|
||||
import type { Locale } from '@/i18n-config'
|
||||
import type {
|
||||
// AppData,
|
||||
ConversationItem,
|
||||
|
|
@ -93,7 +94,7 @@ export const useEmbeddedChatbot = () => {
|
|||
|
||||
if (localeParam) {
|
||||
// If locale parameter exists in URL, use it instead of default
|
||||
await changeLanguage(localeParam)
|
||||
await changeLanguage(localeParam as Locale)
|
||||
}
|
||||
else if (localeFromSysVar) {
|
||||
// If locale is set as a system variable, use that
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ const YEAR_RANGE = 100
|
|||
|
||||
export const useDaysOfWeek = () => {
|
||||
const { t } = useTranslation()
|
||||
const daysOfWeek = ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'].map(day => t(`time.daysInWeek.${day}`))
|
||||
const daysOfWeek = ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'].map(day => t(`time.daysInWeek.${day}` as any) as string)
|
||||
|
||||
return daysOfWeek
|
||||
}
|
||||
|
|
@ -26,7 +26,7 @@ export const useMonths = () => {
|
|||
'October',
|
||||
'November',
|
||||
'December',
|
||||
].map(month => t(`time.months.${month}`))
|
||||
].map(month => t(`time.months.${month}` as any) as string)
|
||||
|
||||
return months
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ export const EncryptedBottom = (props: Props) => {
|
|||
return (
|
||||
<div className={cn('system-xs-regular flex items-center justify-center rounded-b-2xl border-t-[0.5px] border-divider-subtle bg-background-soft px-2 py-3 text-text-tertiary', className)}>
|
||||
<RiLock2Fill className="mx-1 h-3 w-3 text-text-quaternary" />
|
||||
{t(frontTextKey || 'common.provider.encrypted.front')}
|
||||
{t((frontTextKey || 'common.provider.encrypted.front') as any) as string}
|
||||
<Link
|
||||
className="mx-1 text-text-accent"
|
||||
target="_blank"
|
||||
|
|
@ -25,7 +25,7 @@ export const EncryptedBottom = (props: Props) => {
|
|||
>
|
||||
PKCS1_OAEP
|
||||
</Link>
|
||||
{t(backTextKey || 'common.provider.encrypted.back')}
|
||||
{t((backTextKey || 'common.provider.encrypted.back') as any) as string}
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -97,7 +97,7 @@ const VoiceParamConfig = ({
|
|||
className="h-full w-full cursor-pointer rounded-lg border-0 bg-components-input-bg-normal py-1.5 pl-3 pr-10 focus-visible:bg-state-base-hover focus-visible:outline-none group-hover:bg-state-base-hover sm:text-sm sm:leading-6"
|
||||
>
|
||||
<span className={cn('block truncate text-left text-text-secondary', !languageItem?.name && 'text-text-tertiary')}>
|
||||
{languageItem?.name ? t(`common.voice.language.${languageItem?.value.replace('-', '')}`) : localLanguagePlaceholder}
|
||||
{languageItem?.name ? t(`common.voice.language.${languageItem?.value.replace('-', '')}` as any) as string : localLanguagePlaceholder}
|
||||
</span>
|
||||
<span className="pointer-events-none absolute inset-y-0 right-0 flex items-center pr-2">
|
||||
<ChevronDownIcon
|
||||
|
|
@ -128,7 +128,7 @@ const VoiceParamConfig = ({
|
|||
<span
|
||||
className={cn('block', selected && 'font-normal')}
|
||||
>
|
||||
{t(`common.voice.language.${(item.value).toString().replace('-', '')}`)}
|
||||
{t(`common.voice.language.${(item.value).toString().replace('-', '')}` as any) as string}
|
||||
</span>
|
||||
{(selected || item.value === text2speech?.language) && (
|
||||
<span
|
||||
|
|
|
|||
|
|
@ -174,7 +174,7 @@ export const useFile = (fileConfig: FileUpload, noNeedToCheckEnable = true) => {
|
|||
handleUpdateFile({ ...uploadingFile, uploadedId: res.id, progress: 100 })
|
||||
},
|
||||
onErrorCallback: (error?: any) => {
|
||||
const errorMessage = getFileUploadErrorMessage(error, t('common.fileUploader.uploadFromComputerUploadError'), t)
|
||||
const errorMessage = getFileUploadErrorMessage(error, t('common.fileUploader.uploadFromComputerUploadError'), t as any)
|
||||
notify({ type: 'error', message: errorMessage })
|
||||
handleUpdateFile({ ...uploadingFile, progress: -1 })
|
||||
},
|
||||
|
|
@ -287,7 +287,7 @@ export const useFile = (fileConfig: FileUpload, noNeedToCheckEnable = true) => {
|
|||
handleUpdateFile({ ...uploadingFile, uploadedId: res.id, progress: 100 })
|
||||
},
|
||||
onErrorCallback: (error?: any) => {
|
||||
const errorMessage = getFileUploadErrorMessage(error, t('common.fileUploader.uploadFromComputerUploadError'), t)
|
||||
const errorMessage = getFileUploadErrorMessage(error, t('common.fileUploader.uploadFromComputerUploadError'), t as any)
|
||||
notify({ type: 'error', message: errorMessage })
|
||||
handleUpdateFile({ ...uploadingFile, progress: -1 })
|
||||
},
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@ export const useInputTypeOptions = (supportFile: boolean) => {
|
|||
return options.map((value) => {
|
||||
return {
|
||||
value,
|
||||
label: t(`appDebug.variableConfig.${i18nFileTypeMap[value] || value}`),
|
||||
label: t(`appDebug.variableConfig.${i18nFileTypeMap[value] || value}` as any),
|
||||
Icon: INPUT_TYPE_ICON[value],
|
||||
type: DATA_TYPE[value],
|
||||
}
|
||||
|
|
|
|||
|
|
@ -82,7 +82,7 @@ export const useImageFiles = () => {
|
|||
setFiles(newFiles)
|
||||
},
|
||||
onErrorCallback: (error?: any) => {
|
||||
const errorMessage = getImageUploadErrorMessage(error, t('common.imageUploader.uploadFromComputerUploadError'), t)
|
||||
const errorMessage = getImageUploadErrorMessage(error, t('common.imageUploader.uploadFromComputerUploadError'), t as any)
|
||||
notify({ type: 'error', message: errorMessage })
|
||||
const newFiles = [...files.slice(0, index), { ...currentImageFile, progress: -1 }, ...files.slice(index + 1)]
|
||||
filesRef.current = newFiles
|
||||
|
|
@ -160,7 +160,7 @@ export const useLocalFileUploader = ({ limit, disabled = false, onUpload }: useL
|
|||
onUpload({ ...imageFile, fileId: res.id, progress: 100 })
|
||||
},
|
||||
onErrorCallback: (error?: any) => {
|
||||
const errorMessage = getImageUploadErrorMessage(error, t('common.imageUploader.uploadFromComputerUploadError'), t)
|
||||
const errorMessage = getImageUploadErrorMessage(error, t('common.imageUploader.uploadFromComputerUploadError'), t as any)
|
||||
notify({ type: 'error', message: errorMessage })
|
||||
onUpload({ ...imageFile, progress: -1 })
|
||||
},
|
||||
|
|
|
|||
|
|
@ -127,7 +127,7 @@ const TagInput: FC<TagInputProps> = ({
|
|||
setValue(e.target.value)
|
||||
}}
|
||||
onKeyDown={handleKeyDown}
|
||||
placeholder={t(placeholder || (isSpecialMode ? 'common.model.params.stop_sequencesPlaceholder' : 'datasetDocuments.segment.addKeyWord'))}
|
||||
placeholder={t((placeholder || (isSpecialMode ? 'common.model.params.stop_sequencesPlaceholder' : 'datasetDocuments.segment.addKeyWord')) as any)}
|
||||
/>
|
||||
</div>
|
||||
)
|
||||
|
|
|
|||
|
|
@ -106,7 +106,7 @@ const CloudPlanItem: FC<CloudPlanItemProps> = ({
|
|||
{ICON_MAP[plan]}
|
||||
<div className="flex min-h-[104px] flex-col gap-y-2">
|
||||
<div className="flex items-center gap-x-2.5">
|
||||
<div className="text-[30px] font-medium leading-[1.2] text-text-primary">{t(`${i18nPrefix}.name`)}</div>
|
||||
<div className="text-[30px] font-medium leading-[1.2] text-text-primary">{t(`${i18nPrefix}.name` as any) as string}</div>
|
||||
{
|
||||
isMostPopularPlan && (
|
||||
<div className="flex items-center justify-center bg-saas-dify-blue-static px-1.5 py-1">
|
||||
|
|
@ -117,7 +117,7 @@ const CloudPlanItem: FC<CloudPlanItemProps> = ({
|
|||
)
|
||||
}
|
||||
</div>
|
||||
<div className="system-sm-regular text-text-secondary">{t(`${i18nPrefix}.description`)}</div>
|
||||
<div className="system-sm-regular text-text-secondary">{t(`${i18nPrefix}.description` as any) as string}</div>
|
||||
</div>
|
||||
</div>
|
||||
{/* Price */}
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ const Button = ({
|
|||
onClick={handleGetPayUrl}
|
||||
>
|
||||
<div className="flex grow items-center gap-x-2">
|
||||
<span>{t(`${i18nPrefix}.btnText`)}</span>
|
||||
<span>{t(`${i18nPrefix}.btnText` as any) as string}</span>
|
||||
{isPremiumPlan && (
|
||||
<span className="pb-px pt-[7px]">
|
||||
<AwsMarketplace className="h-6" />
|
||||
|
|
|
|||
|
|
@ -85,16 +85,16 @@ const SelfHostedPlanItem: FC<SelfHostedPlanItemProps> = ({
|
|||
<div className=" flex flex-col gap-y-6 px-1 pt-10">
|
||||
{STYLE_MAP[plan].icon}
|
||||
<div className="flex min-h-[104px] flex-col gap-y-2">
|
||||
<div className="text-[30px] font-medium leading-[1.2] text-text-primary">{t(`${i18nPrefix}.name`)}</div>
|
||||
<div className="system-md-regular line-clamp-2 text-text-secondary">{t(`${i18nPrefix}.description`)}</div>
|
||||
<div className="text-[30px] font-medium leading-[1.2] text-text-primary">{t(`${i18nPrefix}.name` as any) as string}</div>
|
||||
<div className="system-md-regular line-clamp-2 text-text-secondary">{t(`${i18nPrefix}.description` as any) as string}</div>
|
||||
</div>
|
||||
</div>
|
||||
{/* Price */}
|
||||
<div className="flex items-end gap-x-2 px-1 pb-8 pt-4">
|
||||
<div className="title-4xl-semi-bold shrink-0 text-text-primary">{t(`${i18nPrefix}.price`)}</div>
|
||||
<div className="title-4xl-semi-bold shrink-0 text-text-primary">{t(`${i18nPrefix}.price` as any) as string}</div>
|
||||
{!isFreePlan && (
|
||||
<span className="system-md-regular pb-0.5 text-text-tertiary">
|
||||
{t(`${i18nPrefix}.priceTip`)}
|
||||
{t(`${i18nPrefix}.priceTip` as any) as string}
|
||||
</span>
|
||||
)}
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -12,13 +12,13 @@ const List = ({
|
|||
}: ListProps) => {
|
||||
const { t } = useTranslation()
|
||||
const i18nPrefix = `billing.plans.${plan}`
|
||||
const features = t(`${i18nPrefix}.features`, { returnObjects: true }) as string[]
|
||||
const features = t(`${i18nPrefix}.features` as any, { returnObjects: true }) as unknown as string[]
|
||||
|
||||
return (
|
||||
<div className="flex flex-col gap-y-[10px] p-6">
|
||||
<div className="system-md-semibold text-text-secondary">
|
||||
<Trans
|
||||
i18nKey={t(`${i18nPrefix}.includesTitle`)}
|
||||
i18nKey={t(`${i18nPrefix}.includesTitle` as any) as string}
|
||||
components={{ highlight: <span className="text-text-warning"></span> }}
|
||||
/>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ const PriorityLabel = ({ className }: PriorityLabelProps) => {
|
|||
return (
|
||||
<Tooltip popupContent={(
|
||||
<div>
|
||||
<div className="mb-1 text-xs font-semibold text-text-primary">{`${t('billing.plansCommon.documentProcessingPriority')}: ${t(`billing.plansCommon.priority.${priority}`)}`}</div>
|
||||
<div className="mb-1 text-xs font-semibold text-text-primary">{`${t('billing.plansCommon.documentProcessingPriority')}: ${t(`billing.plansCommon.priority.${priority}` as any) as string}`}</div>
|
||||
{
|
||||
priority !== DocumentProcessingPriority.topPriority && (
|
||||
<div className="text-xs text-text-secondary">{t('billing.plansCommon.documentProcessingPriorityTip')}</div>
|
||||
|
|
@ -51,7 +51,7 @@ const PriorityLabel = ({ className }: PriorityLabelProps) => {
|
|||
<RiAedFill className="mr-0.5 size-3" />
|
||||
)
|
||||
}
|
||||
<span>{t(`billing.plansCommon.priority.${priority}`)}</span>
|
||||
<span>{t(`billing.plansCommon.priority.${priority}` as any) as string}</span>
|
||||
</div>
|
||||
</Tooltip>
|
||||
)
|
||||
|
|
|
|||
|
|
@ -46,8 +46,8 @@ const UpgradeBtn: FC<Props> = ({
|
|||
}
|
||||
}
|
||||
|
||||
const defaultBadgeLabel = t(`billing.upgradeBtn.${isShort ? 'encourageShort' : 'encourage'}`)
|
||||
const label = labelKey ? t(labelKey) : defaultBadgeLabel
|
||||
const defaultBadgeLabel = t(`billing.upgradeBtn.${isShort ? 'encourageShort' : 'encourage'}` as any) as string
|
||||
const label = labelKey ? t(labelKey as any) as string : defaultBadgeLabel
|
||||
|
||||
if (isPlain) {
|
||||
return (
|
||||
|
|
@ -56,7 +56,7 @@ const UpgradeBtn: FC<Props> = ({
|
|||
style={style}
|
||||
onClick={onClick}
|
||||
>
|
||||
{labelKey ? label : t('billing.upgradeBtn.plain')}
|
||||
{labelKey ? label : t('billing.upgradeBtn.plain' as any) as string}
|
||||
</Button>
|
||||
)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -68,7 +68,7 @@ const CustomWebAppBrand = () => {
|
|||
setFileId(res.id)
|
||||
},
|
||||
onErrorCallback: (error?: any) => {
|
||||
const errorMessage = getImageUploadErrorMessage(error, t('common.imageUploader.uploadFromComputerUploadError'), t)
|
||||
const errorMessage = getImageUploadErrorMessage(error, t('common.imageUploader.uploadFromComputerUploadError'), t as any)
|
||||
notify({ type: 'error', message: errorMessage })
|
||||
setUploadProgress(-1)
|
||||
},
|
||||
|
|
|
|||
|
|
@ -145,7 +145,7 @@ export const useUpload = () => {
|
|||
handleUpdateFile({ ...uploadingFile, uploadedId: res.id, progress: 100 })
|
||||
},
|
||||
onErrorCallback: (error?: any) => {
|
||||
const errorMessage = getFileUploadErrorMessage(error, t('common.fileUploader.uploadFromComputerUploadError'), t)
|
||||
const errorMessage = getFileUploadErrorMessage(error, t('common.fileUploader.uploadFromComputerUploadError'), t as any)
|
||||
Toast.notify({ type: 'error', message: errorMessage })
|
||||
handleUpdateFile({ ...uploadingFile, progress: -1 })
|
||||
},
|
||||
|
|
@ -187,7 +187,7 @@ export const useUpload = () => {
|
|||
})
|
||||
},
|
||||
onErrorCallback: (error?: any) => {
|
||||
const errorMessage = getFileUploadErrorMessage(error, t('common.fileUploader.uploadFromComputerUploadError'), t)
|
||||
const errorMessage = getFileUploadErrorMessage(error, t('common.fileUploader.uploadFromComputerUploadError'), t as any)
|
||||
Toast.notify({ type: 'error', message: errorMessage })
|
||||
handleUpdateFile({ ...uploadingFile, progress: -1 })
|
||||
},
|
||||
|
|
|
|||
|
|
@ -33,8 +33,8 @@ const EconomicalRetrievalMethodConfig: FC<Props> = ({
|
|||
<div className="space-y-2">
|
||||
<RadioCard
|
||||
icon={icon}
|
||||
title={t(`dataset.retrieval.${type}.title`)}
|
||||
description={t(`dataset.retrieval.${type}.description`)}
|
||||
title={t(`dataset.retrieval.${type}.title` as any) as string}
|
||||
description={t(`dataset.retrieval.${type}.description` as any) as string}
|
||||
noRadio
|
||||
chosenConfigWrapClassName="!pb-3"
|
||||
chosenConfig={(
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@ const Content = ({
|
|||
{name}
|
||||
</div>
|
||||
<div className="system-2xs-medium-uppercase text-text-tertiary">
|
||||
{t(`dataset.chunkingMode.${DOC_FORM_TEXT[chunkStructure]}`)}
|
||||
{t(`dataset.chunkingMode.${DOC_FORM_TEXT[chunkStructure]}` as any) as string}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -141,7 +141,7 @@ const RuleDetail: FC<{
|
|||
<FieldInfo
|
||||
label={t('datasetSettings.form.retrievalSetting.title')}
|
||||
// displayedValue={t(`datasetSettings.form.retrievalSetting.${retrievalMethod}`) as string}
|
||||
displayedValue={t(`dataset.retrieval.${indexingType === IndexingType.ECONOMICAL ? 'keyword_search' : retrievalMethod}.title`) as string}
|
||||
displayedValue={t(`dataset.retrieval.${indexingType === IndexingType.ECONOMICAL ? 'keyword_search' : retrievalMethod}.title` as any) as string}
|
||||
valueIcon={(
|
||||
<Image
|
||||
className="size-4"
|
||||
|
|
|
|||
|
|
@ -132,7 +132,7 @@ const FileUploader = ({
|
|||
return Promise.resolve({ ...completeFile })
|
||||
})
|
||||
.catch((e) => {
|
||||
const errorMessage = getFileUploadErrorMessage(e, t('datasetCreation.stepOne.uploader.failed'), t)
|
||||
const errorMessage = getFileUploadErrorMessage(e, t('datasetCreation.stepOne.uploader.failed'), t as any)
|
||||
notify({ type: 'error', message: errorMessage })
|
||||
onFileUpdate(fileItem, -2, fileListRef.current)
|
||||
return Promise.resolve({ ...fileItem })
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@ export const TopBar: FC<TopBarProps> = (props) => {
|
|||
<div className="absolute left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2">
|
||||
<Stepper
|
||||
steps={Array.from({ length: 3 }, (_, i) => ({
|
||||
name: t(STEP_T_MAP[i + 1]),
|
||||
name: t(STEP_T_MAP[i + 1] as any) as string,
|
||||
}))}
|
||||
{...rest}
|
||||
/>
|
||||
|
|
|
|||
|
|
@ -155,7 +155,7 @@ const LocalFile = ({
|
|||
return Promise.resolve({ ...completeFile })
|
||||
})
|
||||
.catch((e) => {
|
||||
const errorMessage = getFileUploadErrorMessage(e, t('datasetCreation.stepOne.uploader.failed'), t)
|
||||
const errorMessage = getFileUploadErrorMessage(e, t('datasetCreation.stepOne.uploader.failed'), t as any)
|
||||
notify({ type: 'error', message: errorMessage })
|
||||
updateFile(fileItem, -2, fileListRef.current)
|
||||
return Promise.resolve({ ...fileItem })
|
||||
|
|
|
|||
|
|
@ -63,7 +63,7 @@ const RuleDetail = ({
|
|||
/>
|
||||
<FieldInfo
|
||||
label={t('datasetSettings.form.retrievalSetting.title')}
|
||||
displayedValue={t(`dataset.retrieval.${indexingType === IndexingType.ECONOMICAL ? 'keyword_search' : retrievalMethod}.title`) as string}
|
||||
displayedValue={t(`dataset.retrieval.${indexingType === IndexingType.ECONOMICAL ? 'keyword_search' : retrievalMethod}.title` as any) as string}
|
||||
valueIcon={(
|
||||
<Image
|
||||
className="size-4"
|
||||
|
|
|
|||
|
|
@ -75,7 +75,7 @@ const CSVUploader: FC<Props> = ({
|
|||
return Promise.resolve({ ...completeFile })
|
||||
})
|
||||
.catch((e) => {
|
||||
const errorMessage = getFileUploadErrorMessage(e, t('datasetCreation.stepOne.uploader.failed'), t)
|
||||
const errorMessage = getFileUploadErrorMessage(e, t('datasetCreation.stepOne.uploader.failed'), t as any)
|
||||
notify({ type: 'error', message: errorMessage })
|
||||
const errorFile = {
|
||||
...fileItem,
|
||||
|
|
|
|||
|
|
@ -133,7 +133,7 @@ const RuleDetail: FC<IRuleDetailProps> = React.memo(({
|
|||
/>
|
||||
<FieldInfo
|
||||
label={t('datasetSettings.form.retrievalSetting.title')}
|
||||
displayedValue={t(`dataset.retrieval.${indexingType === IndexingType.ECONOMICAL ? 'keyword_search' : retrievalMethod}.title`) as string}
|
||||
displayedValue={t(`dataset.retrieval.${indexingType === IndexingType.ECONOMICAL ? 'keyword_search' : retrievalMethod}.title` as any) as string}
|
||||
valueIcon={(
|
||||
<Image
|
||||
className="size-4"
|
||||
|
|
|
|||
|
|
@ -228,7 +228,7 @@ const QueryInput = ({
|
|||
className="flex h-7 cursor-pointer items-center space-x-0.5 rounded-lg border-[0.5px] border-components-button-secondary-bg bg-components-button-secondary-bg px-1.5 shadow-xs backdrop-blur-[5px] hover:bg-components-button-secondary-bg-hover"
|
||||
>
|
||||
{icon}
|
||||
<div className="text-xs font-medium uppercase text-text-secondary">{t(`dataset.retrieval.${retrievalMethod}.title`)}</div>
|
||||
<div className="text-xs font-medium uppercase text-text-secondary">{t(`dataset.retrieval.${retrievalMethod}.title` as any) as string}</div>
|
||||
<RiEqualizer2Line className="size-4 text-components-menu-item-text"></RiEqualizer2Line>
|
||||
</div>
|
||||
)}
|
||||
|
|
|
|||
|
|
@ -217,17 +217,17 @@ const DatasetCard = ({
|
|||
{dataset.doc_form && (
|
||||
<span
|
||||
className="min-w-0 max-w-full truncate"
|
||||
title={t(`dataset.chunkingMode.${DOC_FORM_TEXT[dataset.doc_form]}`)}
|
||||
title={t(`dataset.chunkingMode.${DOC_FORM_TEXT[dataset.doc_form]}` as any) as string}
|
||||
>
|
||||
{t(`dataset.chunkingMode.${DOC_FORM_TEXT[dataset.doc_form]}`)}
|
||||
{t(`dataset.chunkingMode.${DOC_FORM_TEXT[dataset.doc_form]}` as any) as string}
|
||||
</span>
|
||||
)}
|
||||
{dataset.indexing_technique && (
|
||||
<span
|
||||
className="min-w-0 max-w-full truncate"
|
||||
title={formatIndexingTechniqueAndMethod(dataset.indexing_technique, dataset.retrieval_model_dict?.search_method)}
|
||||
title={formatIndexingTechniqueAndMethod(dataset.indexing_technique, dataset.retrieval_model_dict?.search_method) as any}
|
||||
>
|
||||
{formatIndexingTechniqueAndMethod(dataset.indexing_technique, dataset.retrieval_model_dict?.search_method)}
|
||||
{formatIndexingTechniqueAndMethod(dataset.indexing_technique, dataset.retrieval_model_dict?.search_method) as any}
|
||||
</span>
|
||||
)}
|
||||
{dataset.is_multimodal && (
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@ const Category: FC<ICategoryProps> = ({
|
|||
className={itemClassName(name === value)}
|
||||
onClick={() => onChange(name)}
|
||||
>
|
||||
{(categoryI18n as any)[name] ? t(`explore.category.${name}`) : name}
|
||||
{(categoryI18n as any)[name] ? t(`explore.category.${name}` as any) as string : name}
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -36,13 +36,13 @@ const buildThemeCommands = (query: string, locale?: string): CommandSearchResult
|
|||
const q = query.toLowerCase()
|
||||
const list = THEME_ITEMS.filter(item =>
|
||||
!q
|
||||
|| i18n.t(item.titleKey, { lng: locale }).toLowerCase().includes(q)
|
||||
|| i18n.t(item.titleKey as any, { lng: locale }).toLowerCase().includes(q)
|
||||
|| item.id.includes(q),
|
||||
)
|
||||
return list.map(item => ({
|
||||
id: item.id,
|
||||
title: i18n.t(item.titleKey, { lng: locale }),
|
||||
description: i18n.t(item.descKey, { lng: locale }),
|
||||
title: i18n.t(item.titleKey as any, { lng: locale }),
|
||||
description: i18n.t(item.descKey as any, { lng: locale }),
|
||||
type: 'command' as const,
|
||||
icon: (
|
||||
<div className="flex h-6 w-6 items-center justify-center rounded-md border-[0.5px] border-divider-regular bg-components-panel-bg">
|
||||
|
|
|
|||
|
|
@ -117,7 +117,7 @@ const CommandSelector: FC<Props> = ({ actions, onCommandSelect, searchFilter, co
|
|||
'/community': 'app.gotoAnything.actions.communityDesc',
|
||||
'/zen': 'app.gotoAnything.actions.zenDesc',
|
||||
}
|
||||
return t(slashKeyMap[item.key] || item.description)
|
||||
return t((slashKeyMap[item.key] || item.description) as any)
|
||||
})()
|
||||
)
|
||||
: (
|
||||
|
|
@ -128,7 +128,7 @@ const CommandSelector: FC<Props> = ({ actions, onCommandSelect, searchFilter, co
|
|||
'@knowledge': 'app.gotoAnything.actions.searchKnowledgeBasesDesc',
|
||||
'@node': 'app.gotoAnything.actions.searchWorkflowNodesDesc',
|
||||
}
|
||||
return t(keyMap[item.key])
|
||||
return t(keyMap[item.key] as any) as string
|
||||
})()
|
||||
)}
|
||||
</span>
|
||||
|
|
|
|||
|
|
@ -243,7 +243,7 @@ const GotoAnything: FC<Props> = ({
|
|||
knowledge: 'app.gotoAnything.emptyState.noKnowledgeBasesFound',
|
||||
node: 'app.gotoAnything.emptyState.noWorkflowNodesFound',
|
||||
}
|
||||
return t(keyMap[commandType] || 'app.gotoAnything.noResults')
|
||||
return t((keyMap[commandType] || 'app.gotoAnything.noResults') as any)
|
||||
})()
|
||||
: t('app.gotoAnything.noResults')}
|
||||
</div>
|
||||
|
|
@ -410,7 +410,7 @@ const GotoAnything: FC<Props> = ({
|
|||
'workflow-node': 'app.gotoAnything.groups.workflowNodes',
|
||||
'command': 'app.gotoAnything.groups.commands',
|
||||
}
|
||||
return t(typeMap[type] || `${type}s`)
|
||||
return t((typeMap[type] || `${type}s`) as any)
|
||||
})()}
|
||||
className="p-2 capitalize text-text-secondary"
|
||||
>
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
'use client'
|
||||
|
||||
import type { Item } from '@/app/components/base/select'
|
||||
import type { Locale } from '@/i18n-config'
|
||||
import { useState } from 'react'
|
||||
import { useTranslation } from 'react-i18next'
|
||||
import { useContext } from 'use-context-selector'
|
||||
|
|
@ -32,7 +33,7 @@ export default function LanguagePage() {
|
|||
await updateUserProfile({ url, body: { [bodyKey]: item.value } })
|
||||
notify({ type: 'success', message: t('common.actionMsg.modifiedSuccessfully') })
|
||||
|
||||
setLocaleOnClient(item.value.toString())
|
||||
setLocaleOnClient(item.value.toString() as Locale)
|
||||
}
|
||||
catch (e) {
|
||||
notify({ type: 'error', message: (e as Error).message })
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ const RoleSelector = ({ value, onChange }: RoleSelectorProps) => {
|
|||
className="block"
|
||||
>
|
||||
<div className={cn('flex cursor-pointer items-center rounded-lg bg-components-input-bg-normal px-3 py-2 hover:bg-state-base-hover', open && 'bg-state-base-hover')}>
|
||||
<div className="mr-2 grow text-sm leading-5 text-text-primary">{t('common.members.invitedAsRole', { role: t(`common.members.${toHump(value)}`) })}</div>
|
||||
<div className="mr-2 grow text-sm leading-5 text-text-primary">{t('common.members.invitedAsRole', { role: t(`common.members.${toHump(value)}` as any) })}</div>
|
||||
<RiArrowDownSLine className="h-4 w-4 shrink-0 text-text-secondary" />
|
||||
</div>
|
||||
</PortalToFollowElemTrigger>
|
||||
|
|
|
|||
|
|
@ -106,8 +106,8 @@ const Operation = ({
|
|||
: <div className="mr-1 mt-[2px] h-4 w-4 text-text-accent" />
|
||||
}
|
||||
<div>
|
||||
<div className="system-sm-semibold whitespace-nowrap text-text-secondary">{t(`common.members.${toHump(role)}`)}</div>
|
||||
<div className="system-xs-regular whitespace-nowrap text-text-tertiary">{t(`common.members.${toHump(role)}Tip`)}</div>
|
||||
<div className="system-sm-semibold whitespace-nowrap text-text-secondary">{t(`common.members.${toHump(role)}` as any)}</div>
|
||||
<div className="system-xs-regular whitespace-nowrap text-text-tertiary">{t(`common.members.${toHump(role)}Tip` as any)}</div>
|
||||
</div>
|
||||
</div>
|
||||
</MenuItem>
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@ const PresetsParameter: FC<PresetsParameterProps> = ({
|
|||
text: (
|
||||
<div className="flex h-full items-center">
|
||||
{getToneIcon(tone.id)}
|
||||
{t(`common.model.tone.${tone.name}`) as string}
|
||||
{t(`common.model.tone.${tone.name}` as any) as string}
|
||||
</div>
|
||||
),
|
||||
}
|
||||
|
|
|
|||
|
|
@ -82,7 +82,7 @@ const DeprecationNotice: FC<DeprecationNoticeProps> = ({
|
|||
),
|
||||
}}
|
||||
values={{
|
||||
deprecatedReason: t(`${i18nPrefix}.reason.${deprecatedReasonKey}`),
|
||||
deprecatedReason: t(`${i18nPrefix}.reason.${deprecatedReasonKey}` as any) as string,
|
||||
alternativePluginId,
|
||||
}}
|
||||
/>
|
||||
|
|
@ -91,7 +91,7 @@ const DeprecationNotice: FC<DeprecationNoticeProps> = ({
|
|||
{
|
||||
hasValidDeprecatedReason && !alternativePluginId && (
|
||||
<span>
|
||||
{t(`${i18nPrefix}.onlyReason`, { deprecatedReason: t(`${i18nPrefix}.reason.${deprecatedReasonKey}`) })}
|
||||
{t(`${i18nPrefix}.onlyReason` as any, { deprecatedReason: t(`${i18nPrefix}.reason.${deprecatedReasonKey}` as any) as string }) as string}
|
||||
</span>
|
||||
)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,11 +1,14 @@
|
|||
'use client'
|
||||
import type { Plugin } from '../types'
|
||||
import type { Locale } from '@/i18n-config'
|
||||
import { RiAlertFill } from '@remixicon/react'
|
||||
import * as React from 'react'
|
||||
import { useMixedTranslation } from '@/app/components/plugins/marketplace/hooks'
|
||||
import { useGetLanguage } from '@/context/i18n'
|
||||
import useTheme from '@/hooks/use-theme'
|
||||
import { renderI18nObject } from '@/i18n-config'
|
||||
import {
|
||||
renderI18nObject,
|
||||
} from '@/i18n-config'
|
||||
import { getLanguage } from '@/i18n-config/language'
|
||||
import { Theme } from '@/types/app'
|
||||
import { cn } from '@/utils/classnames'
|
||||
|
|
@ -30,7 +33,7 @@ export type Props = {
|
|||
footer?: React.ReactNode
|
||||
isLoading?: boolean
|
||||
loadingFileName?: string
|
||||
locale?: string
|
||||
locale?: Locale
|
||||
limitedInstall?: boolean
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ export const useTags = (translateFromOut?: TFunction) => {
|
|||
return tagKeys.map((tag) => {
|
||||
return {
|
||||
name: tag,
|
||||
label: t(`pluginTags.tags.${tag}`),
|
||||
label: t(`pluginTags.tags.${tag}` as any) as string,
|
||||
}
|
||||
})
|
||||
}, [t])
|
||||
|
|
@ -66,14 +66,14 @@ export const useCategories = (translateFromOut?: TFunction, isSingle?: boolean)
|
|||
}
|
||||
return {
|
||||
name: category,
|
||||
label: isSingle ? t(`plugin.categorySingle.${category}`) : t(`plugin.category.${category}s`),
|
||||
label: isSingle ? t(`plugin.categorySingle.${category}` as any) as string : t(`plugin.category.${category}s` as any) as string,
|
||||
}
|
||||
})
|
||||
}, [t, isSingle])
|
||||
|
||||
const categoriesMap = useMemo(() => {
|
||||
return categories.reduce((acc, category) => {
|
||||
acc[category.name] = category
|
||||
acc[category.name] = category as any
|
||||
return acc
|
||||
}, {} as Record<string, Category>)
|
||||
}, [categories])
|
||||
|
|
|
|||
|
|
@ -1,10 +1,11 @@
|
|||
import type { Locale } from '@/i18n-config'
|
||||
import {
|
||||
getLocaleOnServer,
|
||||
useTranslation as translate,
|
||||
getTranslation as translate,
|
||||
} from '@/i18n-config/server'
|
||||
|
||||
type DescriptionProps = {
|
||||
locale?: string
|
||||
locale?: Locale
|
||||
}
|
||||
const Description = async ({
|
||||
locale: localeFromProps,
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
import type { MarketplaceCollection, SearchParams } from './types'
|
||||
import type { Plugin } from '@/app/components/plugins/types'
|
||||
import type { Locale } from '@/i18n-config'
|
||||
import { TanstackQueryInitializer } from '@/context/query-client'
|
||||
import { MarketplaceContextProvider } from './context'
|
||||
import Description from './description'
|
||||
|
|
@ -8,7 +9,7 @@ import StickySearchAndSwitchWrapper from './sticky-search-and-switch-wrapper'
|
|||
import { getMarketplaceCollectionsAndPlugins } from './utils'
|
||||
|
||||
type MarketplaceProps = {
|
||||
locale: string
|
||||
locale: Locale
|
||||
showInstallButton?: boolean
|
||||
shouldExclude?: boolean
|
||||
searchParams?: SearchParams
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
'use client'
|
||||
import type { Plugin } from '@/app/components/plugins/types'
|
||||
import type { Locale } from '@/i18n-config'
|
||||
import { RiArrowRightUpLine } from '@remixicon/react'
|
||||
import { useBoolean } from 'ahooks'
|
||||
import { useTheme } from 'next-themes'
|
||||
|
|
@ -17,7 +18,7 @@ import { getPluginDetailLinkInMarketplace, getPluginLinkInMarketplace } from '..
|
|||
type CardWrapperProps = {
|
||||
plugin: Plugin
|
||||
showInstallButton?: boolean
|
||||
locale?: string
|
||||
locale?: Locale
|
||||
}
|
||||
const CardWrapperComponent = ({
|
||||
plugin,
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
'use client'
|
||||
import type { Plugin } from '../../types'
|
||||
import type { MarketplaceCollection } from '../types'
|
||||
import type { Locale } from '@/i18n-config'
|
||||
import { cn } from '@/utils/classnames'
|
||||
import Empty from '../empty'
|
||||
import CardWrapper from './card-wrapper'
|
||||
|
|
@ -11,7 +12,7 @@ type ListProps = {
|
|||
marketplaceCollectionPluginsMap: Record<string, Plugin[]>
|
||||
plugins?: Plugin[]
|
||||
showInstallButton?: boolean
|
||||
locale: string
|
||||
locale: Locale
|
||||
cardContainerClassName?: string
|
||||
cardRender?: (plugin: Plugin) => React.JSX.Element | null
|
||||
onMoreClick?: () => void
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@
|
|||
import type { MarketplaceCollection } from '../types'
|
||||
import type { SearchParamsFromCollection } from '@/app/components/plugins/marketplace/types'
|
||||
import type { Plugin } from '@/app/components/plugins/types'
|
||||
import type { Locale } from '@/i18n-config'
|
||||
import { RiArrowRightSLine } from '@remixicon/react'
|
||||
import { useMixedTranslation } from '@/app/components/plugins/marketplace/hooks'
|
||||
import { getLanguage } from '@/i18n-config/language'
|
||||
|
|
@ -13,7 +14,7 @@ type ListWithCollectionProps = {
|
|||
marketplaceCollections: MarketplaceCollection[]
|
||||
marketplaceCollectionPluginsMap: Record<string, Plugin[]>
|
||||
showInstallButton?: boolean
|
||||
locale: string
|
||||
locale: Locale
|
||||
cardContainerClassName?: string
|
||||
cardRender?: (plugin: Plugin) => React.JSX.Element | null
|
||||
onMoreClick?: (searchParams?: SearchParamsFromCollection) => void
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
'use client'
|
||||
import type { Plugin } from '../../types'
|
||||
import type { MarketplaceCollection } from '../types'
|
||||
import type { Locale } from '@/i18n-config'
|
||||
import { useEffect } from 'react'
|
||||
import Loading from '@/app/components/base/loading'
|
||||
import { useMixedTranslation } from '@/app/components/plugins/marketplace/hooks'
|
||||
|
|
@ -12,7 +13,7 @@ type ListWrapperProps = {
|
|||
marketplaceCollections: MarketplaceCollection[]
|
||||
marketplaceCollectionPluginsMap: Record<string, Plugin[]>
|
||||
showInstallButton?: boolean
|
||||
locale: string
|
||||
locale: Locale
|
||||
}
|
||||
const ListWrapper = ({
|
||||
marketplaceCollections,
|
||||
|
|
|
|||
|
|
@ -330,7 +330,7 @@ export const CommonCreateModal = ({ onClose, createType, builder }: Props) => {
|
|||
|
||||
return (
|
||||
<Modal
|
||||
title={t(`pluginTrigger.modal.${createType === SupportedCreationMethods.APIKEY ? 'apiKey' : createType.toLowerCase()}.title`)}
|
||||
title={t(`pluginTrigger.modal.${createType === SupportedCreationMethods.APIKEY ? 'apiKey' : createType.toLowerCase()}.title` as any)}
|
||||
confirmButtonText={
|
||||
currentStep === ApiKeyStep.Verify
|
||||
? isVerifyingCredentials ? t('pluginTrigger.modal.common.verifying') : t('pluginTrigger.modal.common.verify')
|
||||
|
|
|
|||
|
|
@ -208,7 +208,7 @@ export const CreateSubscriptionButton = ({ buttonType = CreateButtonType.FULL_BU
|
|||
)
|
||||
: (
|
||||
<Tooltip
|
||||
popupContent={subscriptionCount >= MAX_COUNT ? t('pluginTrigger.subscription.maxCount', { num: MAX_COUNT }) : t(`pluginTrigger.subscription.addType.options.${methodType.toLowerCase()}.description`)}
|
||||
popupContent={subscriptionCount >= MAX_COUNT ? t('pluginTrigger.subscription.maxCount', { num: MAX_COUNT }) : t(`pluginTrigger.subscription.addType.options.${methodType.toLowerCase()}.description` as any)}
|
||||
disabled={!(supportedMethods?.length === 1 || subscriptionCount >= MAX_COUNT)}
|
||||
>
|
||||
<ActionButton
|
||||
|
|
|
|||
|
|
@ -260,9 +260,9 @@ export type Plugin = {
|
|||
icon: string
|
||||
icon_dark?: string
|
||||
verified: boolean
|
||||
label: Record<Locale, string>
|
||||
brief: Record<Locale, string>
|
||||
description: Record<Locale, string>
|
||||
label: Partial<Record<Locale, string>>
|
||||
brief: Partial<Record<Locale, string>>
|
||||
description: Partial<Record<Locale, string>>
|
||||
// Repo readme.md content
|
||||
introduction: string
|
||||
repository: string
|
||||
|
|
|
|||
|
|
@ -36,8 +36,8 @@ export const useAvailableNodesMetaData = () => {
|
|||
|
||||
const availableNodesMetaData = useMemo(() => mergedNodesMetaData.map((node) => {
|
||||
const { metaData } = node
|
||||
const title = t(`workflow.blocks.${metaData.type}`)
|
||||
const description = t(`workflow.blocksAbout.${metaData.type}`)
|
||||
const title = t(`workflow.blocks.${metaData.type}` as any) as string
|
||||
const description = t(`workflow.blocksAbout.${metaData.type}` as any) as string
|
||||
return {
|
||||
...node,
|
||||
metaData: {
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ export const usePipelineTemplate = () => {
|
|||
data: {
|
||||
...knowledgeBaseDefault.defaultValue as KnowledgeBaseNodeType,
|
||||
type: knowledgeBaseDefault.metaData.type,
|
||||
title: t(`workflow.blocks.${knowledgeBaseDefault.metaData.type}`),
|
||||
title: t(`workflow.blocks.${knowledgeBaseDefault.metaData.type}` as any) as string,
|
||||
selected: true,
|
||||
},
|
||||
position: {
|
||||
|
|
|
|||
|
|
@ -111,7 +111,7 @@ const GetSchema: FC<Props> = ({
|
|||
}}
|
||||
className="system-sm-regular cursor-pointer whitespace-nowrap rounded-lg px-3 py-1.5 leading-5 text-text-secondary hover:bg-components-panel-on-panel-item-bg-hover"
|
||||
>
|
||||
{t(`tools.createTool.exampleOptions.${item.key}`)}
|
||||
{t(`tools.createTool.exampleOptions.${item.key}` as any) as string}
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -292,7 +292,7 @@ const EditCustomCollectionModal: FC<Props> = ({
|
|||
<div>
|
||||
<div className="system-sm-medium py-2 text-text-primary">{t('tools.createTool.authMethod.title')}</div>
|
||||
<div className="flex h-9 cursor-pointer items-center justify-between rounded-lg bg-components-input-bg-normal px-2.5" onClick={() => setCredentialsModalShow(true)}>
|
||||
<div className="system-xs-regular text-text-primary">{t(`tools.createTool.authMethod.types.${credential.auth_type}`)}</div>
|
||||
<div className="system-xs-regular text-text-primary">{t(`tools.createTool.authMethod.types.${credential.auth_type}` as any) as string}</div>
|
||||
<RiSettings2Line className="h-4 w-4 text-text-secondary" />
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -78,7 +78,7 @@ const TestApi: FC<Props> = ({
|
|||
<div>
|
||||
<div className="system-sm-medium py-2 text-text-primary">{t('tools.createTool.authMethod.title')}</div>
|
||||
<div className="flex h-9 cursor-pointer items-center justify-between rounded-lg bg-components-input-bg-normal px-2.5" onClick={() => setCredentialsModalShow(true)}>
|
||||
<div className="system-xs-regular text-text-primary">{t(`tools.createTool.authMethod.types.${tempCredential.auth_type}`)}</div>
|
||||
<div className="system-xs-regular text-text-primary">{t(`tools.createTool.authMethod.types.${tempCredential.auth_type}` as any) as string}</div>
|
||||
<RiSettings2Line className="h-4 w-4 text-text-secondary" />
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -33,17 +33,17 @@ const Empty = ({
|
|||
const Comp = (hasLink ? Link : 'div') as any
|
||||
const linkProps = hasLink ? { href: getLink(type), target: '_blank' } : {}
|
||||
const renderType = isAgent ? 'agent' : type
|
||||
const hasTitle = t(`tools.addToolModal.${renderType}.title`) !== `tools.addToolModal.${renderType}.title`
|
||||
const hasTitle = t(`tools.addToolModal.${renderType}.title` as any) as string !== `tools.addToolModal.${renderType}.title`
|
||||
|
||||
return (
|
||||
<div className="flex flex-col items-center justify-center">
|
||||
<NoToolPlaceholder className={theme === 'dark' ? 'invert' : ''} />
|
||||
<div className="mb-1 mt-2 text-[13px] font-medium leading-[18px] text-text-primary">
|
||||
{hasTitle ? t(`tools.addToolModal.${renderType}.title`) : 'No tools available'}
|
||||
{hasTitle ? t(`tools.addToolModal.${renderType}.title` as any) as string : 'No tools available'}
|
||||
</div>
|
||||
{(!isAgent && hasTitle) && (
|
||||
<Comp className={cn('flex items-center text-[13px] leading-[18px] text-text-tertiary', hasLink && 'cursor-pointer hover:text-text-accent')} {...linkProps}>
|
||||
{t(`tools.addToolModal.${renderType}.tip`)}
|
||||
{t(`tools.addToolModal.${renderType}.tip` as any) as string}
|
||||
{' '}
|
||||
{hasLink && <RiArrowRightUpLine className="ml-0.5 h-3 w-3" />}
|
||||
</Comp>
|
||||
|
|
|
|||
|
|
@ -42,8 +42,8 @@ export const useAvailableNodesMetaData = () => {
|
|||
|
||||
const availableNodesMetaData = useMemo(() => mergedNodesMetaData.map((node) => {
|
||||
const { metaData } = node
|
||||
const title = t(`workflow.blocks.${metaData.type}`)
|
||||
const description = t(`workflow.blocksAbout.${metaData.type}`)
|
||||
const title = t(`workflow.blocks.${metaData.type}` as any) as string
|
||||
const description = t(`workflow.blocksAbout.${metaData.type}` as any) as string
|
||||
const helpLinkPath = `guides/workflow/node/${metaData.helpLinkUri}`
|
||||
return {
|
||||
...node,
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ export const useWorkflowTemplate = () => {
|
|||
data: {
|
||||
...startDefault.defaultValue as StartNodeType,
|
||||
type: startDefault.metaData.type,
|
||||
title: t(`workflow.blocks.${startDefault.metaData.type}`),
|
||||
title: t(`workflow.blocks.${startDefault.metaData.type}` as any) as string,
|
||||
},
|
||||
position: START_INITIAL_POSITION,
|
||||
})
|
||||
|
|
@ -34,7 +34,7 @@ export const useWorkflowTemplate = () => {
|
|||
},
|
||||
selected: true,
|
||||
type: llmDefault.metaData.type,
|
||||
title: t(`workflow.blocks.${llmDefault.metaData.type}`),
|
||||
title: t(`workflow.blocks.${llmDefault.metaData.type}` as any) as string,
|
||||
},
|
||||
position: {
|
||||
x: START_INITIAL_POSITION.x + NODE_WIDTH_X_OFFSET,
|
||||
|
|
@ -48,7 +48,7 @@ export const useWorkflowTemplate = () => {
|
|||
...answerDefault.defaultValue,
|
||||
answer: `{{#${llmNode.id}.text#}}`,
|
||||
type: answerDefault.metaData.type,
|
||||
title: t(`workflow.blocks.${answerDefault.metaData.type}`),
|
||||
title: t(`workflow.blocks.${answerDefault.metaData.type}` as any) as string,
|
||||
},
|
||||
position: {
|
||||
x: START_INITIAL_POSITION.x + NODE_WIDTH_X_OFFSET * 2,
|
||||
|
|
|
|||
|
|
@ -85,7 +85,7 @@ const Blocks = ({
|
|||
{
|
||||
classification !== '-' && !!filteredList.length && (
|
||||
<div className="flex h-[22px] items-start px-3 text-xs font-medium text-text-tertiary">
|
||||
{t(`workflow.tabs.${classification}`)}
|
||||
{t(`workflow.tabs.${classification}` as any) as string}
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@
|
|||
import type { ToolWithProvider } from '../types'
|
||||
import type { ToolDefaultValue, ToolValue } from './types'
|
||||
import type { Plugin } from '@/app/components/plugins/types'
|
||||
import type { Locale } from '@/i18n-config'
|
||||
import { RiMoreLine } from '@remixicon/react'
|
||||
import Link from 'next/link'
|
||||
import { useEffect, useMemo, useState } from 'react'
|
||||
|
|
@ -178,7 +179,7 @@ const FeaturedTools = ({
|
|||
onInstallSuccess={async () => {
|
||||
await onInstallSuccess?.()
|
||||
}}
|
||||
t={t}
|
||||
t={t as any}
|
||||
/>
|
||||
))}
|
||||
</div>
|
||||
|
|
@ -221,7 +222,7 @@ const FeaturedTools = ({
|
|||
|
||||
type FeaturedToolUninstalledItemProps = {
|
||||
plugin: Plugin
|
||||
language: string
|
||||
language: Locale
|
||||
onInstallSuccess?: () => Promise<void> | void
|
||||
t: (key: string, options?: Record<string, any>) => string
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
'use client'
|
||||
import type { TriggerDefaultValue, TriggerWithProvider } from './types'
|
||||
import type { Plugin } from '@/app/components/plugins/types'
|
||||
import type { Locale } from '@/i18n-config'
|
||||
import { RiMoreLine } from '@remixicon/react'
|
||||
import Link from 'next/link'
|
||||
import { useEffect, useMemo, useState } from 'react'
|
||||
|
|
@ -170,7 +171,7 @@ const FeaturedTriggers = ({
|
|||
onInstallSuccess={async () => {
|
||||
await onInstallSuccess?.()
|
||||
}}
|
||||
t={t}
|
||||
t={t as any}
|
||||
/>
|
||||
))}
|
||||
</div>
|
||||
|
|
@ -213,7 +214,7 @@ const FeaturedTriggers = ({
|
|||
|
||||
type FeaturedTriggerUninstalledItemProps = {
|
||||
plugin: Plugin
|
||||
language: string
|
||||
language: Locale
|
||||
onInstallSuccess?: () => Promise<void> | void
|
||||
t: (key: string, options?: Record<string, any>) => string
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ export const useBlocks = () => {
|
|||
return BLOCKS.map((block) => {
|
||||
return {
|
||||
...block,
|
||||
title: t(`workflow.blocks.${block.type}`),
|
||||
title: t(`workflow.blocks.${block.type}` as any) as string,
|
||||
}
|
||||
})
|
||||
}
|
||||
|
|
@ -28,7 +28,7 @@ export const useStartBlocks = () => {
|
|||
return START_BLOCKS.map((block) => {
|
||||
return {
|
||||
...block,
|
||||
title: t(`workflow.blocks.${block.type}`),
|
||||
title: t(`workflow.blocks.${block.type}` as any) as string,
|
||||
}
|
||||
})
|
||||
}
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@ const StartBlocks = ({
|
|||
if (blockType === BlockEnumValues.TriggerWebhook)
|
||||
return t('workflow.customWebhook')
|
||||
|
||||
return t(`workflow.blocks.${blockType}`)
|
||||
return t(`workflow.blocks.${blockType}` as any) as string
|
||||
}
|
||||
|
||||
return START_BLOCKS.filter((block) => {
|
||||
|
|
@ -83,10 +83,10 @@ const StartBlocks = ({
|
|||
<div className="system-md-medium mb-1 text-text-primary">
|
||||
{block.type === BlockEnumValues.TriggerWebhook
|
||||
? t('workflow.customWebhook')
|
||||
: t(`workflow.blocks.${block.type}`)}
|
||||
: t(`workflow.blocks.${block.type}` as any) as string}
|
||||
</div>
|
||||
<div className="system-xs-regular text-text-secondary">
|
||||
{t(`workflow.blocksAbout.${block.type}`)}
|
||||
{t(`workflow.blocksAbout.${block.type}` as any) as string}
|
||||
</div>
|
||||
{(block.type === BlockEnumValues.TriggerWebhook || block.type === BlockEnumValues.TriggerSchedule) && (
|
||||
<div className="system-xs-regular mb-1 mt-1 text-text-tertiary">
|
||||
|
|
@ -107,7 +107,7 @@ const StartBlocks = ({
|
|||
type={block.type}
|
||||
/>
|
||||
<div className="flex w-0 grow items-center justify-between text-sm text-text-secondary">
|
||||
<span className="truncate">{t(`workflow.blocks.${block.type}`)}</span>
|
||||
<span className="truncate">{t(`workflow.blocks.${block.type}` as any) as string}</span>
|
||||
{block.type === BlockEnumValues.Start && (
|
||||
<span className="system-xs-regular ml-2 shrink-0 text-text-quaternary">{t('workflow.blocks.originalStartNode')}</span>
|
||||
)}
|
||||
|
|
|
|||
|
|
@ -237,8 +237,8 @@ export const useChecklist = (nodes: Node[], edges: Edge[]) => {
|
|||
list.push({
|
||||
id: `${type}-need-added`,
|
||||
type,
|
||||
title: t(`workflow.blocks.${type}`),
|
||||
errorMessage: t('workflow.common.needAdd', { node: t(`workflow.blocks.${type}`) }),
|
||||
title: t(`workflow.blocks.${type}` as any) as string,
|
||||
errorMessage: t('workflow.common.needAdd', { node: t(`workflow.blocks.${type}` as any) as string }),
|
||||
canNavigate: false,
|
||||
})
|
||||
}
|
||||
|
|
@ -409,7 +409,7 @@ export const useChecklistBeforePublish = () => {
|
|||
const type = isRequiredNodesType[i]
|
||||
|
||||
if (!filteredNodes.find(node => node.data.type === type)) {
|
||||
notify({ type: 'error', message: t('workflow.common.needAdd', { node: t(`workflow.blocks.${type}`) }) })
|
||||
notify({ type: 'error', message: t('workflow.common.needAdd', { node: t(`workflow.blocks.${type}` as any) as string }) })
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@ const OutputVarList: FC<Props> = ({
|
|||
if (!isValid) {
|
||||
setToastHandler(Toast.notify({
|
||||
type: 'error',
|
||||
message: t(`appDebug.varKeyError.${errorMessageKey}`, { key: errorKey }),
|
||||
message: t(`appDebug.varKeyError.${errorMessageKey}` as any, { key: errorKey }),
|
||||
}))
|
||||
return
|
||||
}
|
||||
|
|
|
|||
|
|
@ -57,7 +57,7 @@ const VarList: FC<Props> = ({
|
|||
if (!isValid) {
|
||||
setToastHandle(Toast.notify({
|
||||
type: 'error',
|
||||
message: t(`appDebug.varKeyError.${errorMessageKey}`, { key: errorKey }),
|
||||
message: t(`appDebug.varKeyError.${errorMessageKey}` as any, { key: errorKey }),
|
||||
}))
|
||||
return
|
||||
}
|
||||
|
|
|
|||
|
|
@ -72,7 +72,7 @@ const OperationSelector: FC<OperationSelectorProps> = ({
|
|||
className={`system-sm-regular overflow-hidden truncate text-ellipsis
|
||||
${selectedItem ? 'text-components-input-text-filled' : 'text-components-input-text-disabled'}`}
|
||||
>
|
||||
{selectedItem?.name ? t(`${i18nPrefix}.operations.${selectedItem?.name}`) : t(`${i18nPrefix}.operations.title`)}
|
||||
{selectedItem?.name ? t(`${i18nPrefix}.operations.${selectedItem?.name}` as any) as string : t(`${i18nPrefix}.operations.title` as any) as string}
|
||||
</span>
|
||||
</div>
|
||||
<RiArrowDownSLine className={`h-4 w-4 text-text-quaternary ${disabled && 'text-components-input-text-placeholder'} ${open && 'text-text-secondary'}`} />
|
||||
|
|
@ -83,7 +83,7 @@ const OperationSelector: FC<OperationSelectorProps> = ({
|
|||
<div className="flex w-[140px] flex-col items-start rounded-xl border-[0.5px] border-components-panel-border bg-components-panel-bg-blur shadow-lg">
|
||||
<div className="flex flex-col items-start self-stretch p-1">
|
||||
<div className="flex items-start self-stretch px-3 pb-0.5 pt-1">
|
||||
<div className="system-xs-medium-uppercase flex grow text-text-tertiary">{t(`${i18nPrefix}.operations.title`)}</div>
|
||||
<div className="system-xs-medium-uppercase flex grow text-text-tertiary">{t(`${i18nPrefix}.operations.title` as any) as string}</div>
|
||||
</div>
|
||||
{items.map(item => (
|
||||
item.value === 'divider'
|
||||
|
|
@ -100,7 +100,7 @@ const OperationSelector: FC<OperationSelectorProps> = ({
|
|||
}}
|
||||
>
|
||||
<div className="flex min-h-5 grow items-center gap-1 px-1">
|
||||
<span className="system-sm-medium flex grow text-text-secondary">{t(`${i18nPrefix}.operations.${item.name}`)}</span>
|
||||
<span className="system-sm-medium flex grow text-text-secondary">{t(`${i18nPrefix}.operations.${item.name}` as any) as string}</span>
|
||||
</div>
|
||||
{item.value === value && (
|
||||
<div className="flex items-center justify-center">
|
||||
|
|
|
|||
|
|
@ -73,7 +73,7 @@ const NodeComponent: FC<NodeProps<AssignerNodeType>> = ({
|
|||
nodeType={node?.data.type}
|
||||
nodeTitle={node?.data.title}
|
||||
rightSlot={
|
||||
writeMode && <Badge className="!ml-auto shrink-0" text={t(`${i18nPrefix}.operations.${writeMode}`)} />
|
||||
writeMode && <Badge className="!ml-auto shrink-0" text={t(`${i18nPrefix}.operations.${writeMode}` as any) as string} />
|
||||
}
|
||||
/>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ const ConditionValue = ({
|
|||
|
||||
const variableSelector = variable_selector as ValueSelector
|
||||
|
||||
const operatorName = isComparisonOperatorNeedTranslate(operator) ? t(`workflow.nodes.ifElse.comparisonOperator.${operator}`) : operator
|
||||
const operatorName = isComparisonOperatorNeedTranslate(operator) ? t(`workflow.nodes.ifElse.comparisonOperator.${operator}` as any) as string : operator
|
||||
const formatValue = useCallback((c: Condition) => {
|
||||
const notHasValue = comparisonOperatorNotRequireValue(c.comparison_operator)
|
||||
if (notHasValue)
|
||||
|
|
@ -59,7 +59,7 @@ const ConditionValue = ({
|
|||
if (isSelect) {
|
||||
const name = [...FILE_TYPE_OPTIONS, ...TRANSFER_METHOD].filter(item => item.value === (Array.isArray(c.value) ? c.value[0] : c.value))[0]
|
||||
return name
|
||||
? t(`workflow.nodes.ifElse.optionName.${name.i18nKey}`).replace(/\{\{#([^#]*)#\}\}/g, (a, b) => {
|
||||
? (t(`workflow.nodes.ifElse.optionName.${name.i18nKey}` as any) as string).replace(/\{\{#([^#]*)#\}\}/g, (a, b) => {
|
||||
const arr: string[] = b.split('.')
|
||||
if (isSystemVar(arr))
|
||||
return `{{${b}}}`
|
||||
|
|
@ -91,9 +91,9 @@ const ConditionValue = ({
|
|||
sub_variable_condition?.conditions.map((c: Condition, index) => (
|
||||
<div className="relative flex h-6 items-center space-x-1" key={c.id}>
|
||||
<div className="system-xs-medium text-text-accent">{c.key}</div>
|
||||
<div className="system-xs-medium text-text-primary">{isComparisonOperatorNeedTranslate(c.comparison_operator) ? t(`workflow.nodes.ifElse.comparisonOperator.${c.comparison_operator}`) : c.comparison_operator}</div>
|
||||
<div className="system-xs-medium text-text-primary">{isComparisonOperatorNeedTranslate(c.comparison_operator) ? t(`workflow.nodes.ifElse.comparisonOperator.${c.comparison_operator}` as any) as string : c.comparison_operator}</div>
|
||||
{c.comparison_operator && !isEmptyRelatedOperator(c.comparison_operator) && <div className="system-xs-regular text-text-secondary">{isSelect(c) ? selectName(c) : formatValue(c)}</div>}
|
||||
{index !== sub_variable_condition.conditions.length - 1 && (<div className="absolute bottom-[-10px] right-1 z-10 text-[10px] font-medium uppercase leading-4 text-text-accent">{t(`${i18nPrefix}.${sub_variable_condition.logical_operator}`)}</div>)}
|
||||
{index !== sub_variable_condition.conditions.length - 1 && (<div className="absolute bottom-[-10px] right-1 z-10 text-[10px] font-medium uppercase leading-4 text-text-accent">{t(`${i18nPrefix}.${sub_variable_condition.logical_operator}` as any) as string}</div>)}
|
||||
</div>
|
||||
))
|
||||
}
|
||||
|
|
|
|||
|
|
@ -168,13 +168,13 @@ const ConditionItem = ({
|
|||
if (isSelect) {
|
||||
if (fileAttr?.key === 'type' || condition.comparison_operator === ComparisonOperator.allOf) {
|
||||
return FILE_TYPE_OPTIONS.map(item => ({
|
||||
name: t(`${optionNameI18NPrefix}.${item.i18nKey}`),
|
||||
name: t(`${optionNameI18NPrefix}.${item.i18nKey}` as any) as string,
|
||||
value: item.value,
|
||||
}))
|
||||
}
|
||||
if (fileAttr?.key === 'transfer_method') {
|
||||
return TRANSFER_METHOD.map(item => ({
|
||||
name: t(`${optionNameI18NPrefix}.${item.i18nKey}`),
|
||||
name: t(`${optionNameI18NPrefix}.${item.i18nKey}` as any) as string,
|
||||
value: item.value,
|
||||
}))
|
||||
}
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@ const ConditionOperator = ({
|
|||
const options = useMemo(() => {
|
||||
return getOperators(varType, file).map((o) => {
|
||||
return {
|
||||
label: isComparisonOperatorNeedTranslate(o) ? t(`${i18nPrefix}.comparisonOperator.${o}`) : o,
|
||||
label: isComparisonOperatorNeedTranslate(o) ? t(`${i18nPrefix}.comparisonOperator.${o}` as any) as string : o,
|
||||
value: o,
|
||||
}
|
||||
})
|
||||
|
|
@ -65,7 +65,7 @@ const ConditionOperator = ({
|
|||
{
|
||||
selectedOption
|
||||
? selectedOption.label
|
||||
: t(`${i18nPrefix}.select`)
|
||||
: t(`${i18nPrefix}.select` as any) as string
|
||||
}
|
||||
<RiArrowDownSLine className="ml-1 h-3.5 w-3.5" />
|
||||
</Button>
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ const ConditionValue = ({
|
|||
const { t } = useTranslation()
|
||||
const nodes = useNodes()
|
||||
const variableName = labelName || (isSystemVar(variableSelector) ? variableSelector.slice(0).join('.') : variableSelector.slice(1).join('.'))
|
||||
const operatorName = isComparisonOperatorNeedTranslate(operator) ? t(`workflow.nodes.ifElse.comparisonOperator.${operator}`) : operator
|
||||
const operatorName = isComparisonOperatorNeedTranslate(operator) ? t(`workflow.nodes.ifElse.comparisonOperator.${operator}` as any) as string : operator
|
||||
const notHasValue = comparisonOperatorNotRequireValue(operator)
|
||||
const node: Node<CommonNodeType> | undefined = nodes.find(n => n.id === variableSelector[0]) as Node<CommonNodeType>
|
||||
const isException = isExceptionVariable(variableName, node?.data.type)
|
||||
|
|
@ -63,7 +63,7 @@ const ConditionValue = ({
|
|||
if (isSelect) {
|
||||
const name = [...FILE_TYPE_OPTIONS, ...TRANSFER_METHOD].filter(item => item.value === (Array.isArray(value) ? value[0] : value))[0]
|
||||
return name
|
||||
? t(`workflow.nodes.ifElse.optionName.${name.i18nKey}`).replace(/\{\{#([^#]*)#\}\}/g, (a, b) => {
|
||||
? (t(`workflow.nodes.ifElse.optionName.${name.i18nKey}` as any) as string).replace(/\{\{#([^#]*)#\}\}/g, (a, b) => {
|
||||
const arr: string[] = b.split('.')
|
||||
if (isSystemVar(arr))
|
||||
return `{{${b}}}`
|
||||
|
|
|
|||
|
|
@ -135,7 +135,7 @@ export const useNodeIterationInteractions = () => {
|
|||
_isBundled: false,
|
||||
_connectedSourceHandleIds: [],
|
||||
_connectedTargetHandleIds: [],
|
||||
title: nodesWithSameType.length > 0 ? `${t(`workflow.blocks.${childNodeType}`)} ${childNodeTypeCount[childNodeType]}` : t(`workflow.blocks.${childNodeType}`),
|
||||
title: nodesWithSameType.length > 0 ? `${t(`workflow.blocks.${childNodeType}` as any) as string} ${childNodeTypeCount[childNodeType]}` : t(`workflow.blocks.${childNodeType}` as any) as string,
|
||||
iteration_id: newNodeId,
|
||||
type: childNodeType,
|
||||
},
|
||||
|
|
|
|||
|
|
@ -121,7 +121,7 @@ const DatasetItem: FC<Props> = ({
|
|||
payload.provider === 'external' && (
|
||||
<Badge
|
||||
className="shrink-0 group-hover/dataset-item:hidden"
|
||||
text={t('dataset.externalTag') as string}
|
||||
text={t('dataset.externalTag')}
|
||||
/>
|
||||
)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ const ConditionOperator = ({
|
|||
const options = useMemo(() => {
|
||||
return getOperators(variableType).map((o) => {
|
||||
return {
|
||||
label: isComparisonOperatorNeedTranslate(o) ? t(`${i18nPrefix}.comparisonOperator.${o}`) : o,
|
||||
label: isComparisonOperatorNeedTranslate(o) ? t(`${i18nPrefix}.comparisonOperator.${o}` as any) as string : o,
|
||||
value: o,
|
||||
}
|
||||
})
|
||||
|
|
@ -68,7 +68,7 @@ const ConditionOperator = ({
|
|||
{
|
||||
selectedOption
|
||||
? selectedOption.label
|
||||
: t(`${i18nPrefix}.select`)
|
||||
: t(`${i18nPrefix}.select` as any) as string
|
||||
}
|
||||
<RiArrowDownSLine className="ml-1 h-3.5 w-3.5" />
|
||||
</Button>
|
||||
|
|
|
|||
|
|
@ -66,13 +66,13 @@ const FilterCondition: FC<Props> = ({
|
|||
if (isSelect) {
|
||||
if (condition.key === 'type' || condition.comparison_operator === ComparisonOperator.allOf) {
|
||||
return FILE_TYPE_OPTIONS.map(item => ({
|
||||
name: t(`${optionNameI18NPrefix}.${item.i18nKey}`),
|
||||
name: t(`${optionNameI18NPrefix}.${item.i18nKey}` as any) as string,
|
||||
value: item.value,
|
||||
}))
|
||||
}
|
||||
if (condition.key === 'transfer_method') {
|
||||
return TRANSFER_METHOD.map(item => ({
|
||||
name: t(`${optionNameI18NPrefix}.${item.i18nKey}`),
|
||||
name: t(`${optionNameI18NPrefix}.${item.i18nKey}` as any) as string,
|
||||
value: item.value,
|
||||
}))
|
||||
}
|
||||
|
|
|
|||
|
|
@ -121,7 +121,7 @@ const ConfigPromptItem: FC<Props> = ({
|
|||
|
||||
<Tooltip
|
||||
popupContent={
|
||||
<div className="max-w-[180px]">{t(`${i18nPrefix}.roleDescription.${payload.role}`)}</div>
|
||||
<div className="max-w-[180px]">{t(`${i18nPrefix}.roleDescription.${payload.role}` as any) as string}</div>
|
||||
}
|
||||
triggerClassName="w-4 h-4"
|
||||
/>
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ const ConditionValue = ({
|
|||
|
||||
const variableSelector = variable_selector as ValueSelector
|
||||
|
||||
const operatorName = isComparisonOperatorNeedTranslate(operator) ? t(`workflow.nodes.ifElse.comparisonOperator.${operator}`) : operator
|
||||
const operatorName = isComparisonOperatorNeedTranslate(operator) ? t(`workflow.nodes.ifElse.comparisonOperator.${operator}` as any) as string : operator
|
||||
const formatValue = useCallback((c: Condition) => {
|
||||
const notHasValue = comparisonOperatorNotRequireValue(c.comparison_operator)
|
||||
if (notHasValue)
|
||||
|
|
@ -59,7 +59,7 @@ const ConditionValue = ({
|
|||
if (isSelect) {
|
||||
const name = [...FILE_TYPE_OPTIONS, ...TRANSFER_METHOD].filter(item => item.value === (Array.isArray(c.value) ? c.value[0] : c.value))[0]
|
||||
return name
|
||||
? t(`workflow.nodes.ifElse.optionName.${name.i18nKey}`).replace(/\{\{#([^#]*)#\}\}/g, (a, b) => {
|
||||
? (t(`workflow.nodes.ifElse.optionName.${name.i18nKey}` as any) as string).replace(/\{\{#([^#]*)#\}\}/g, (a: string, b: string) => {
|
||||
const arr: string[] = b.split('.')
|
||||
if (isSystemVar(arr))
|
||||
return `{{${b}}}`
|
||||
|
|
@ -91,9 +91,9 @@ const ConditionValue = ({
|
|||
sub_variable_condition?.conditions.map((c: Condition, index) => (
|
||||
<div className="relative flex h-6 items-center space-x-1" key={c.id}>
|
||||
<div className="system-xs-medium text-text-accent">{c.key}</div>
|
||||
<div className="system-xs-medium text-text-primary">{isComparisonOperatorNeedTranslate(c.comparison_operator) ? t(`workflow.nodes.ifElse.comparisonOperator.${c.comparison_operator}`) : c.comparison_operator}</div>
|
||||
<div className="system-xs-medium text-text-primary">{isComparisonOperatorNeedTranslate(c.comparison_operator) ? t(`workflow.nodes.ifElse.comparisonOperator.${c.comparison_operator}` as any) as string : c.comparison_operator}</div>
|
||||
{c.comparison_operator && !isEmptyRelatedOperator(c.comparison_operator) && <div className="system-xs-regular text-text-secondary">{isSelect(c) ? selectName(c) : formatValue(c)}</div>}
|
||||
{index !== sub_variable_condition.conditions.length - 1 && (<div className="absolute bottom-[-10px] right-1 z-10 text-[10px] font-medium uppercase leading-4 text-text-accent">{t(`${i18nPrefix}.${sub_variable_condition.logical_operator}`)}</div>)}
|
||||
{index !== sub_variable_condition.conditions.length - 1 && (<div className="absolute bottom-[-10px] right-1 z-10 text-[10px] font-medium uppercase leading-4 text-text-accent">{t(`${i18nPrefix}.${sub_variable_condition.logical_operator}` as any) as string}</div>)}
|
||||
</div>
|
||||
))
|
||||
}
|
||||
|
|
|
|||
|
|
@ -145,13 +145,13 @@ const ConditionItem = ({
|
|||
if (isSelect) {
|
||||
if (fileAttr?.key === 'type' || condition.comparison_operator === ComparisonOperator.allOf) {
|
||||
return FILE_TYPE_OPTIONS.map(item => ({
|
||||
name: t(`${optionNameI18NPrefix}.${item.i18nKey}`),
|
||||
name: t(`${optionNameI18NPrefix}.${item.i18nKey}` as any) as string,
|
||||
value: item.value,
|
||||
}))
|
||||
}
|
||||
if (fileAttr?.key === 'transfer_method') {
|
||||
return TRANSFER_METHOD.map(item => ({
|
||||
name: t(`${optionNameI18NPrefix}.${item.i18nKey}`),
|
||||
name: t(`${optionNameI18NPrefix}.${item.i18nKey}` as any) as string,
|
||||
value: item.value,
|
||||
}))
|
||||
}
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@ const ConditionOperator = ({
|
|||
const options = useMemo(() => {
|
||||
return getOperators(varType, file).map((o) => {
|
||||
return {
|
||||
label: isComparisonOperatorNeedTranslate(o) ? t(`${i18nPrefix}.comparisonOperator.${o}`) : o,
|
||||
label: isComparisonOperatorNeedTranslate(o) ? t(`${i18nPrefix}.comparisonOperator.${o}` as any) as string : o,
|
||||
value: o,
|
||||
}
|
||||
})
|
||||
|
|
@ -65,7 +65,7 @@ const ConditionOperator = ({
|
|||
{
|
||||
selectedOption
|
||||
? selectedOption.label
|
||||
: t(`${i18nPrefix}.select`)
|
||||
: t(`${i18nPrefix}.select` as any) as string
|
||||
}
|
||||
<RiArrowDownSLine className="ml-1 h-3.5 w-3.5" />
|
||||
</Button>
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ const ConditionValue = ({
|
|||
value,
|
||||
}: ConditionValueProps) => {
|
||||
const { t } = useTranslation()
|
||||
const operatorName = isComparisonOperatorNeedTranslate(operator) ? t(`workflow.nodes.ifElse.comparisonOperator.${operator}`) : operator
|
||||
const operatorName = isComparisonOperatorNeedTranslate(operator) ? t(`workflow.nodes.ifElse.comparisonOperator.${operator}` as any) as string : operator
|
||||
const notHasValue = comparisonOperatorNotRequireValue(operator)
|
||||
const formatValue = useMemo(() => {
|
||||
if (notHasValue)
|
||||
|
|
@ -50,7 +50,7 @@ const ConditionValue = ({
|
|||
if (isSelect) {
|
||||
const name = [...FILE_TYPE_OPTIONS, ...TRANSFER_METHOD].filter(item => item.value === (Array.isArray(value) ? value[0] : value))[0]
|
||||
return name
|
||||
? t(`workflow.nodes.ifElse.optionName.${name.i18nKey}`).replace(/\{\{#([^#]*)#\}\}/g, (a, b) => {
|
||||
? (t(`workflow.nodes.ifElse.optionName.${name.i18nKey}` as any) as string).replace(/\{\{#([^#]*)#\}\}/g, (a, b) => {
|
||||
const arr: string[] = b.split('.')
|
||||
if (isSystemVar(arr))
|
||||
return `{{${b}}}`
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ const Item = ({
|
|||
if (!isValid) {
|
||||
Toast.notify({
|
||||
type: 'error',
|
||||
message: t(`appDebug.varKeyError.${errorMessageKey}`, { key: t('workflow.env.modal.name') }),
|
||||
message: t(`appDebug.varKeyError.${errorMessageKey}` as any, { key: t('workflow.env.modal.name') }) as string,
|
||||
})
|
||||
return false
|
||||
}
|
||||
|
|
|
|||
|
|
@ -56,7 +56,7 @@ const AddExtractParameter: FC<Props> = ({
|
|||
if (!isValid) {
|
||||
Toast.notify({
|
||||
type: 'error',
|
||||
message: t(`appDebug.varKeyError.${errorMessageKey}`, { key: errorKey }),
|
||||
message: t(`appDebug.varKeyError.${errorMessageKey}` as any, { key: errorKey }) as string,
|
||||
})
|
||||
return
|
||||
}
|
||||
|
|
|
|||
|
|
@ -45,7 +45,7 @@ const VarList: FC<Props> = ({
|
|||
if (errorMsgKey) {
|
||||
Toast.notify({
|
||||
type: 'error',
|
||||
message: t(errorMsgKey, { key: t(typeName) }),
|
||||
message: t(errorMsgKey as any, { key: t(typeName as any) as string }) as string,
|
||||
})
|
||||
return false
|
||||
}
|
||||
|
|
|
|||
|
|
@ -99,7 +99,7 @@ const useConfig = (id: string, payload: StartNodeType) => {
|
|||
if (errorMsgKey) {
|
||||
Toast.notify({
|
||||
type: 'error',
|
||||
message: t(errorMsgKey, { key: t(typeName) }),
|
||||
message: t(errorMsgKey as any, { key: t(typeName as any) as string }) as string,
|
||||
})
|
||||
return false
|
||||
}
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue