diff --git a/web/app/(commonLayout)/app/(appDetailLayout)/[appId]/overview/tracing/config-popup.tsx b/web/app/(commonLayout)/app/(appDetailLayout)/[appId]/overview/tracing/config-popup.tsx index e4c3f60c12..0ad02ad7f3 100644 --- a/web/app/(commonLayout)/app/(appDetailLayout)/[appId]/overview/tracing/config-popup.tsx +++ b/web/app/(commonLayout)/app/(appDetailLayout)/[appId]/overview/tracing/config-popup.tsx @@ -73,7 +73,7 @@ const ConfigPopup: FC = ({ } }, [onChooseProvider]) - const handleConfigUpdated = useCallback((payload: ArizeConfig | PhoenixConfig | LangSmithConfig | LangFuseConfig | OpikConfig | WeaveConfig | AliyunConfig) => { + const handleConfigUpdated = useCallback((payload: ArizeConfig | PhoenixConfig | LangSmithConfig | LangFuseConfig | OpikConfig | WeaveConfig | AliyunConfig | TencentConfig) => { onConfigUpdated(currentProvider!, payload) hideConfigModal() }, [currentProvider, hideConfigModal, onConfigUpdated]) diff --git a/web/app/components/base/auto-height-textarea/index.tsx b/web/app/components/base/auto-height-textarea/index.tsx index da412a176d..fb64bf9db4 100644 --- a/web/app/components/base/auto-height-textarea/index.tsx +++ b/web/app/components/base/auto-height-textarea/index.tsx @@ -31,7 +31,7 @@ const AutoHeightTextarea = ( onKeyDown, onKeyUp, }: IProps & { - ref: React.RefObject; + ref?: React.RefObject; }, ) => { // eslint-disable-next-line react-hooks/rules-of-hooks diff --git a/web/app/components/billing/type.ts b/web/app/components/billing/type.ts index 7cc4d19755..72d46f1e70 100644 --- a/web/app/components/billing/type.ts +++ b/web/app/components/billing/type.ts @@ -10,7 +10,7 @@ export enum Priority { topPriority = 'top-priority', } -export type BasicPlan = Plan.sandbox | Plan.professional | Plan.team +export type BasicPlan = Plan.sandbox | Plan.professional | Plan.team | Plan.enterprise export type PlanInfo = { level: number diff --git a/web/app/components/datasets/documents/detail/metadata/index.tsx b/web/app/components/datasets/documents/detail/metadata/index.tsx index 88c359f8b2..209c141dd5 100644 --- a/web/app/components/datasets/documents/detail/metadata/index.tsx +++ b/web/app/components/datasets/documents/detail/metadata/index.tsx @@ -57,36 +57,44 @@ export const FieldInfo: FC = ({ const editAlignTop = showEdit && inputType === 'textarea' const readAlignTop = !showEdit && textNeedWrap + const renderContent = () => { + if (!showEdit) + return displayedValue + + if (inputType === 'select') { + return onUpdate?.(value as string)} + items={selectOptions} + defaultValue={value} + className={s.select} + wrapperClassName={s.selectWrapper} + placeholder={`${t('datasetDocuments.metadata.placeholder.select')}${label}`} + /> + } + + if (inputType === 'textarea') { + return onUpdate?.(e.target.value)} + value={value} + className={s.textArea} + placeholder={`${t('datasetDocuments.metadata.placeholder.add')}${label}`} + /> + } + + return onUpdate?.(e.target.value)} + value={value} + defaultValue={defaultValue} + placeholder={`${t('datasetDocuments.metadata.placeholder.add')}${label}`} + /> + } + return (
{label}
{valueIcon} - {!showEdit - ? displayedValue - : inputType === 'select' - ? onUpdate?.(value as string)} - items={selectOptions} - defaultValue={value} - className={s.select} - wrapperClassName={s.selectWrapper} - placeholder={`${t('datasetDocuments.metadata.placeholder.select')}${label}`} - /> - : inputType === 'textarea' - ? onUpdate?.(e.target.value)} - value={value} - className={s.textArea} - placeholder={`${t('datasetDocuments.metadata.placeholder.add')}${label}`} - /> - : onUpdate?.(e.target.value)} - value={value} - defaultValue={defaultValue} - placeholder={`${t('datasetDocuments.metadata.placeholder.add')}${label}`} - /> - } + {renderContent()}
) diff --git a/web/app/components/plugins/plugin-detail-panel/action-list.tsx b/web/app/components/plugins/plugin-detail-panel/action-list.tsx index 040c728630..a6a4544216 100644 --- a/web/app/components/plugins/plugin-detail-panel/action-list.tsx +++ b/web/app/components/plugins/plugin-detail-panel/action-list.tsx @@ -15,15 +15,15 @@ const ActionList = ({ detail, }: Props) => { const { t } = useTranslation() - const providerBriefInfo = detail.declaration.tool.identity - const providerKey = `${detail.plugin_id}/${providerBriefInfo.name}` + const providerBriefInfo = detail.declaration?.tool?.identity + const providerKey = providerBriefInfo ? `${detail.plugin_id}/${providerBriefInfo.name}` : '' const { data: collectionList = [] } = useAllToolProviders() const provider = useMemo(() => { return collectionList.find(collection => collection.name === providerKey) }, [collectionList, providerKey]) const { data } = useBuiltinTools(providerKey) - if (!data || !provider) + if (!providerKey || !data || !provider) return null return ( diff --git a/web/global.d.ts b/web/global.d.ts index 20b84a5327..c5488a6cae 100644 --- a/web/global.d.ts +++ b/web/global.d.ts @@ -1,5 +1,6 @@ import './types/i18n' import './types/jsx' +import './types/mdx' declare module 'lamejs'; declare module 'lamejs/src/js/MPEGMode'; @@ -7,9 +8,4 @@ declare module 'lamejs/src/js/Lame'; declare module 'lamejs/src/js/BitStream'; declare module 'react-18-input-autosize'; -declare module '*.mdx' { - let MDXComponent: (props: any) => JSX.Element - export default MDXComponent -} - export {} diff --git a/web/service/use-tools.ts b/web/service/use-tools.ts index e9d3ac1c8d..a881441cd5 100644 --- a/web/service/use-tools.ts +++ b/web/service/use-tools.ts @@ -274,6 +274,7 @@ export const useInvalidateBuiltinProviderInfo = () => { export const useBuiltinTools = (providerName: string) => { return useQuery({ + enabled: !!providerName, queryKey: [NAME_SPACE, 'builtin-provider-tools', providerName], queryFn: () => get(`/workspaces/current/tool-provider/builtin/${providerName}/tools`), }) diff --git a/web/types/mdx.d.ts b/web/types/mdx.d.ts new file mode 100644 index 0000000000..fab7616911 --- /dev/null +++ b/web/types/mdx.d.ts @@ -0,0 +1,4 @@ +declare module '*.mdx' { + const MDXComponent: (props?: Record) => JSX.Element + export default MDXComponent +}