Skip to content

Commit

Permalink
perf: rename variable
Browse files Browse the repository at this point in the history
  • Loading branch information
c121914yu committed Jul 25, 2024
1 parent 69e1134 commit d0cc043
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 18 deletions.
22 changes: 12 additions & 10 deletions docSite/content/zh-cn/docs/development/upgrading/488.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,15 @@ weight: 816
2. 新增 - DuckDuckGo 系统插件。
3. 新增 - 飞书 webhook 系统插件。
4. 新增 - 修改变量填写方式。提示词输入框以以及工作流中所有 Textarea 输入框,支持输入 / 唤起变量选择,可直接选择所有上游输出值,无需动态引入。
5. 优化 - 移动端快速切换应用交互。
6. 优化 - 节点图标。
7. 优化 - 对话框引用增加额外复制案件,便于复制。增加引用内容折叠。
8. 优化 - 对话框底部增加复制,简便复制交互,无需滚动到消息开头。
9. 优化 - OpenAI sdk 升级,并自定义了 whisper 模型接口(未仔细查看 sdk 实现,但 sdk 中 whisper 接口,似乎无法适配一般 fastapi 接口)
10. 修复 - Permission 表声明问题。
11. 修复 - 并行执行节点,运行时间未正确记录。
12. 修复 - 简易模式,首次进入,无法正确获取知识库配置。
13. 修复 - Log debug level 配置无效。
14. 修复 - 插件独立运行时,会将插件输入的值进行变量替换,可能导致后续节点变量异常。
5. 商业版新增 - 知识库权限继承。
6. 优化 - 移动端快速切换应用交互。
7. 优化 - 节点图标。
8. 优化 - 对话框引用增加额外复制案件,便于复制。增加引用内容折叠。
9. 优化 - 对话框底部增加复制,简便复制交互,无需滚动到消息开头。
10. 优化 - OpenAI sdk 升级,并自定义了 whisper 模型接口(未仔细查看 sdk 实现,但 sdk 中 whisper 接口,似乎无法适配一般 fastapi 接口)
11. 修复 - Permission 表声明问题。
12. 修复 - 并行执行节点,运行时间未正确记录。
13. 修复 - 运行详情未正确展示嵌套节点信息。
14. 修复 - 简易模式,首次进入,无法正确获取知识库配置。
15. 修复 - Log debug level 配置无效。
16. 修复 - 插件独立运行时,会将插件输入的值进行变量替换,可能导致后续节点变量异常。
2 changes: 1 addition & 1 deletion packages/global/core/workflow/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ export const updatePluginInputByVariables = (
);
};

export const filterPluginInputVariables = (
export const removePluginInputVariables = (
variables: Record<string, any>,
nodes: RuntimeNodeItemType[]
) => {
Expand Down
11 changes: 8 additions & 3 deletions packages/service/common/mongo/init.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { delay } from '@fastgpt/global/common/system/utils';
import { addLog } from '../system/log';
import { connectionMongo } from './index';
import type { Mongoose } from 'mongoose';
Expand All @@ -17,9 +18,11 @@ export async function connectMongo(): Promise<Mongoose> {
try {
connectionMongo.set('strictQuery', true);

connectionMongo.connection.on('error', (error) => {
connectionMongo.connection.on('error', async (error) => {
console.log('mongo error', error);
connectionMongo.disconnect();
await connectionMongo.disconnect();
await delay(1000);
connectMongo();
});
connectionMongo.connection.on('disconnected', () => {
console.log('mongo disconnected');
Expand All @@ -44,8 +47,10 @@ export async function connectMongo(): Promise<Mongoose> {

console.log('mongo connected');
} catch (error) {
connectionMongo.disconnect();
addLog.error('mongo connect error', error);
await connectionMongo.disconnect();
await delay(1000);
connectMongo();
}

return connectionMongo;
Expand Down
4 changes: 2 additions & 2 deletions projects/app/src/pages/api/core/chat/chatTest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import { removeEmptyUserInput } from '@fastgpt/global/core/chat/utils';
import { ReadPermissionVal } from '@fastgpt/global/support/permission/constant';
import { AppTypeEnum } from '@fastgpt/global/core/app/constants';
import {
filterPluginInputVariables,
removePluginInputVariables,
updatePluginInputByVariables
} from '@fastgpt/global/core/workflow/utils';
import { NextAPI } from '@/service/middleware/entry';
Expand Down Expand Up @@ -66,7 +66,7 @@ async function handler(req: NextApiRequest, res: NextApiResponse) {
// Plugin need to replace inputs
if (isPlugin) {
nodes = updatePluginInputByVariables(nodes, variables);
variables = filterPluginInputVariables(variables, nodes);
variables = removePluginInputVariables(variables, nodes);
} else {
if (!userInput) {
throw new Error('Params Error');
Expand Down
4 changes: 2 additions & 2 deletions projects/app/src/pages/api/v1/chat/completions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ import { getAppLatestVersion } from '@fastgpt/service/core/app/controller';
import { ReadPermissionVal } from '@fastgpt/global/support/permission/constant';
import { AppTypeEnum } from '@fastgpt/global/core/app/constants';
import {
filterPluginInputVariables,
removePluginInputVariables,
updatePluginInputByVariables
} from '@fastgpt/global/core/workflow/utils';
import { getNanoid } from '@fastgpt/global/common/string/tools';
Expand Down Expand Up @@ -238,7 +238,7 @@ async function handler(req: NextApiRequest, res: NextApiResponse) {
)
: storeNodes2RuntimeNodes(nodes, getDefaultEntryNodeIds(nodes));

const runtimeVariables = filterPluginInputVariables(
const runtimeVariables = removePluginInputVariables(
variables,
storeNodes2RuntimeNodes(nodes, getDefaultEntryNodeIds(nodes))
);
Expand Down

0 comments on commit d0cc043

Please sign in to comment.