Skip to content

Commit

Permalink
perf: prompt template
Browse files Browse the repository at this point in the history
  • Loading branch information
c121914yu committed Sep 18, 2023
1 parent 0677644 commit c430197
Show file tree
Hide file tree
Showing 5 changed files with 48 additions and 14 deletions.
2 changes: 1 addition & 1 deletion client/public/locales/en/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"UnKnow": "UnKnow",
"Warning": "Warning",
"app": {
"AI Chat Module Settings": "AI dialog advanced configuration",
"Quote Prompt Settings": "Quote Prompt Settings",
"Advance App TestTip": "The current application is advanced editing mode \n. If you need to switch to [simple mode], please click the save button on the left",
"App Detail": "App Detail",
"Chat Logs Tips": "Logs record the app's online, shared, and API(chatId is existing) conversations",
Expand Down
2 changes: 1 addition & 1 deletion client/public/locales/zh/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"UnKnow": "未知",
"Warning": "提示",
"app": {
"AI Chat Module Settings": "AI对话高级配置",
"Quote Prompt Settings": "引用提示词配置",
"Advance App TestTip": "当前应用为高级编排模式\n如需切换为【简易模式】请点击左侧保存按键",
"App Detail": "应用详情",
"Chat Logs Tips": "日志会记录该应用的在线、分享和 API(需填写 chatId) 对话记录",
Expand Down
2 changes: 1 addition & 1 deletion client/src/constants/flow/ModuleTemplate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ export const ChatModule: FlowModuleTemplateType = {
Input_Template_TFSwitch,
{
key: 'quoteQA',
type: FlowInputItemTypeEnum.target,
type: FlowInputItemTypeEnum.custom,
label: '引用内容',
description: "对象数组格式,结构:\n [{q:'问题',a:'回答'}]",
valueType: FlowValueTypeEnum.kbQuote
Expand Down
34 changes: 32 additions & 2 deletions client/src/pages/app/detail/components/AIChatSettingsModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,20 @@ import MyModal from '@/components/MyModal';
import { useTranslation } from 'react-i18next';
import { EditFormType } from '@/utils/app';
import { useForm } from 'react-hook-form';
import { Box, BoxProps, Button, ModalBody, ModalFooter, Textarea } from '@chakra-ui/react';
import {
Box,
BoxProps,
Button,
Flex,
Link,
ModalBody,
ModalFooter,
Textarea
} from '@chakra-ui/react';
import MyTooltip from '@/components/MyTooltip';
import { QuestionOutlineIcon } from '@chakra-ui/icons';
import { defaultQuotePrompt, defaultQuoteTemplate } from '@/prompts/core/AIChat';
import { feConfigs } from '@/store/static';

const AIChatSettingsModal = ({
onClose,
Expand All @@ -30,7 +40,27 @@ const AIChatSettingsModal = ({
};

return (
<MyModal isOpen title={t('app.AI Chat Module Settings')} w={'700px'}>
<MyModal
isOpen
title={
<Flex alignItems={'flex-end'}>
{t('app.Quote Prompt Settings')}
{feConfigs?.show_doc && (
<Link
href={'https://doc.fastgpt.run/docs/use-cases/prompt/'}
target={'_blank'}
ml={1}
textDecoration={'underline'}
fontWeight={'normal'}
fontSize={'md'}
>
查看说明
</Link>
)}
</Flex>
}
w={'700px'}
>
<ModalBody>
<Box>
<Box {...LabelStyles}>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@ import NodeCard from '../modules/NodeCard';
import { FlowModuleItemType } from '@/types/flow';
import Divider from '../modules/Divider';
import Container from '../modules/Container';
import RenderInput from '../render/RenderInput';
import RenderInput, { Label } from '../render/RenderInput';
import RenderOutput from '../render/RenderOutput';
import { FlowOutputItemTypeEnum } from '@/constants/flow';
import MySelect from '@/components/Select';
import { chatModelList } from '@/store/static';
import MySlider from '@/components/Slider';
import { Box, Button, useDisclosure } from '@chakra-ui/react';
import { Box, Button, Flex, useDisclosure } from '@chakra-ui/react';
import { formatPrice } from '@/utils/user';
import MyIcon from '@/components/Icon';
import dynamic from 'next/dynamic';
Expand Down Expand Up @@ -124,16 +124,20 @@ const NodeChat = ({ data }: NodeProps<FlowModuleItemType>) => {
/>
</Box>
);
},
quoteQA: (inputItem) => {
return (
<Button
variant={'base'}
leftIcon={<MyIcon name={'settingLight'} w={'14px'} />}
onClick={onOpenAIChatSetting}
>
引用提示词设置
</Button>
);
}
}}
/>
<Button
variant={'base'}
leftIcon={<MyIcon name={'settingLight'} w={'14px'} />}
onClick={onOpenAIChatSetting}
>
更多配置
</Button>
</Container>
<Divider text="Output" />
<Container>
Expand Down

0 comments on commit c430197

Please sign in to comment.