mirror of
https://github.com/labring/FastGPT.git
synced 2025-07-24 05:23:57 +00:00
V4.9.7 feature (#4669)
* update doc * feat: Add coupon redemption feature for team subscriptions (#4595) * feat: Add coupon redemption feature for team subscriptions - Introduced `TeamCouponSub` and `TeamCouponSchema` types - Added `redeemCoupon` API endpoint - Updated UI to include a modal for coupon redemption - Added new icon and translations for "Redeem coupon" * perf: remove field teamId * perf: use dynamic import * refactor: move to page component * perf: coupon code * perf: mcp server * perf: test * auto layout (#4634) * fix 4.9.6 (#4631) * fix debug quote list * delete next text node match * fix extract default boolean value * export latest 100 chat items * fix quote item ui * doc * fix doc * feat: auto layout * perf: auto layout * fix: auto layout null * add start node --------- Co-authored-by: heheer <heheer@sealos.io> * fix: share link (#4644) * Add workflow run duration;Get audio duration (#4645) * add duration * get audio duration * Custom config path (#4649) * feat: 通过环境变量DATA_PATH获取配置文件目录 (#4622) 通过环境变量DATA_PATH获取配置文件目录,以应对不同的部署方式的多样化需求 * feat: custom configjson path * doc --------- Co-authored-by: John Chen <sss1991@163.com> * 程序api调用场景下,如果大量调用带有图片或视频,产生的聊天记录会导致后台mongo数据库异常。这个修改给api客户端一个禁止生成聊天记录的选项,避免这个后果。 (#3964) * update special chatId * perf: vector db rename * update operationLog (#4647) * update operationLog * combine operationLogMap * solve operationI18nLogMap bug * remoce log * feat: Rerank usage (#4654) * refresh concat when update (#4655) * fix: refresh code * perf: timer lock * Fix operationLog (#4657) * perf: http streamable mcp * add alipay (#4630) * perf: subplan ui * perf: pay code * hiden bank tip * Fix: pay error (#4665) * fix quote number (#4666) * remove log --------- Co-authored-by: a.e. <49438478+I-Info@users.noreply.github.com> Co-authored-by: heheer <heheer@sealos.io> Co-authored-by: John Chen <sss1991@163.com> Co-authored-by: gaord <bengao168@msn.com> Co-authored-by: gggaaallleee <91131304+gggaaallleee@users.noreply.github.com>
This commit is contained in:
@@ -60,6 +60,7 @@ export type FastGPTFeConfigsType = {
|
||||
show_team_chat?: boolean;
|
||||
show_compliance_copywriting?: boolean;
|
||||
show_aiproxy?: boolean;
|
||||
show_coupon?: boolean;
|
||||
concatMd?: string;
|
||||
|
||||
concatMd?: string;
|
||||
@@ -106,6 +107,12 @@ export type FastGPTFeConfigsType = {
|
||||
lafEnv?: string;
|
||||
navbarItems?: NavbarItemType[];
|
||||
externalProviderWorkflowVariables?: ExternalProviderWorkflowVarType[];
|
||||
|
||||
payConfig?: {
|
||||
wx?: boolean;
|
||||
alipay?: boolean;
|
||||
bank?: boolean;
|
||||
};
|
||||
};
|
||||
|
||||
export type SystemEnvType = {
|
||||
|
@@ -26,7 +26,7 @@ export const getDefaultAppForm = (): AppSimpleEditFormType => {
|
||||
similarity: 0.4,
|
||||
limit: 3000,
|
||||
searchMode: DatasetSearchModeEnum.embedding,
|
||||
usingReRank: false,
|
||||
usingReRank: true,
|
||||
rerankModel: '',
|
||||
rerankWeight: 0.5,
|
||||
datasetSearchUsingExtensionQuery: true,
|
||||
|
3
packages/global/core/chat/type.d.ts
vendored
3
packages/global/core/chat/type.d.ts
vendored
@@ -110,6 +110,7 @@ export type ChatItemSchema = (UserChatItemType | SystemChatItemType | AIChatItem
|
||||
tmbId: string;
|
||||
appId: string;
|
||||
time: Date;
|
||||
durationSeconds?: number;
|
||||
};
|
||||
|
||||
export type AdminFbkType = {
|
||||
@@ -122,7 +123,6 @@ export type AdminFbkType = {
|
||||
|
||||
/* --------- chat item ---------- */
|
||||
export type ResponseTagItemType = {
|
||||
totalRunningTime?: number;
|
||||
totalQuoteList?: SearchDataResponseItemType[];
|
||||
llmModuleAccount?: number;
|
||||
historyPreviewLength?: number;
|
||||
@@ -141,6 +141,7 @@ export type ChatSiteItemType = (UserChatItemType | SystemChatItemType | AIChatIt
|
||||
ttsBuffer?: Uint8Array;
|
||||
responseData?: ChatHistoryItemResType[];
|
||||
time?: Date;
|
||||
durationSeconds?: number;
|
||||
} & ChatBoxInputType &
|
||||
ResponseTagItemType;
|
||||
|
||||
|
@@ -77,13 +77,6 @@ export const getHistoryPreview = (
|
||||
});
|
||||
};
|
||||
|
||||
export const filterModuleTypeList: any[] = [
|
||||
FlowNodeTypeEnum.pluginModule,
|
||||
FlowNodeTypeEnum.datasetSearchNode,
|
||||
FlowNodeTypeEnum.tools,
|
||||
FlowNodeTypeEnum.pluginOutput
|
||||
];
|
||||
|
||||
export const filterPublicNodeResponseData = ({
|
||||
flowResponses = [],
|
||||
responseDetail = false
|
||||
@@ -91,12 +84,19 @@ export const filterPublicNodeResponseData = ({
|
||||
flowResponses?: ChatHistoryItemResType[];
|
||||
responseDetail?: boolean;
|
||||
}) => {
|
||||
const publicNodeMap: Record<string, any> = {
|
||||
[FlowNodeTypeEnum.pluginModule]: true,
|
||||
[FlowNodeTypeEnum.datasetSearchNode]: true,
|
||||
[FlowNodeTypeEnum.tools]: true,
|
||||
[FlowNodeTypeEnum.pluginOutput]: true
|
||||
};
|
||||
|
||||
const filedList = responseDetail
|
||||
? ['quoteList', 'moduleType', 'pluginOutput', 'runningTime']
|
||||
: ['moduleType', 'pluginOutput', 'runningTime'];
|
||||
|
||||
return flowResponses
|
||||
.filter((item) => filterModuleTypeList.includes(item.moduleType))
|
||||
.filter((item) => publicNodeMap[item.moduleType])
|
||||
.map((item) => {
|
||||
const obj: DispatchNodeResponseType = {};
|
||||
for (let key in item) {
|
||||
|
@@ -2,6 +2,7 @@ import { FlowNodeInputTypeEnum } from '../node/constant';
|
||||
|
||||
export enum SseResponseEventEnum {
|
||||
error = 'error',
|
||||
workflowDuration = 'workflowDuration', // workflow duration
|
||||
answer = 'answer', // animation stream
|
||||
fastAnswer = 'fastAnswer', // direct answer text, not animation
|
||||
flowNodeStatus = 'flowNodeStatus', // update node status
|
||||
|
@@ -24,6 +24,7 @@ import { AiChatQuoteRoleType } from '../template/system/aiChat/type';
|
||||
import { LafAccountType, OpenaiAccountType } from '../../../support/user/team/type';
|
||||
import { CompletionFinishReason } from '../../ai/type';
|
||||
import { WorkflowInteractiveResponseType } from '../template/system/interactive/type';
|
||||
import { SearchDataResponseItemType } from '../../dataset/type';
|
||||
export type ExternalProviderType = {
|
||||
openaiAccount?: OpenaiAccountType;
|
||||
externalWorkflowVariables?: Record<string, string>;
|
||||
@@ -62,6 +63,8 @@ export type ChatDispatchProps = {
|
||||
workflowStreamResponse?: WorkflowResponseType;
|
||||
workflowDispatchDeep?: number;
|
||||
version?: 'v1' | 'v2';
|
||||
|
||||
responseAllData?: boolean;
|
||||
responseDetail?: boolean;
|
||||
};
|
||||
|
||||
@@ -136,12 +139,15 @@ export type DispatchNodeResponseType = {
|
||||
finishReason?: CompletionFinishReason;
|
||||
|
||||
// dataset search
|
||||
embeddingModel?: string;
|
||||
embeddingTokens?: number;
|
||||
similarity?: number;
|
||||
limit?: number;
|
||||
searchMode?: `${DatasetSearchModeEnum}`;
|
||||
embeddingWeight?: number;
|
||||
rerankModel?: string;
|
||||
rerankWeight?: number;
|
||||
reRankInputTokens?: number;
|
||||
searchUsingReRank?: boolean;
|
||||
queryExtensionResult?: {
|
||||
model: string;
|
||||
|
2
packages/global/support/mcp/type.d.ts
vendored
2
packages/global/support/mcp/type.d.ts
vendored
@@ -9,7 +9,7 @@ export type McpKeyType = {
|
||||
|
||||
export type McpAppType = {
|
||||
appId: string;
|
||||
appName?: string;
|
||||
toolName: string;
|
||||
toolAlias?: string;
|
||||
description: string;
|
||||
};
|
||||
|
@@ -4,6 +4,7 @@ export enum OperationLogEventEnum {
|
||||
JOIN_TEAM = 'JOIN_TEAM',
|
||||
CHANGE_MEMBER_NAME = 'CHANGE_MEMBER_NAME',
|
||||
KICK_OUT_TEAM = 'KICK_OUT_TEAM',
|
||||
RECOVER_TEAM_MEMBER = 'RECOVER_TEAM_MEMBER',
|
||||
CREATE_DEPARTMENT = 'CREATE_DEPARTMENT',
|
||||
CHANGE_DEPARTMENT = 'CHANGE_DEPARTMENT',
|
||||
DELETE_DEPARTMENT = 'DELETE_DEPARTMENT',
|
||||
|
20
packages/global/support/wallet/bill/api.d.ts
vendored
20
packages/global/support/wallet/bill/api.d.ts
vendored
@@ -1,5 +1,11 @@
|
||||
import { StandardSubLevelEnum, SubModeEnum } from '../sub/constants';
|
||||
import { BillTypeEnum } from './constants';
|
||||
import { BillTypeEnum, DrawBillQRItem } from './constants';
|
||||
|
||||
export type CreateOrderResponse = {
|
||||
qrCode?: string;
|
||||
iframeCode?: string;
|
||||
markdown?: string;
|
||||
};
|
||||
|
||||
export type CreateStandPlanBill = {
|
||||
type: BillTypeEnum.standSubPlan;
|
||||
@@ -22,6 +28,16 @@ export type CreateBillProps =
|
||||
|
||||
export type CreateBillResponse = {
|
||||
billId: string;
|
||||
codeUrl: string;
|
||||
readPrice: number;
|
||||
payment: BillPayWayEnum;
|
||||
} & CreateOrderResponse;
|
||||
|
||||
export type UpdatePaymentProps = {
|
||||
billId: string;
|
||||
payWay: BillPayWayEnum;
|
||||
};
|
||||
|
||||
export type CheckPayResultResponse = {
|
||||
status: BillStatusEnum;
|
||||
description?: string;
|
||||
};
|
||||
|
@@ -1,3 +1,5 @@
|
||||
import { i18nT } from '../../../../web/i18n/utils';
|
||||
|
||||
export enum BillTypeEnum {
|
||||
balance = 'balance',
|
||||
standSubPlan = 'standSubPlan',
|
||||
@@ -6,16 +8,16 @@ export enum BillTypeEnum {
|
||||
}
|
||||
export const billTypeMap = {
|
||||
[BillTypeEnum.balance]: {
|
||||
label: 'support.wallet.subscription.type.balance'
|
||||
label: i18nT('common:support.wallet.subscription.type.balance')
|
||||
},
|
||||
[BillTypeEnum.standSubPlan]: {
|
||||
label: 'support.wallet.subscription.type.standard'
|
||||
label: i18nT('common:support.wallet.subscription.type.standard')
|
||||
},
|
||||
[BillTypeEnum.extraDatasetSub]: {
|
||||
label: 'support.wallet.subscription.type.extraDatasetSize'
|
||||
label: i18nT('common:support.wallet.subscription.type.extraDatasetSize')
|
||||
},
|
||||
[BillTypeEnum.extraPoints]: {
|
||||
label: 'support.wallet.subscription.type.extraPoints'
|
||||
label: i18nT('common:support.wallet.subscription.type.extraPoints')
|
||||
}
|
||||
};
|
||||
|
||||
@@ -27,32 +29,46 @@ export enum BillStatusEnum {
|
||||
}
|
||||
export const billStatusMap = {
|
||||
[BillStatusEnum.SUCCESS]: {
|
||||
label: 'support.wallet.bill.status.success'
|
||||
label: i18nT('common:support.wallet.bill.status.success')
|
||||
},
|
||||
[BillStatusEnum.REFUND]: {
|
||||
label: 'support.wallet.bill.status.refund'
|
||||
label: i18nT('common:support.wallet.bill.status.refund')
|
||||
},
|
||||
[BillStatusEnum.NOTPAY]: {
|
||||
label: 'support.wallet.bill.status.notpay'
|
||||
label: i18nT('common:support.wallet.bill.status.notpay')
|
||||
},
|
||||
[BillStatusEnum.CLOSED]: {
|
||||
label: 'support.wallet.bill.status.closed'
|
||||
label: i18nT('common:support.wallet.bill.status.closed')
|
||||
}
|
||||
};
|
||||
|
||||
export enum BillPayWayEnum {
|
||||
balance = 'balance',
|
||||
wx = 'wx'
|
||||
wx = 'wx',
|
||||
alipay = 'alipay',
|
||||
bank = 'bank',
|
||||
coupon = 'coupon'
|
||||
}
|
||||
|
||||
export const billPayWayMap = {
|
||||
[BillPayWayEnum.balance]: {
|
||||
label: 'support.wallet.bill.payWay.balance'
|
||||
label: i18nT('common:support.wallet.bill.payWay.balance')
|
||||
},
|
||||
[BillPayWayEnum.wx]: {
|
||||
label: 'support.wallet.bill.payWay.wx'
|
||||
label: i18nT('common:support.wallet.bill.payWay.wx')
|
||||
},
|
||||
[BillPayWayEnum.alipay]: {
|
||||
label: i18nT('common:support.wallet.bill.payWay.alipay')
|
||||
},
|
||||
[BillPayWayEnum.bank]: {
|
||||
label: i18nT('common:support.wallet.bill.payWay.bank')
|
||||
},
|
||||
[BillPayWayEnum.coupon]: {
|
||||
label: i18nT('account_bill:payway_coupon')
|
||||
}
|
||||
};
|
||||
|
||||
export const SUB_DATASET_SIZE_RATE = 1000;
|
||||
export const SUB_EXTRA_POINT_RATE = 1000;
|
||||
export const MAX_WX_PAY_AMOUNT = 6000;
|
||||
export const QR_CODE_SIZE = 210;
|
||||
|
@@ -1,6 +1,7 @@
|
||||
import { StandardSubLevelEnum, SubModeEnum, SubTypeEnum } from '../sub/constants';
|
||||
import { BillPayWayEnum, BillTypeEnum } from './constants';
|
||||
import { BillPayWayEnum, BillStatusEnum, BillTypeEnum } from './constants';
|
||||
import { TeamInvoiceHeaderType } from '../../user/team/type';
|
||||
|
||||
export type BillSchemaType = {
|
||||
_id: string;
|
||||
userId: string;
|
||||
@@ -8,7 +9,7 @@ export type BillSchemaType = {
|
||||
tmbId: string;
|
||||
createTime: Date;
|
||||
orderId: string;
|
||||
status: 'SUCCESS' | 'REFUND' | 'NOTPAY' | 'CLOSED';
|
||||
status: `${BillStatusEnum}`;
|
||||
type: BillTypeEnum;
|
||||
price: number;
|
||||
hasInvoice: boolean;
|
||||
|
@@ -1,4 +1,5 @@
|
||||
import { i18nT } from '../../../../web/i18n/utils';
|
||||
import { BillTypeEnum } from '../bill/constants';
|
||||
|
||||
export enum SubTypeEnum {
|
||||
standard = 'standard',
|
||||
@@ -9,15 +10,18 @@ export enum SubTypeEnum {
|
||||
export const subTypeMap = {
|
||||
[SubTypeEnum.standard]: {
|
||||
label: 'support.wallet.subscription.type.standard',
|
||||
icon: 'support/account/plans'
|
||||
icon: 'support/account/plans',
|
||||
orderType: BillTypeEnum.standSubPlan
|
||||
},
|
||||
[SubTypeEnum.extraDatasetSize]: {
|
||||
label: 'support.wallet.subscription.type.extraDatasetSize',
|
||||
icon: 'core/dataset/datasetLight'
|
||||
icon: 'core/dataset/datasetLight',
|
||||
orderType: BillTypeEnum.extraDatasetSub
|
||||
},
|
||||
[SubTypeEnum.extraPoints]: {
|
||||
label: 'support.wallet.subscription.type.extraPoints',
|
||||
icon: 'core/chat/chatLight'
|
||||
icon: 'core/chat/chatLight',
|
||||
orderType: BillTypeEnum.extraPoints
|
||||
}
|
||||
};
|
||||
|
||||
|
16
packages/global/support/wallet/sub/coupon/type.d.ts
vendored
Normal file
16
packages/global/support/wallet/sub/coupon/type.d.ts
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
import { SubTypeEnum, StandardSubLevelEnum } from '../constants';
|
||||
|
||||
export type TeamCouponSub = {
|
||||
type: `${SubTypeEnum}`; // Sub type
|
||||
durationDay: number; // Duration day
|
||||
level?: `${StandardSubLevelEnum}`; // Standard sub level
|
||||
extraDatasetSize?: number; // Extra dataset size
|
||||
totalPoints?: number; // Total points(Extrapoints or Standard sub)
|
||||
};
|
||||
|
||||
export type TeamCouponSchema = {
|
||||
key: string;
|
||||
subscriptions: TeamCouponSub[];
|
||||
redeemedAt?: Date;
|
||||
expiredAt?: Date;
|
||||
};
|
2
packages/global/support/wallet/sub/type.d.ts
vendored
2
packages/global/support/wallet/sub/type.d.ts
vendored
@@ -15,7 +15,7 @@ export type TeamStandardSubPlanItemType = {
|
||||
permissionCustomApiKey: boolean;
|
||||
permissionCustomCopyright: boolean; // feature
|
||||
permissionWebsiteSync: boolean;
|
||||
permissionReRank: boolean;
|
||||
permissionTeamOperationLog: boolean;
|
||||
};
|
||||
|
||||
export type StandSubPlanLevelMapType = Record<
|
||||
|
@@ -3,5 +3,5 @@
|
||||
"compilerOptions": {
|
||||
"baseUrl": "."
|
||||
},
|
||||
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", "**/*.d.ts", "../service/core/app/mcp.ts"]
|
||||
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", "**/*.d.ts"]
|
||||
}
|
||||
|
Reference in New Issue
Block a user