Skip to content

Commit

Permalink
v4.6.4-Outlink (#589)
Browse files Browse the repository at this point in the history
  • Loading branch information
c121914yu authored Dec 12, 2023
1 parent d2d7eac commit e18c79c
Show file tree
Hide file tree
Showing 79 changed files with 1,094 additions and 762 deletions.
20 changes: 11 additions & 9 deletions docSite/content/docs/development/upgrading/464.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,16 @@ curl --location --request POST 'https://{{host}}/api/admin/initv464' \

1. 重写 - 分享链接身份逻辑,采用 localID 记录用户的ID。
2. 商业版新增 - 分享链接 SSO 方案,通过`身份鉴权`地址,仅需`3个接口`即可完全接入已有用户系统。具体参考[分享链接身份鉴权](/docs/development/openapi/share/)
3. 调整 - 知识库搜索模块 topk 逻辑,采用 MaxToken 计算,兼容不同长度的文本块
4. 调整鉴权顺序,提高 apikey 的优先级,避免cookie抢占 apikey 的鉴权。
5. 链接读取支持多选择器。参考[Web 站点同步用法](/docs/course/webSync)
6. 修复 - 分享链接图片上传鉴权问题
7. 修复 - Mongo 连接池未释放问题。
8. 修复 - Dataset Intro 无法更新
9. 修复 - md 代码块问题
10. 修复 - root 权限问题
11. 优化 docker file
3. 新增 - 分享链接更多嵌入方式提示,更多DIY方式。
4. 优化 - 历史记录模块。弃用旧的历史记录模块,直接在对应地方填写数值即可。
5. 调整 - 知识库搜索模块 topk 逻辑,采用 MaxToken 计算,兼容不同长度的文本块
6. 调整鉴权顺序,提高 apikey 的优先级,避免cookie抢占 apikey 的鉴权。
7. 链接读取支持多选择器。参考[Web 站点同步用法](/docs/course/webSync)
8. 修复 - 分享链接图片上传鉴权问题
9. 修复 - Mongo 连接池未释放问题。
10. 修复 - Dataset Intro 无法更新
11. 修复 - md 代码块问题
12. 修复 - root 权限问题
13. 优化 docker file


1 change: 1 addition & 0 deletions packages/global/core/chat/api.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
export type UpdateChatFeedbackProps = {
appId: string;
chatId: string;
chatItemId: string;
shareId?: string;
Expand Down
5 changes: 4 additions & 1 deletion packages/global/core/module/node/constant.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,11 @@ export enum FlowNodeInputTypeEnum {
selectApp = 'selectApp',
// chat special input
aiSettings = 'aiSettings',
// maxToken = 'maxToken',

// model select
selectChatModel = 'selectChatModel',
selectCQModel = 'selectCQModel',

// dataset special input
selectDataset = 'selectDataset',
selectDatasetParamsModal = 'selectDatasetParamsModal',
Expand Down
6 changes: 5 additions & 1 deletion packages/global/core/module/template/input.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,13 @@ export const Input_Template_TFSwitch: FlowNodeInputItemType = {

export const Input_Template_History: FlowNodeInputItemType = {
key: ModuleInputKeyEnum.history,
type: FlowNodeInputTypeEnum.target,
type: FlowNodeInputTypeEnum.numberInput,
label: 'core.module.input.label.chat history',
required: true,
min: 0,
max: 30,
valueType: ModuleDataTypeEnum.chatHistory,
value: 6,
showTargetInApp: true,
showTargetInPlugin: true
};
Expand Down
7 changes: 1 addition & 6 deletions packages/global/core/module/template/system/aiChat.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,6 @@ export const AiChatModule: FlowModuleTemplateType = {
type: FlowNodeInputTypeEnum.hidden,
label: '引用内容模板',
valueType: ModuleDataTypeEnum.string,
value: '',
showTargetInApp: false,
showTargetInPlugin: false
},
Expand All @@ -96,15 +95,13 @@ export const AiChatModule: FlowModuleTemplateType = {
type: FlowNodeInputTypeEnum.hidden,
label: '引用内容提示词',
valueType: ModuleDataTypeEnum.string,
value: '',
showTargetInApp: false,
showTargetInPlugin: false
},
{
key: ModuleInputKeyEnum.aiChatSettingModal,
type: FlowNodeInputTypeEnum.aiSettings,
label: '',
connected: false,
valueType: ModuleDataTypeEnum.any,
showTargetInApp: false,
showTargetInPlugin: false
Expand All @@ -118,21 +115,19 @@ export const AiChatModule: FlowModuleTemplateType = {
valueType: ModuleDataTypeEnum.string,
description: chatNodeSystemPromptTip,
placeholder: chatNodeSystemPromptTip,
value: '',
showTargetInApp: true,
showTargetInPlugin: true
},
Input_Template_History,
{
key: ModuleInputKeyEnum.aiChatDatasetQuote,
type: FlowNodeInputTypeEnum.target,
label: '引用内容',
description: "对象数组格式,结构:\n [{q:'问题',a:'回答'}]",
valueType: ModuleDataTypeEnum.datasetQuote,
connected: false,
showTargetInApp: true,
showTargetInPlugin: true
},
Input_Template_History,
Input_Template_UserChatInput
],
outputs: [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ export const AssignedAnswerModule: FlowModuleTemplateType = {
key: ModuleInputKeyEnum.answerText,
type: FlowNodeInputTypeEnum.textarea,
valueType: ModuleDataTypeEnum.any,
value: '',
label: '回复的内容',
description:
'可以使用 \\n 来实现连续换行。\n\n可以通过外部模块输入实现回复,外部模块输入时会覆盖当前填写的内容。\n\n如传入非字符串类型数据将会自动转成字符串',
Expand Down
15 changes: 7 additions & 8 deletions packages/global/core/module/template/system/classifyQuestion.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export const ClassifyQuestionModule: FlowModuleTemplateType = {
Input_Template_TFSwitch,
{
key: ModuleInputKeyEnum.aiModel,
type: FlowNodeInputTypeEnum.selectChatModel,
type: FlowNodeInputTypeEnum.selectCQModel,
valueType: ModuleDataTypeEnum.string,
label: '分类模型',
required: true,
Expand All @@ -38,7 +38,6 @@ export const ClassifyQuestionModule: FlowModuleTemplateType = {
key: ModuleInputKeyEnum.aiSystemPrompt,
type: FlowNodeInputTypeEnum.textarea,
valueType: ModuleDataTypeEnum.string,
value: '',
label: '背景知识',
description:
'你可以添加一些特定内容的介绍,从而更好的识别用户的问题类型。这个内容通常是给模型介绍一个它不知道的内容。',
Expand All @@ -57,15 +56,15 @@ export const ClassifyQuestionModule: FlowModuleTemplateType = {
value: [
{
value: '打招呼',
key: 'fasw'
key: 'wqre'
},
{
value: '关于 xxx 的问题',
key: 'fqsw'
key: 'sdfa'
},
{
value: '其他问题',
key: 'fesw'
key: 'agex'
}
],
showTargetInApp: false,
Expand All @@ -75,19 +74,19 @@ export const ClassifyQuestionModule: FlowModuleTemplateType = {
outputs: [
// custom output
{
key: 'fasw',
key: 'wqre',
label: '',
type: FlowNodeOutputTypeEnum.hidden,
targets: []
},
{
key: 'fqsw',
key: 'sdfa',
label: '',
type: FlowNodeOutputTypeEnum.hidden,
targets: []
},
{
key: 'fesw',
key: 'agex',
label: '',
type: FlowNodeOutputTypeEnum.hidden,
targets: []
Expand Down
5 changes: 2 additions & 3 deletions packages/global/core/module/template/system/contextExtract.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,11 @@ export const ContextExtractModule: FlowModuleTemplateType = {
key: ModuleInputKeyEnum.description,
type: FlowNodeInputTypeEnum.textarea,
valueType: ModuleDataTypeEnum.string,
value: '',
label: '提取要求描述',
description: '写一段提取要求,告诉 AI 需要提取哪些内容',
description: '给AI一些对应的背景知识或要求描述,引导AI更好的完成任务',
required: true,
placeholder:
'例如: \n1. 你是一个实验室预约助手。根据用户问题,提取出姓名、实验室号和预约时间',
'例如: \n1. 你是一个实验室预约助手,你的任务是帮助用户预约实验室。\n2. 你是谷歌搜索助手,需要从文本中提取出合适的搜索词。',
showTargetInApp: true,
showTargetInPlugin: true
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,6 @@ export const DatasetSearchModule: FlowModuleTemplateType = {
key: ModuleInputKeyEnum.datasetParamsModal,
type: FlowNodeInputTypeEnum.selectDatasetParamsModal,
label: '',
connected: false,
valueType: ModuleDataTypeEnum.any,
showTargetInApp: false,
showTargetInPlugin: false
Expand Down
2 changes: 1 addition & 1 deletion packages/global/core/module/template/system/history.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export const HistoryModule: FlowModuleTemplateType = {
templateType: ModuleTemplateTypeEnum.systemInput,
flowType: FlowNodeTypeEnum.historyNode,
avatar: '/imgs/module/history.png',
name: '聊天记录',
name: '聊天记录(弃用)',
intro: '用户输入的内容。该模块通常作为应用的入口,用户在发送消息后会首先执行该模块。',
inputs: [
{
Expand Down
1 change: 0 additions & 1 deletion packages/global/core/module/template/system/http.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ export const HttpModule: FlowModuleTemplateType = {
Input_Template_TFSwitch,
{
key: ModuleInputKeyEnum.httpUrl,
value: '',
type: FlowNodeInputTypeEnum.input,
valueType: ModuleDataTypeEnum.string,
label: '请求地址',
Expand Down
2 changes: 1 addition & 1 deletion packages/global/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"encoding": "^0.1.13",
"js-tiktoken": "^1.0.7",
"node-html-markdown": "^1.3.0",
"openai": "^4.16.1",
"openai": "^4.20.1",
"timezones-list": "^3.0.2"
},
"devDependencies": {
Expand Down
5 changes: 3 additions & 2 deletions packages/service/common/api/plusRequest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,9 @@ instance.interceptors.request.use(requestStart, (err) => Promise.reject(err));
instance.interceptors.response.use(responseSuccess, (err) => Promise.reject(err));

export function request(url: string, data: any, config: ConfigType, method: Method): any {
if (global.systemEnv && !global.systemEnv?.pluginBaseUrl) {
return Promise.reject('该功能为商业版特有...');
if (!global.systemEnv || !global.systemEnv?.pluginBaseUrl) {
console.log('未部署商业版接口');
return Promise.reject('The The request was denied...');
}

/* 去空 */
Expand Down
2 changes: 1 addition & 1 deletion packages/service/core/chat/controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export async function getChatItems({
return { history: [] };
}

const history = await MongoChatItem.find({ chatId }, field).sort({ _id: -1 }).limit(limit);
const history = await MongoChatItem.find({ chatId }, field).sort({ _id: -1 }).limit(limit).lean();

history.reverse();

Expand Down
2 changes: 1 addition & 1 deletion packages/service/support/outLink/tools.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export const pushResult2Remote = async ({
shareId?: string;
responseData?: any[];
}) => {
if (!shareId || !outLinkUid || !global.systemEnv.pluginBaseUrl) return;
if (!shareId || !outLinkUid || !global.systemEnv?.pluginBaseUrl) return;
try {
const outLink = await MongoOutLink.findOne({
shareId
Expand Down
29 changes: 24 additions & 5 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions projects/app/data/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,9 @@
],
"CQModels": [
{
"model": "gpt-3.5-turbo-1106",
"name": "GPT35-1106",
"maxContext": 16000,
"model": "gpt-3.5-turbo",
"name": "GPT35",
"maxContext": 4000,
"maxResponse": 4000,
"price": 0,
"functionCall": true,
Expand Down
2 changes: 1 addition & 1 deletion projects/app/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "app",
"version": "4.6.3",
"version": "4.6.4",
"private": false,
"scripts": {
"dev": "next dev",
Expand Down
23 changes: 9 additions & 14 deletions projects/app/public/docs/versionIntro.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,12 @@

1. 重写 - 分享链接身份逻辑,采用 localID 记录用户的ID。
2. 商业版新增 - 分享链接 SSO 方案,通过`身份鉴权`地址,仅需`3个接口`即可完全接入已有用户系统。具体参考[分享链接身份鉴权](https://doc.fastgpt.in/docs/development/openapi/share/)
3. 调整 - 知识库搜索模块 topk 逻辑,采用 MaxToken 计算,兼容不同长度的文本块
4. 调整鉴权顺序,提高 apikey 的优先级,避免cookie抢占 apikey 的鉴权。
5. 链接读取支持多选择器。参考[Web 站点同步用法](https://doc.fastgpt.in/docs/course/webSync)
6. 修复 - 分享链接图片上传鉴权问题
7. 修复 - Mongo 连接池未释放问题。
8. 修复 - Dataset Intro 无法更新
9. 修复 - md 代码块问题
10. 修复 - root 权限问题
11. 优化 docker file
12. [知识库结构详解](https://doc.fastgpt.in/docs/use-cases/datasetengine/)
13. [知识库提示词详解](https://doc.fastgpt.in/docs/use-cases/ai_settings/#引用模板--引用提示词)
14. [使用文档](https://doc.fastgpt.in/docs/intro/)
15. [点击查看高级编排介绍文档](https://doc.fastgpt.in/docs/workflow)
16. [点击查看商业版](https://doc.fastgpt.in/docs/commercial/)
3. 新增 - 分享链接更多嵌入方式提示,更多DIY方式。
4. 优化 - 历史记录模块。弃用旧的历史记录模块,直接在对应地方填写数值即可。
5. 调整 - 知识库搜索模块 topk 逻辑,采用 MaxToken 计算,兼容不同长度的文本块
6. 链接读取支持多选择器。参考[Web 站点同步用法](https://doc.fastgpt.in/docs/course/webSync)
7. [知识库结构详解](https://doc.fastgpt.in/docs/use-cases/datasetengine/)
8. [知识库提示词详解](https://doc.fastgpt.in/docs/use-cases/ai_settings/#引用模板--引用提示词)
9. [使用文档](https://doc.fastgpt.in/docs/intro/)
10. [点击查看高级编排介绍文档](https://doc.fastgpt.in/docs/workflow)
11. [点击查看商业版](https://doc.fastgpt.in/docs/commercial/)
1 change: 1 addition & 0 deletions projects/app/public/imgs/modal/usingWay.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit e18c79c

Please sign in to comment.