Skip to content

Commit

Permalink
Ai histories (#1376)
Browse files Browse the repository at this point in the history
* perf: workflow node ui

* i18n

* rename controller

* fix: zindex

* fix: leave page callback

* revert button
  • Loading branch information
c121914yu authored May 7, 2024
1 parent eef609a commit 9e192c6
Show file tree
Hide file tree
Showing 13 changed files with 116 additions and 111 deletions.
6 changes: 3 additions & 3 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@
"i18n-ally.localesPaths": [
"projects/app/i18n",
],
"i18n-ally.enabledParsers": ["json"],
"i18n-ally.enabledParsers": ["json", "yaml", "js", "ts"],
"i18n-ally.keystyle": "nested",
"i18n-ally.sortKeys": true,
"i18n-ally.keepFulfilled": true,
"i18n-ally.keepFulfilled": false,
"i18n-ally.sourceLanguage": "zh", // 根据此语言文件翻译其他语言文件的变量和内容
"i18n-ally.displayLanguage": "zh", // 显示语言
"i18n-ally.displayLanguage": "zh" // 显示语言
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { FlowNodeTemplateTypeEnum, WorkflowIOValueTypeEnum } from '../../constants';
import { getHandleConfig } from '../utils';
import { FlowNodeTypeEnum } from '../../node/constant';
import { FlowNodeOutputTypeEnum, FlowNodeTypeEnum } from '../../node/constant';
import { VariableItemType } from '../../../app/type';
import { FlowNodeTemplateType } from '../../type';

Expand All @@ -25,6 +25,7 @@ export const getGlobalVariableNode = ({
id: item.key,
key: item.key,
valueType: WorkflowIOValueTypeEnum.string,
type: FlowNodeOutputTypeEnum.static,
label: item.label
}))
};
Expand Down
2 changes: 1 addition & 1 deletion packages/global/core/workflow/template/system/tools.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export const ToolModule: FlowNodeTemplateType = {
sourceHandle: getHandleConfig(true, true, false, true),
targetHandle: getHandleConfig(true, true, false, true),
avatar: '/imgs/workflow/tool.svg',
name: '工具调用(实验)',
name: '工具调用(实验)',
intro: '通过AI模型自动选择一个或多个功能块进行调用,也可以对插件进行调用。',
showStatus: true,
inputs: [
Expand Down
2 changes: 1 addition & 1 deletion packages/service/core/workflow/dispatch/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ export const filterToolNodeIdByEdges = ({

export const getHistories = (history?: ChatItemType[] | number, histories: ChatItemType[] = []) => {
if (!history) return [];
if (typeof history === 'number') return histories.slice(-history);
if (typeof history === 'number') return histories.slice(-(history * 2));
if (Array.isArray(history)) return history;

return [];
Expand Down
2 changes: 1 addition & 1 deletion packages/web/hooks/useBeforeunload.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export const useBeforeunload = (props?: { callback?: () => any; tip?: string })

useEffect(() => {
const listen =
process.env.NODE_ENV !== 'production'
process.env.NODE_ENV === 'production'
? (e: any) => {
e.preventDefault();
e.returnValue = tip;
Expand Down
4 changes: 2 additions & 2 deletions packages/web/hooks/useEditTextarea.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -92,9 +92,9 @@ export const useEditTextarea = ({
closeBtnText?: string;
}) => (
<MyModal isOpen={isOpen} onClose={onClose} iconSrc={iconSrc} title={title} maxW={'500px'}>
<ModalBody>
<ModalBody pt={tip ? '3 !important' : '5 !important'}>
{!!tip && (
<Box mb={2} color={'myGray.500'} fontSize={'sm'}>
<Box mb={3} color={'myGray.500'} fontSize={'sm'}>
{tip}
</Box>
)}
Expand Down
8 changes: 3 additions & 5 deletions projects/app/i18n/en/common.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
{
"App": "App",
"Create New": "Create New",
"Export": "Export",
"Folder": "Folder",
"Move": "Move",
"Name": "Name",
"Rename": "Rename",
"Running": "Running",
"Select value is empty": "Selected value is empty",
"UnKnow": "Unknown",
"Warning": "Warning",
"app": {
Expand Down Expand Up @@ -646,7 +644,8 @@
"success": "Sync started"
}
},
"training": {}
"training": {
}
},
"data": {
"Auxiliary Data": "Auxiliary Data",
Expand Down Expand Up @@ -1167,7 +1166,7 @@
},
"publish": {
"OnRevert version": "Click back to that version",
"OnRevert version confirm": "Are you sure to roll back the version?",
"OnRevert version confirm": "Sure you want to roll back to this version? The configuration for the version in editing is saved for you and a new release is created for the rollback version.",
"histories": "Publiish histories"
},
"tool": {
Expand Down Expand Up @@ -1204,7 +1203,6 @@
"Select Dataset": "Select this knowledge base",
"Select Dataset Tips": "Only knowledge bases of the same index model can be selected",
"Select Folder": "Enter folder",
"System Data Queue": "Queue Length",
"Training Name": "Data Training",
"Upload Time": "Upload Time",
"collections": {
Expand Down
8 changes: 3 additions & 5 deletions projects/app/i18n/zh/common.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
{
"App": "应用",
"Create New": "",
"Export": "导出",
"Folder": "文件夹",
"Move": "移动",
"Name": "名称",
"Rename": "重命名",
"Running": "运行中",
"Select value is empty": "选择的内容为空",
"UnKnow": "未知",
"Warning": "提示",
"app": {
Expand Down Expand Up @@ -646,7 +644,8 @@
"success": "开始同步"
}
},
"training": {}
"training": {
}
},
"data": {
"Auxiliary Data": "辅助数据",
Expand Down Expand Up @@ -1167,7 +1166,7 @@
},
"publish": {
"OnRevert version": "点击回退到该版本",
"OnRevert version confirm": "确认回退该版本?",
"OnRevert version confirm": "确认回退至该版本?会为您保存编辑中版本的配置,并为回退版本创建一个新的发布版本。",
"histories": "发布记录"
},
"tool": {
Expand Down Expand Up @@ -1204,7 +1203,6 @@
"Select Dataset": "选择该知识库",
"Select Dataset Tips": "仅能选择同一个索引模型的知识库",
"Select Folder": "进入文件夹",
"System Data Queue": "排队长度",
"Training Name": "数据训练",
"Upload Time": "上传时间",
"collections": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ const ChatTest = (
return (
<>
<Flex
zIndex={3}
zIndex={101}
flexDirection={'column'}
position={'absolute'}
top={5}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ const NodeDatasetConcat = ({ data, selected }: NodeProps<FlowNodeItemType>) => {
</Box>
<Box flex={'1 0 0'} />
<Button
variant={'transparentBase'}
variant={'whitePrimary'}
leftIcon={<SmallAddIcon />}
iconSpacing={1}
size={'sm'}
Expand Down
Loading

0 comments on commit 9e192c6

Please sign in to comment.