Skip to content

Commit

Permalink
setting modal
Browse files Browse the repository at this point in the history
  • Loading branch information
c121914yu committed Mar 20, 2024
1 parent 2e968ea commit a91496e
Show file tree
Hide file tree
Showing 8 changed files with 46 additions and 33 deletions.
4 changes: 2 additions & 2 deletions packages/service/core/workflow/dispatch/dataset/search.ts
Original file line number Diff line number Diff line change
Expand Up @@ -157,8 +157,8 @@ export async function dispatchDatasetSearch(
[DispatchNodeResponseKeyEnum.nodeResponse]: responseData,
nodeDispatchUsages,
[DispatchNodeResponseKeyEnum.toolResponses]: searchRes.map((item) => ({
text: `${item.q}\n${item.a}`.trim(),
chunkIndex: item.chunkIndex
id: item.id,
text: `${item.q}\n${item.a}`.trim()
}))
};
}
2 changes: 2 additions & 0 deletions projects/app/public/locales/en/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,7 @@
"Max context": "Max context",
"Model": "Model",
"Prompt": "Prompt",
"Support tool": "Function call",
"model": {
"Dataset Agent Model": "Agent Model",
"Vector Model": "Vector Model"
Expand Down Expand Up @@ -289,6 +290,7 @@
"Team tags": "Team tags",
"Temperature": "Temperature",
"Tool call": "Tool call",
"Tool call tip": "The AI model automatically selects one or more tools to use. If this feature is enabled, the knowledge base call is also called as a tool. Please try to choose the AI model that supports \"function call\", the effect is better.",
"ToolCall": {
"No plugin": "No plugins",
"Setting tool": "Setting tool",
Expand Down
2 changes: 2 additions & 0 deletions projects/app/public/locales/zh/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,7 @@
"Max context": "最大上下文",
"Model": "AI 模型",
"Prompt": "提示词",
"Support tool": "函数调用",
"model": {
"Dataset Agent Model": "文件处理模型",
"Vector Model": "索引模型"
Expand Down Expand Up @@ -289,6 +290,7 @@
"Team tags": "团队标签",
"Temperature": "温度",
"Tool call": "工具调用",
"Tool call tip": "通过AI模型自动选择一个或多个工具进行使用。如果启动该功能,知识库调用也会被当做一个工具调用。请尽量选择支持“函数调用”的AI模型,效果更好。",
"ToolCall": {
"No plugin": "没有可用的插件",
"Setting tool": "配置工具",
Expand Down
17 changes: 8 additions & 9 deletions projects/app/src/components/ChatBox/components/ChatItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,7 @@ import {
AccordionButton,
AccordionPanel,
AccordionIcon,
Button,
Image,
Grid
Image
} from '@chakra-ui/react';
import React, { useMemo } from 'react';
import ChatController, { type ChatControllerProps } from './ChatController';
Expand Down Expand Up @@ -114,11 +112,12 @@ ${JSON.stringify(questionGuides)}`;
}

return (
<Markdown
key={key}
source={source}
showAnimation={isLastChild && isChatting && i === chat.value.length - 1}
/>
<Box key={key}>
<Markdown
source={source}
showAnimation={isLastChild && isChatting && i === chat.value.length - 1}
/>
</Box>
);
}
if (value.type === ChatItemValueTypeEnum.tool && value.tools) {
Expand Down Expand Up @@ -246,4 +245,4 @@ ${toolResponse}`}
);
};

export default ChatItem;
export default React.memo(ChatItem);
9 changes: 9 additions & 0 deletions projects/app/src/components/core/ai/AISettingModal/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ const AIChatSettingsModal = ({
<MyModal
isOpen
iconSrc="/imgs/module/AI.png"
onClose={onClose}
title={
<>
{t('core.ai.AI settings')}
Expand Down Expand Up @@ -115,6 +116,14 @@ const AIChatSettingsModal = ({
{selectedModel?.maxContext || 4096}Tokens
</Box>
</Flex>
<Flex mt={8}>
<Box {...LabelStyles} mr={2}>
{t('core.ai.Support tool')}
</Box>
<Box flex={1} ml={'10px'}>
{selectedModel?.usedInToolCall ? '支持' : '不支持'}
</Box>
</Flex>
<Flex mt={8}>
<Box {...LabelStyles} mr={2}>
{t('core.app.Temperature')}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -315,6 +315,9 @@ const EditForm = ({
<Flex alignItems={'center'} flex={1}>
<MyIcon name={'core/app/toolCall'} w={'20px'} />
<Box ml={2}>{t('core.app.Tool call')}(实验功能)</Box>
<MyTooltip label={t('core.app.Tool call tip')}>
<QuestionOutlineIcon ml={1} />
</MyTooltip>
</Flex>
<Flex alignItems={'center'} {...BoxBtnStyles} onClick={onOpenToolsSelect}>
<SmallAddIcon />
Expand Down
40 changes: 19 additions & 21 deletions projects/app/src/pages/chat/team.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,19 +36,23 @@ import MyBox from '@/components/common/MyBox';
import SliderApps from './components/SliderApps';
import { GPTMessages2Chats } from '@fastgpt/global/core/chat/adapt';

const OutLink = ({
teamId,
appId,
chatId,
teamToken
}: {
teamId: string;
appId: string;
chatId: string;
teamToken: string;
}) => {
const OutLink = () => {
const { t } = useTranslation();
const router = useRouter();
const {
teamId = '',
appId = '',
chatId = '',
teamToken,
...customVariables
} = router.query as {
teamId: string;
appId: string;
chatId: string;
teamToken: string;
[key: string]: string;
};

const { toast } = useToast();
const theme = useTheme();
const { isPc } = useSystemStore();
Expand Down Expand Up @@ -78,7 +82,10 @@ const OutLink = ({
const { responseText, responseData } = await streamFetch({
data: {
messages: prompts,
variables,
variables: {
...customVariables,
...variables
},
appId,
teamId,
teamToken,
Expand Down Expand Up @@ -372,17 +379,8 @@ const OutLink = ({
};

export async function getServerSideProps(context: any) {
const teamId = context?.query?.teamId || '';
const appId = context?.query?.appId || '';
const chatId = context?.query?.chatId || '';
const teamToken: string = context?.query?.teamToken || '';

return {
props: {
teamId,
appId,
chatId,
teamToken,
...(await serviceSideProps(context))
}
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ const HttpPluginEditModal = ({
}

const schema = await getApiSchemaByUrl(schemaUrl);
setValue('metadata.apiSchemaStr', JSON.stringify(schema));
setValue('metadata.apiSchemaStr', JSON.stringify(schema, null, 2));

onCloseUrlImport();
},
Expand Down

0 comments on commit a91496e

Please sign in to comment.