Commit 9bbee60c by Finley Ge Committed by GitHub

fix: ts error (#3911)

parent 9f57ad00
import { AppDetailType } from '@fastgpt/global/core/app/type'; import { AppDetailType } from '@fastgpt/global/core/app/type';
import { OutLinkSchema } from '@fastgpt/global/support/outLink/type'; import { OutlinkAppType, OutLinkSchema } from '@fastgpt/global/support/outLink/type';
import { parseHeaderCert } from '../controller'; import { parseHeaderCert } from '../controller';
import { MongoOutLink } from '../../outLink/schema'; import { MongoOutLink } from '../../outLink/schema';
import { OutLinkErrEnum } from '@fastgpt/global/common/error/code/outLink'; import { OutLinkErrEnum } from '@fastgpt/global/common/error/code/outLink';
...@@ -54,11 +54,15 @@ export async function authOutLinkCrud({ ...@@ -54,11 +54,15 @@ export async function authOutLinkCrud({
} }
/* outLink exist and it app exist */ /* outLink exist and it app exist */
export async function authOutLinkValid({ shareId }: { shareId?: string }) { export async function authOutLinkValid<T extends OutlinkAppType = any>({
shareId
}: {
shareId?: string;
}) {
if (!shareId) { if (!shareId) {
return Promise.reject(OutLinkErrEnum.linkUnInvalid); return Promise.reject(OutLinkErrEnum.linkUnInvalid);
} }
const outLinkConfig = await MongoOutLink.findOne({ shareId }).lean(); const outLinkConfig = await MongoOutLink.findOne({ shareId }).lean<OutLinkSchema<T>>();
if (!outLinkConfig) { if (!outLinkConfig) {
return Promise.reject(OutLinkErrEnum.linkUnInvalid); return Promise.reject(OutLinkErrEnum.linkUnInvalid);
...@@ -66,6 +70,6 @@ export async function authOutLinkValid({ shareId }: { shareId?: string }) { ...@@ -66,6 +70,6 @@ export async function authOutLinkValid({ shareId }: { shareId?: string }) {
return { return {
appId: outLinkConfig.appId, appId: outLinkConfig.appId,
outLinkConfig outLinkConfig: outLinkConfig
}; };
} }
...@@ -353,7 +353,7 @@ function EditLinkModal({ ...@@ -353,7 +353,7 @@ function EditLinkModal({
<Flex alignItems={'center'} mt={4}> <Flex alignItems={'center'} mt={4}>
<Flex flex={'0 0 90px'} alignItems={'center'}> <Flex flex={'0 0 90px'} alignItems={'center'}>
<FormLabel>QPM</FormLabel> <FormLabel>QPM</FormLabel>
<QuestionTip ml={1} label={publishT('qpm_tips' || '')}></QuestionTip> <QuestionTip ml={1} label={publishT('qpm_tips')}></QuestionTip>
</Flex> </Flex>
<Input <Input
max={1000} max={1000}
...@@ -418,7 +418,7 @@ function EditLinkModal({ ...@@ -418,7 +418,7 @@ function EditLinkModal({
<FormLabel>{t('common:support.outlink.share.Response Quote')}</FormLabel> <FormLabel>{t('common:support.outlink.share.Response Quote')}</FormLabel>
<QuestionTip <QuestionTip
ml={1} ml={1}
label={t('common:support.outlink.share.Response Quote tips' || '')} label={t('common:support.outlink.share.Response Quote tips')}
></QuestionTip> ></QuestionTip>
</Flex> </Flex>
<Switch {...register('responseDetail')} isChecked={responseDetail} /> <Switch {...register('responseDetail')} isChecked={responseDetail} />
...@@ -428,7 +428,7 @@ function EditLinkModal({ ...@@ -428,7 +428,7 @@ function EditLinkModal({
<FormLabel>{t('common:support.outlink.share.show_complete_quote')}</FormLabel> <FormLabel>{t('common:support.outlink.share.show_complete_quote')}</FormLabel>
<QuestionTip <QuestionTip
ml={1} ml={1}
label={t('common:support.outlink.share.show_complete_quote_tips' || '')} label={t('common:support.outlink.share.show_complete_quote_tips')}
></QuestionTip> ></QuestionTip>
</Flex> </Flex>
<Switch <Switch
......
...@@ -178,7 +178,7 @@ export const useAudioPlay = ( ...@@ -178,7 +178,7 @@ export const useAudioPlay = (
await new Promise((resolve) => { await new Promise((resolve) => {
sourceBuffer.onupdateend = resolve; sourceBuffer.onupdateend = resolve;
sourceBuffer.appendBuffer(value.buffer); sourceBuffer.appendBuffer(value.buffer as any);
}); });
} }
} catch (error) { } catch (error) {
...@@ -311,7 +311,7 @@ export const useAudioPlay = ( ...@@ -311,7 +311,7 @@ export const useAudioPlay = (
await new Promise((resolve) => { await new Promise((resolve) => {
buffer.onupdateend = resolve; buffer.onupdateend = resolve;
buffer.appendBuffer(value.buffer); buffer.appendBuffer(value.buffer as any);
}); });
} }
} catch (error) { } catch (error) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment