Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

4.8.18 test #3543

Merged
merged 4 commits into from
Jan 7, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 10 additions & 7 deletions docSite/content/zh-cn/docs/development/upgrading/4818.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,13 @@ weight: 806
## 完整更新内容

1.
2. 新增 - 支持部门架构权限模式
3. 优化 - 图片上传安全校验。并增加头像图片唯一存储,确保不会累计存储。
4. 优化 - Mongo 全文索引表分离。
5. 优化 - 知识库检索查询语句合并,同时减少查库数量。
6. 优化 - 文件编码检测,减少 CSV 文件乱码概率。
7. 优化 - 异步读取文件内容,减少进程阻塞。
8. 修复 - HTML 文件上传,base64 图片无法自动转图片链接。
2. 新增 - 支持部门架构权限模式。
3. 新增 - 支持配置自定跨域安全策略,默认全开。
4. 优化 - 图片上传安全校验。并增加头像图片唯一存储,确保不会累计存储。
5. 优化 - Mongo 全文索引表分离。
6. 优化 - 知识库检索查询语句合并,同时减少查库数量。
7. 优化 - 文件编码检测,减少 CSV 文件乱码概率。
8. 优化 - 异步读取文件内容,减少进程阻塞。
9. 优化 - 文件阅读,HTML 直接下载,不允许在线阅读。
10. 修复 - HTML 文件上传,base64 图片无法自动转图片链接。
11. 修复 - 插件计费错误。
1 change: 1 addition & 0 deletions packages/global/core/ai/model.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ export type VectorModelItemType = PriceType & {
};

export type ReRankModelItemType = PriceType & {
provider: ModelProviderIdType;
model: string;
name: string;
requestUrl: string;
Expand Down
32 changes: 0 additions & 32 deletions packages/global/support/permission/collaborator.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,40 +20,8 @@ export type UpdateClbPermissionProps = {
permission: PermissionValueType;
};

export type DeleteClbPermissionProps = RequireOnlyOne<{
tmbId: string;
groupId: string;
orgId: string;
}>;

export type UpdatePermissionBody = {
permission: PermissionValueType;
} & RequireOnlyOne<{
memberId: string;
groupId: string;
orgId: string;
}>;

export type CreatePermissionBody = {
tmbId: string[];
groupId: string[];
orgId: string[];
};

export type DeletePermissionQuery = RequireOnlyOne<{
tmbId?: string;
groupId?: string;
orgId?: string;
}>;

export type TeamClbsListType = {
permission: number;
name: string;
avatar: string;
};

export type ListPermissionResponse = {
tmb: (TeamClbsListType & { tmbId: string })[];
group: (TeamClbsListType & { groupId: string })[];
org: (TeamClbsListType & { orgId: string })[];
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"provider": "OpenAI",
"model": "text-embedding-ada-002",
"name": "text-embedding-ada-002",

"defaultToken": 512, // 默认分块 token
"maxToken": 3000, // 最大分块 token
"weight": 0, // 权重

"charsPointsPrice": 0 // 积分/1k token
}
33 changes: 33 additions & 0 deletions packages/service/core/ai/config/llm/gpt-4o-mini.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
{
"provider": "OpenAI",
"model": "gpt-4o-mini",
"name": "GPT-4o-mini", // alias

"maxContext": 125000, // 最大上下文
"maxResponse": 16000, // 最大回复
"quoteMaxToken": 60000, // 最大引用
"maxTemperature": 1.2, // 最大温度
"presencePenaltyRange": [-2, 2], // 惩罚系数范围
"frequencyPenaltyRange": [-2, 2], // 频率惩罚系数范围
"responseFormatList": ["text", "json_object", "json_schema"], // 响应格式
"showStopSign": true, // 是否显示停止符号

"vision": true, // 是否支持图片识别
"toolChoice": true, // 是否支持工具调用
"functionCall": false, // 是否支持函数调用(一般都可以 false 了,基本不用了)
"defaultSystemChatPrompt": "", // 默认系统提示

"datasetProcess": true, // 用于知识库文本处理
"usedInClassify": true, // 用于问题分类
"customCQPrompt": "", // 自定义问题分类提示
"usedInExtractFields": true, // 用于提取字段
"customExtractPrompt": "", // 自定义提取提示
"usedInToolCall": true, // 用于工具调用
"usedInQueryExtension": true, // 用于问题优化

"defaultConfig": {}, // 额外的自定义 body
"fieldMap": {}, // body 字段映射

"censor": false, // 是否开启敏感词过滤
"charsPointsPrice": 0 // n 积分/1k token
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"provider": "BAAI",
"model": "bge-reranker-v2-m3",
"name": "bge-reranker-v2-m3",
"charsPointsPrice": 0
}
6 changes: 6 additions & 0 deletions packages/service/core/ai/config/stt/whisper-1.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"provider": "OpenAI",
"model": "whisper-1",
"name": "whisper-1",
"charsPointsPrice": 0
}
32 changes: 32 additions & 0 deletions packages/service/core/ai/config/tts/tts-1.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{
"provider": "OpenAI",
"model": "tts-1",
"name": "TTS1",
"charsPointsPrice": 0,
"voices": [
{
"label": "Alloy",
"value": "alloy"
},
{
"label": "Echo",
"value": "echo"
},
{
"label": "Fable",
"value": "fable"
},
{
"label": "Onyx",
"value": "onyx"
},
{
"label": "Nova",
"value": "nova"
},
{
"label": "Shimmer",
"value": "shimmer"
}
]
}
12 changes: 6 additions & 6 deletions packages/service/core/app/plugin/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ import { PluginSourceEnum } from '@fastgpt/global/core/plugin/constants';

/*
Plugin points calculation:
1. 商业版插件:
1. 系统插件/商业版插件:
- 有错误:返回 0
- 无错误:返回 配置的点数 + 子节点点数
2. 其他插件:
- 返回 子节点点数
- 无错误:返回 单次积分 + 子流程积分(可配置)
2. 个人插件
- 返回 子流程积分
*/
export const computedPluginUsage = async ({
plugin,
Expand All @@ -26,9 +26,9 @@ export const computedPluginUsage = async ({
if (source !== PluginSourceEnum.personal) {
if (error) return 0;

const pluginCurrentCose = plugin.currentCost ?? 0;
const pluginCurrentCost = plugin.currentCost ?? 0;

return plugin.hasTokenFee ? pluginCurrentCose + childrenUsages : pluginCurrentCose;
return plugin.hasTokenFee ? pluginCurrentCost + childrenUsages : pluginCurrentCost;
}

return childrenUsages;
Expand Down
56 changes: 11 additions & 45 deletions packages/service/support/permission/controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,7 @@ import { authOpenApiKey } from '../openapi/auth';
import { FileTokenQuery } from '@fastgpt/global/common/file/type';
import { MongoResourcePermission } from './schema';
import { ClientSession } from 'mongoose';
import {
PermissionValueType,
ResourcePermissionType
} from '@fastgpt/global/support/permission/type';
import { PermissionValueType } from '@fastgpt/global/support/permission/type';
import { bucketNameMap } from '@fastgpt/global/common/file/constants';
import { addMinutes } from 'date-fns';
import { getGroupsByTmbId } from './memberGroup/controllers';
Expand Down Expand Up @@ -107,44 +104,6 @@ export const getResourcePermission = async ({
return concatPer([...groupPers, ...orgPers]);
};

/* 仅取 members 不取 groups */
export async function getResourceAllClbs({
resourceId,
teamId,
resourceType,
session
}: {
teamId: string;
session?: ClientSession;
} & (
| {
resourceType: 'team';
resourceId?: undefined;
}
| {
resourceType: Omit<PerResourceTypeEnum, 'team'>;
resourceId?: string | null;
}
)): Promise<ResourcePermissionType[]> {
return MongoResourcePermission.find(
{
resourceType: resourceType,
teamId: teamId,
resourceId,
groupId: {
$exists: false
},
orgId: {
$exists: false
}
},
null,
{
session
}
).lean();
}

export async function getResourceClbsAndGroups({
resourceId,
resourceType,
Expand Down Expand Up @@ -172,10 +131,17 @@ export const getClbsAndGroupsWithInfo = async ({
resourceType,
teamId
}: {
resourceId: ParentIdType;
resourceType: Omit<`${PerResourceTypeEnum}`, 'team'>;
teamId: string;
}) =>
} & (
| {
resourceId: ParentIdType;
resourceType: Omit<`${PerResourceTypeEnum}`, 'team'>;
}
| {
resourceType: 'team';
resourceId?: undefined;
}
)) =>
Promise.all([
MongoResourcePermission.find({
teamId,
Expand Down
1 change: 0 additions & 1 deletion packages/web/components/common/Icon/button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ const MyIconButton = ({
}: Props) => {
return (
<Flex
mr={1}
p={1}
color={'myGray.500'}
rounded={'sm'}
Expand Down
14 changes: 8 additions & 6 deletions packages/web/components/common/Tabs/FillRowTabs.tsx
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import React from 'react';
import React, { forwardRef } from 'react';
import { Flex, Box, BoxProps } from '@chakra-ui/react';
import MyIcon from '../Icon';

type Props = Omit<BoxProps, 'onChange'> & {
type Props<T = string> = Omit<BoxProps, 'onChange'> & {
list: {
icon?: string;
label: string | React.ReactNode;
value: string;
value: T;
}[];
value: string;
onChange: (e: string) => void;
value: T;
onChange: (e: T) => void;
};

const FillRowTabs = ({ list, value, onChange, py = '7px', px = '12px', ...props }: Props) => {
Expand Down Expand Up @@ -61,4 +61,6 @@ const FillRowTabs = ({ list, value, onChange, py = '7px', px = '12px', ...props
);
};

export default FillRowTabs;
export default forwardRef(FillRowTabs) as <T>(
props: Props<T> & { ref?: React.Ref<HTMLSelectElement> }
) => JSX.Element;
7 changes: 7 additions & 0 deletions packages/web/i18n/en/account.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,14 @@
{
"active_model": "Available models",
"add_default_model": "Add a preset model",
"api_key": "API key",
"bills_and_invoices": "Bills",
"channel": "Channel",
"confirm_logout": "Confirm to log out?",
"create_channel": "Add new channel",
"create_model": "Add new model",
"custom_model": "custom model",
"default_model": "Default model",
"logout": "Sign out",
"model_provider": "Model Provider",
"notifications": "Notify",
Expand Down
1 change: 1 addition & 0 deletions packages/web/i18n/en/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -1187,6 +1187,7 @@
"tag_list": "Tag List",
"team_tag": "Team Tag",
"textarea_variable_picker_tip": "Enter \"/\" to select a variable",
"unauth_token": "The certificate has expired, please log in again",
"unit.character": "Character",
"unit.minute": "Minute",
"unit.seconds": "Second",
Expand Down
2 changes: 1 addition & 1 deletion packages/web/i18n/en/workflow.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
"execution_error": "Execution Error",
"extraction_requirements_description": "Extraction Requirements Description",
"extraction_requirements_description_detail": "Provide AI with some background knowledge or requirements to guide it in completing the task better.\\nThis input box can use global variables.",
"extraction_requirements_placeholder": "For example: \\n1. The current time is: {{cTime}}. You are a lab reservation assistant, and your task is to help users reserve a lab by extracting the corresponding reservation information from the text.\\n2. You are a Google search assistant, and you need to extract suitable search terms from the text.",
"extraction_requirements_placeholder": "For example: 1. The current time is: {{cTime}}. \nYou are a laboratory reservation assistant. Your task is to help users make laboratory reservations and obtain the corresponding reservation information from the text.\n\n2. You are the Google Search Assistant and need to extract appropriate search terms from text.",
"feedback_text": "Feedback Text",
"field_description": "Field Description",
"field_description_placeholder": "Describe the function of this input field. If it is a tool call parameter, this description will affect the quality of the model generation.",
Expand Down
7 changes: 7 additions & 0 deletions packages/web/i18n/zh-CN/account.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,14 @@
{
"active_model": "可用模型",
"add_default_model": "添加预设模型",
"api_key": "API 密钥",
"bills_and_invoices": "账单与发票",
"channel": "渠道",
"confirm_logout": "确认退出登录?",
"create_channel": "新增渠道",
"create_model": "新增模型",
"custom_model": "自定义模型",
"default_model": "预设模型",
"logout": "登出",
"model_provider": "模型提供商",
"notifications": "通知",
Expand Down
1 change: 1 addition & 0 deletions packages/web/i18n/zh-CN/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -1190,6 +1190,7 @@
"tag_list": "标签列表",
"team_tag": "团队标签",
"textarea_variable_picker_tip": "输入\"/\"可选择变量",
"unauth_token": "凭证已过期,请重新登录",
"unit.character": "字符",
"unit.minute": "分钟",
"unit.seconds": "秒",
Expand Down
2 changes: 1 addition & 1 deletion packages/web/i18n/zh-CN/user.json
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@
"team.group.set_as_admin": "设为管理员",
"team.group.toast.can_not_delete_owner": "不能删除所有者, 请先转让",
"team.group.transfer_owner": "转让所有者",
"team.org.org": "组织",
"team.org.org": "部门",
"team.manage_collaborators": "管理协作者",
"team.no_collaborators": "暂无协作者",
"team.write_role_member": "可写权限",
Expand Down
2 changes: 1 addition & 1 deletion packages/web/i18n/zh-CN/workflow.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
"execution_error": "运行错误",
"extraction_requirements_description": "提取要求描述",
"extraction_requirements_description_detail": "给AI一些对应的背景知识或要求描述,引导AI更好的完成任务。\\n该输入框可使用全局变量。",
"extraction_requirements_placeholder": "例如: \\n1. 当前时间为: {{cTime}}。你是一个实验室预约助手,你的任务是帮助用户预约实验室,从文本中获取对应的预约信息。\\n2. 你是谷歌搜索助手,需要从文本中提取出合适的搜索词。",
"extraction_requirements_placeholder": "例如: 1. 当前时间为: {{cTime}}。你是一个实验室预约助手,你的任务是帮助用户预约实验室,从文本中获取对应的预约信息。\n2. 你是谷歌搜索助手,需要从文本中提取出合适的搜索词。",
"feedback_text": "反馈的文本",
"field_description": "字段描述",
"field_description_placeholder": "描述该输入字段的功能,如果为工具调用参数,则该描述会影响模型生成的质量",
Expand Down
7 changes: 7 additions & 0 deletions packages/web/i18n/zh-Hant/account.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,14 @@
{
"active_model": "可用模型",
"add_default_model": "新增預設模型",
"api_key": "API 金鑰",
"bills_and_invoices": "帳單與發票",
"channel": "頻道",
"confirm_logout": "確認登出登入?",
"create_channel": "新增頻道",
"create_model": "新增模型",
"custom_model": "自訂模型",
"default_model": "預設模型",
"logout": "登出",
"model_provider": "模型提供者",
"notifications": "通知",
Expand Down
Loading
Loading