mirror of
https://github.com/labring/FastGPT.git
synced 2025-12-25 20:02:47 +00:00
fix
This commit is contained in:
parent
c940705930
commit
c75294f56e
|
|
@ -1,3 +1,4 @@
|
|||
import { z } from 'zod';
|
||||
import { AppSchema } from '../../core/app/type';
|
||||
import type { PublishChannelEnum } from './constant';
|
||||
import { RequireOnlyOne } from '../../common/type/utils';
|
||||
|
|
@ -113,3 +114,10 @@ export type PlaygroundVisibilityConfigType = {
|
|||
showFullText: boolean;
|
||||
showRawSource: boolean;
|
||||
};
|
||||
|
||||
export const PlaygroundVisibilityConfigSchema = z.object({
|
||||
showNodeStatus: z.boolean(),
|
||||
responseDetail: z.boolean(),
|
||||
showFullText: z.boolean(),
|
||||
showRawSource: z.boolean()
|
||||
});
|
||||
|
|
|
|||
|
|
@ -302,6 +302,7 @@
|
|||
"pro_modal_title": "Business Edition Exclusive!",
|
||||
"pro_modal_unlock_button": "Unlock Now",
|
||||
"publish.chat_desc": "After logging into the portal, users can talk directly to the application",
|
||||
"publish.playground_link": "Redirect Link",
|
||||
"publish_channel": "Publish",
|
||||
"publish_success": "Publish Successful",
|
||||
"question_guide_tip": "After the conversation, 3 guiding questions will be generated for you.",
|
||||
|
|
|
|||
|
|
@ -314,6 +314,7 @@
|
|||
"pro_modal_title": "商业版专享!",
|
||||
"pro_modal_unlock_button": "去解锁",
|
||||
"publish.chat_desc": "用户登录门户后可直接与应用对话",
|
||||
"publish.playground_link": "跳转链接",
|
||||
"publish_channel": "发布渠道",
|
||||
"publish_channel.wecom.empty": "发布到企业微信机器人,请先 <a>绑定自定义域名</a>,并且通过域名校验。",
|
||||
"publish_success": "发布成功",
|
||||
|
|
|
|||
|
|
@ -300,6 +300,7 @@
|
|||
"pro_modal_title": "商業版專享!",
|
||||
"pro_modal_unlock_button": "去解鎖",
|
||||
"publish.chat_desc": "用戶登錄門戶後可直接與應用對話",
|
||||
"publish.playground_link": "跳轉鏈接",
|
||||
"publish_channel": "發布通道",
|
||||
"publish_success": "發布成功",
|
||||
"question_guide_tip": "對話結束後,會為你產生 3 個引導性問題。",
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import React from 'react';
|
||||
import { Box, Flex, Grid, Switch } from '@chakra-ui/react';
|
||||
import React, { useMemo } from 'react';
|
||||
import { Box, Flex, Grid, Switch, Button, Link } from '@chakra-ui/react';
|
||||
import { useTranslation } from 'next-i18next';
|
||||
import { useForm } from 'react-hook-form';
|
||||
import FormLabel from '@fastgpt/web/components/common/MyBox/FormLabel';
|
||||
|
|
@ -10,6 +10,8 @@ import {
|
|||
updatePlaygroundVisibilityConfig
|
||||
} from '@/web/support/outLink/api';
|
||||
import type { PlaygroundVisibilityConfigType } from '@fastgpt/global/support/outLink/type';
|
||||
import MyIcon from '@fastgpt/web/components/common/Icon';
|
||||
import { useCopyData } from '@fastgpt/web/hooks/useCopyData';
|
||||
|
||||
const defaultPlaygroundVisibilityForm: PlaygroundVisibilityConfigType = {
|
||||
showNodeStatus: true,
|
||||
|
|
@ -20,6 +22,7 @@ const defaultPlaygroundVisibilityForm: PlaygroundVisibilityConfigType = {
|
|||
|
||||
const PlaygroundVisibilityConfig = ({ appId }: { appId: string }) => {
|
||||
const { t } = useTranslation();
|
||||
const { copyData } = useCopyData();
|
||||
|
||||
const { register, watch, setValue, reset } = useForm({
|
||||
defaultValues: defaultPlaygroundVisibilityForm
|
||||
|
|
@ -29,6 +32,13 @@ const PlaygroundVisibilityConfig = ({ appId }: { appId: string }) => {
|
|||
const showFullText = watch('showFullText');
|
||||
const showRawSource = watch('showRawSource');
|
||||
|
||||
const playgroundLink = useMemo(() => {
|
||||
if (typeof window !== 'undefined') {
|
||||
return `${window.location.origin}/chat?appId=${appId}`;
|
||||
}
|
||||
return '';
|
||||
}, [appId]);
|
||||
|
||||
useRequest2(() => getPlaygroundVisibilityConfig({ appId }), {
|
||||
onSuccess: (data) => {
|
||||
reset({
|
||||
|
|
@ -60,6 +70,36 @@ const PlaygroundVisibilityConfig = ({ appId }: { appId: string }) => {
|
|||
|
||||
return (
|
||||
<Flex flexDirection="column" h="100%">
|
||||
<Box fontSize={'sm'} fontWeight={'medium'} color={'myGray.900'} mb={3}>
|
||||
{t('app:publish.playground_link')}
|
||||
</Box>
|
||||
|
||||
<Box borderRadius={'md'} bg={'myGray.100'} overflow={'hidden'} fontSize={'sm'} mb={6}>
|
||||
<Flex
|
||||
p={3}
|
||||
bg={'myWhite.500'}
|
||||
border="base"
|
||||
borderTopLeftRadius={'md'}
|
||||
borderTopRightRadius={'md'}
|
||||
alignItems={'center'}
|
||||
>
|
||||
<Box flex={1} fontSize={'xs'} color={'myGray.600'}>
|
||||
{t('common:core.app.outLink.Link block title')}
|
||||
</Box>
|
||||
<MyIcon
|
||||
name={'copy'}
|
||||
w={'16px'}
|
||||
color={'myGray.600'}
|
||||
cursor={'pointer'}
|
||||
_hover={{ color: 'primary.500' }}
|
||||
onClick={() => copyData(playgroundLink)}
|
||||
/>
|
||||
</Flex>
|
||||
<Box whiteSpace={'nowrap'} p={3} overflowX={'auto'}>
|
||||
{playgroundLink}
|
||||
</Box>
|
||||
</Box>
|
||||
|
||||
<Box fontSize={'sm'} fontWeight={'medium'} color={'myGray.900'}>
|
||||
{t('publish:private_config')}
|
||||
</Box>
|
||||
|
|
|
|||
|
|
@ -7,7 +7,8 @@ import {
|
|||
type PlaygroundVisibilityConfigResponse,
|
||||
PlaygroundVisibilityConfigQuerySchema,
|
||||
PlaygroundVisibilityConfigResponseSchema
|
||||
} from '@fastgpt/global/support/outLink/api';
|
||||
} from '@fastgpt/global/support/outLink/api.d';
|
||||
|
||||
async function handler(
|
||||
req: ApiRequestProps<{}, PlaygroundVisibilityConfigQuery>
|
||||
): Promise<PlaygroundVisibilityConfigResponse> {
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ import { NextAPI } from '@/service/middleware/entry';
|
|||
import {
|
||||
type UpdatePlaygroundVisibilityConfigBody,
|
||||
UpdatePlaygroundVisibilityConfigBodySchema
|
||||
} from '@fastgpt/global/support/outLink/api';
|
||||
} from '@fastgpt/global/support/outLink/api.d';
|
||||
|
||||
async function handler(req: ApiRequestProps<UpdatePlaygroundVisibilityConfigBody, {}>) {
|
||||
const { appId, showNodeStatus, responseDetail, showFullText, showRawSource } =
|
||||
|
|
|
|||
Loading…
Reference in New Issue