mirror of https://github.com/langgenius/dify.git
Fix type error (#27152)
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
This commit is contained in:
parent
977690590e
commit
6217c96576
|
|
@ -73,7 +73,7 @@ const ConfigPopup: FC<PopupProps> = ({
|
||||||
}
|
}
|
||||||
}, [onChooseProvider])
|
}, [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)
|
onConfigUpdated(currentProvider!, payload)
|
||||||
hideConfigModal()
|
hideConfigModal()
|
||||||
}, [currentProvider, hideConfigModal, onConfigUpdated])
|
}, [currentProvider, hideConfigModal, onConfigUpdated])
|
||||||
|
|
|
||||||
|
|
@ -31,7 +31,7 @@ const AutoHeightTextarea = (
|
||||||
onKeyDown,
|
onKeyDown,
|
||||||
onKeyUp,
|
onKeyUp,
|
||||||
}: IProps & {
|
}: IProps & {
|
||||||
ref: React.RefObject<unknown>;
|
ref?: React.RefObject<HTMLTextAreaElement>;
|
||||||
},
|
},
|
||||||
) => {
|
) => {
|
||||||
// eslint-disable-next-line react-hooks/rules-of-hooks
|
// eslint-disable-next-line react-hooks/rules-of-hooks
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@ export enum Priority {
|
||||||
topPriority = 'top-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 = {
|
export type PlanInfo = {
|
||||||
level: number
|
level: number
|
||||||
|
|
|
||||||
|
|
@ -57,15 +57,12 @@ export const FieldInfo: FC<IFieldInfoProps> = ({
|
||||||
const editAlignTop = showEdit && inputType === 'textarea'
|
const editAlignTop = showEdit && inputType === 'textarea'
|
||||||
const readAlignTop = !showEdit && textNeedWrap
|
const readAlignTop = !showEdit && textNeedWrap
|
||||||
|
|
||||||
return (
|
const renderContent = () => {
|
||||||
<div className={cn('flex min-h-5 items-center gap-1 py-0.5 text-xs', editAlignTop && '!items-start', readAlignTop && '!items-start pt-1')}>
|
if (!showEdit)
|
||||||
<div className={cn('w-[200px] shrink-0 overflow-hidden text-ellipsis whitespace-nowrap text-text-tertiary', editAlignTop && 'pt-1')}>{label}</div>
|
return displayedValue
|
||||||
<div className="flex grow items-center gap-1 text-text-secondary">
|
|
||||||
{valueIcon}
|
if (inputType === 'select') {
|
||||||
{!showEdit
|
return <SimpleSelect
|
||||||
? displayedValue
|
|
||||||
: inputType === 'select'
|
|
||||||
? <SimpleSelect
|
|
||||||
onSelect={({ value }) => onUpdate?.(value as string)}
|
onSelect={({ value }) => onUpdate?.(value as string)}
|
||||||
items={selectOptions}
|
items={selectOptions}
|
||||||
defaultValue={value}
|
defaultValue={value}
|
||||||
|
|
@ -73,20 +70,31 @@ export const FieldInfo: FC<IFieldInfoProps> = ({
|
||||||
wrapperClassName={s.selectWrapper}
|
wrapperClassName={s.selectWrapper}
|
||||||
placeholder={`${t('datasetDocuments.metadata.placeholder.select')}${label}`}
|
placeholder={`${t('datasetDocuments.metadata.placeholder.select')}${label}`}
|
||||||
/>
|
/>
|
||||||
: inputType === 'textarea'
|
}
|
||||||
? <AutoHeightTextarea
|
|
||||||
|
if (inputType === 'textarea') {
|
||||||
|
return <AutoHeightTextarea
|
||||||
onChange={e => onUpdate?.(e.target.value)}
|
onChange={e => onUpdate?.(e.target.value)}
|
||||||
value={value}
|
value={value}
|
||||||
className={s.textArea}
|
className={s.textArea}
|
||||||
placeholder={`${t('datasetDocuments.metadata.placeholder.add')}${label}`}
|
placeholder={`${t('datasetDocuments.metadata.placeholder.add')}${label}`}
|
||||||
/>
|
/>
|
||||||
: <Input
|
}
|
||||||
|
|
||||||
|
return <Input
|
||||||
onChange={e => onUpdate?.(e.target.value)}
|
onChange={e => onUpdate?.(e.target.value)}
|
||||||
value={value}
|
value={value}
|
||||||
defaultValue={defaultValue}
|
defaultValue={defaultValue}
|
||||||
placeholder={`${t('datasetDocuments.metadata.placeholder.add')}${label}`}
|
placeholder={`${t('datasetDocuments.metadata.placeholder.add')}${label}`}
|
||||||
/>
|
/>
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className={cn('flex min-h-5 items-center gap-1 py-0.5 text-xs', editAlignTop && '!items-start', readAlignTop && '!items-start pt-1')}>
|
||||||
|
<div className={cn('w-[200px] shrink-0 overflow-hidden text-ellipsis whitespace-nowrap text-text-tertiary', editAlignTop && 'pt-1')}>{label}</div>
|
||||||
|
<div className="flex grow items-center gap-1 text-text-secondary">
|
||||||
|
{valueIcon}
|
||||||
|
{renderContent()}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -15,15 +15,15 @@ const ActionList = ({
|
||||||
detail,
|
detail,
|
||||||
}: Props) => {
|
}: Props) => {
|
||||||
const { t } = useTranslation()
|
const { t } = useTranslation()
|
||||||
const providerBriefInfo = detail.declaration.tool.identity
|
const providerBriefInfo = detail.declaration?.tool?.identity
|
||||||
const providerKey = `${detail.plugin_id}/${providerBriefInfo.name}`
|
const providerKey = providerBriefInfo ? `${detail.plugin_id}/${providerBriefInfo.name}` : ''
|
||||||
const { data: collectionList = [] } = useAllToolProviders()
|
const { data: collectionList = [] } = useAllToolProviders()
|
||||||
const provider = useMemo(() => {
|
const provider = useMemo(() => {
|
||||||
return collectionList.find(collection => collection.name === providerKey)
|
return collectionList.find(collection => collection.name === providerKey)
|
||||||
}, [collectionList, providerKey])
|
}, [collectionList, providerKey])
|
||||||
const { data } = useBuiltinTools(providerKey)
|
const { data } = useBuiltinTools(providerKey)
|
||||||
|
|
||||||
if (!data || !provider)
|
if (!providerKey || !data || !provider)
|
||||||
return null
|
return null
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
import './types/i18n'
|
import './types/i18n'
|
||||||
import './types/jsx'
|
import './types/jsx'
|
||||||
|
import './types/mdx'
|
||||||
|
|
||||||
declare module 'lamejs';
|
declare module 'lamejs';
|
||||||
declare module 'lamejs/src/js/MPEGMode';
|
declare module 'lamejs/src/js/MPEGMode';
|
||||||
|
|
@ -7,9 +8,4 @@ declare module 'lamejs/src/js/Lame';
|
||||||
declare module 'lamejs/src/js/BitStream';
|
declare module 'lamejs/src/js/BitStream';
|
||||||
declare module 'react-18-input-autosize';
|
declare module 'react-18-input-autosize';
|
||||||
|
|
||||||
declare module '*.mdx' {
|
|
||||||
let MDXComponent: (props: any) => JSX.Element
|
|
||||||
export default MDXComponent
|
|
||||||
}
|
|
||||||
|
|
||||||
export {}
|
export {}
|
||||||
|
|
|
||||||
|
|
@ -274,6 +274,7 @@ export const useInvalidateBuiltinProviderInfo = () => {
|
||||||
|
|
||||||
export const useBuiltinTools = (providerName: string) => {
|
export const useBuiltinTools = (providerName: string) => {
|
||||||
return useQuery({
|
return useQuery({
|
||||||
|
enabled: !!providerName,
|
||||||
queryKey: [NAME_SPACE, 'builtin-provider-tools', providerName],
|
queryKey: [NAME_SPACE, 'builtin-provider-tools', providerName],
|
||||||
queryFn: () => get<Tool[]>(`/workspaces/current/tool-provider/builtin/${providerName}/tools`),
|
queryFn: () => get<Tool[]>(`/workspaces/current/tool-provider/builtin/${providerName}/tools`),
|
||||||
})
|
})
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,4 @@
|
||||||
|
declare module '*.mdx' {
|
||||||
|
const MDXComponent: (props?: Record<string, unknown>) => JSX.Element
|
||||||
|
export default MDXComponent
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue