V4.14.4 features (#6036)

* feat: add query optimize and bill (#6021)

* add query optimize and bill

* perf: query extension

* fix: embe model

* remove log

* remove log

* fix: test

---------

Co-authored-by: xxyyh <2289112474@qq>
Co-authored-by: archer <545436317@qq.com>

* feat: notice (#6013)

* feat: record user's language

* feat: notice points/dataset indexes; support count limit; update docker-compose.yml

* fix: ts error

* feat: send auth code i18n

* chore: dataset notice limit

* chore: adjust

* fix: ts

* fix: countLimit race condition; i18n en-prefix locale fallback to en

---------

Co-authored-by: archer <545436317@qq.com>

* perf: comment

* perf: send inform code

* fix: type error (#6029)

* feat: add ip region for chat logs (#6010)

* feat: add ip region for chat logs

* refactor: use Geolite2.mmdb

* fix: export chat logs

* fix: return location directly

* test: add unit test

* perf: log show ip data

* adjust commercial plans (#6008)

* plan frontend

* plan limit

* coupon

* discount coupon

* fix

* type

* fix audit

* type

* plan name

* legacy plan

* track

* feat: add discount coupon

* fix

* fix discount coupon

* openapi

* type

* type

* env

* api type

* fix

* fix: simple agent plugin input & agent dashboard card (#6034)

* refactor: remove gridfs (#6031)

* fix: replace gridfs multer operations with s3 compatible ops

* wip: s3 features

* refactor: remove gridfs

* fix

* perf: mock test

* doc

* doc

* doc

* fix: test

* fix: s3

* fix: mock s3

* remove invalid config

* fix: init query extension

* initv4144 (#6037)

* chore: initv4144

* fix

* version

* fix: new plans (#6039)

* fix: new plans

* qr modal tip

* fix: buffer raw text filename (#6040)

* fix: initv4144 (#6041)

* fix: pay refresh (#6042)

* fix: migration shell

* rename collection

* clear timerlock

* clear timerlock

* perf: faq

* perf: bill schema

* fix: openapi

* doc

* fix: share var render

* feat: delete dataset queue

* plan usage display (#6043)

* plan usage display

* text

* fix

* fix: ts

* perf: remove invalid code

* perf: init shell

* doc

* perf: rename field

* perf: avatar presign

* init

* custom plan text (#6045)

* fix plans

* fix

* fixed

* computed

---------

Co-authored-by: archer <545436317@qq.com>

* init shell

* plan text & price page back button (#6046)

* init

* index

* delete dataset

* delete dataset

* perf: delete dataset

* init

---------

Co-authored-by: YeYuheng <57035043+YYH211@users.noreply.github.com>
Co-authored-by: xxyyh <2289112474@qq>
Co-authored-by: Finley Ge <32237950+FinleyGe@users.noreply.github.com>
Co-authored-by: Roy <whoeverimf5@gmail.com>
Co-authored-by: heheer <heheer@sealos.io>
This commit is contained in:
Archer
2025-12-08 01:44:15 +08:00
committed by GitHub
parent 9d72f238c0
commit 2ccb5b50c6
247 changed files with 7342 additions and 3819 deletions
-44
View File
@@ -1,44 +0,0 @@
import type { StandardSubLevelEnum, SubModeEnum } from '../sub/constants';
import type { BillTypeEnum, BillPayWayEnum } from './constants';
import { DrawBillQRItem } from './constants';
export type CreateOrderResponse = {
qrCode?: string;
iframeCode?: string;
markdown?: string;
};
export type CreateStandPlanBill = {
type: BillTypeEnum.standSubPlan;
level: `${StandardSubLevelEnum}`;
subMode: `${SubModeEnum}`;
};
type CreateExtractPointsBill = {
type: BillTypeEnum.extraPoints;
extraPoints: number;
};
type CreateExtractDatasetBill = {
type: BillTypeEnum.extraDatasetSub;
extraDatasetSize: number;
month: number;
};
export type CreateBillProps =
| CreateStandPlanBill
| CreateExtractPointsBill
| CreateExtractDatasetBill;
export type CreateBillResponse = {
billId: string;
readPrice: number;
payment: BillPayWayEnum;
} & CreateOrderResponse;
export type UpdatePaymentProps = {
billId: string;
payWay: BillPayWayEnum;
};
export type CheckPayResultResponse = {
status: BillStatusEnum;
description?: string;
};
@@ -1,13 +1,5 @@
import type { PriceOption } from './type';
// 根据积分获取月份
export const getMonthByPoints = (points: number) => {
if (points >= 200) return 12;
if (points >= 100) return 6;
if (points >= 50) return 3;
return 1;
};
// 根据月份获取积分下限
export const getMinPointsByMonth = (month: number): number => {
switch (month) {
-65
View File
@@ -1,65 +0,0 @@
import type { StandardSubLevelEnum, SubModeEnum } from '../sub/constants';
import { SubTypeEnum } from '../sub/constants';
import type { BillPayWayEnum, BillStatusEnum, BillTypeEnum } from './constants';
import type { TeamInvoiceHeaderType } from '../../user/team/type';
export type BillSchemaType = {
_id: string;
userId: string;
teamId: string;
tmbId: string;
createTime: Date;
orderId: string;
status: `${BillStatusEnum}`;
type: BillTypeEnum;
price: number;
hasInvoice: boolean;
metadata: {
payWay: `${BillPayWayEnum}`;
subMode?: `${SubModeEnum}`;
standSubLevel?: `${StandardSubLevelEnum}`;
month?: number;
datasetSize?: number;
extraPoints?: number;
};
refundData?: {
amount: number;
refundId: string;
refundTime: Date;
};
};
export type ChatNodeUsageType = {
inputTokens?: number;
outputTokens?: number;
totalPoints: number;
moduleName: string;
model?: string;
};
export type InvoiceType = {
amount: number;
billIdList: string[];
} & TeamInvoiceHeaderType;
export type InvoiceSchemaType = {
_id: string;
teamId: string;
status: 1 | 2;
createTime: Date;
finishTime?: Date;
file?: Buffer;
} & InvoiceType;
export type AIPointsPriceOption = {
type: 'points';
points: number;
};
export type DatasetPriceOption = {
type: 'dataset';
size: number;
month: number;
};
export type PriceOption = AIPointsPriceOption | DatasetPriceOption;
@@ -0,0 +1,76 @@
import { StandardSubLevelEnum, SubModeEnum } from '../sub/constants';
import { SubTypeEnum } from '../sub/constants';
import { BillPayWayEnum, BillStatusEnum, BillTypeEnum } from './constants';
import type { TeamInvoiceHeaderType } from '../../user/team/type';
import { z } from 'zod';
import { ObjectIdSchema } from '../../../common/type/mongo';
export const BillSchema = z.object({
_id: ObjectIdSchema.meta({ description: '订单 ID' }),
userId: ObjectIdSchema.meta({ description: '用户 ID' }),
teamId: ObjectIdSchema.meta({ description: '团队 ID' }),
tmbId: ObjectIdSchema.meta({ description: '团队成员 ID' }),
createTime: z.coerce.date().meta({ description: '创建时间' }),
orderId: z.string().meta({ description: '订单 ID' }),
status: z.enum(BillStatusEnum).meta({ description: '订单状态' }),
type: z.enum(BillTypeEnum).meta({ description: '订单类型' }),
price: z.number().meta({ description: '价格' }),
couponId: ObjectIdSchema.optional().meta({
description: '优惠券 ID'
}),
hasInvoice: z.boolean().meta({ description: '是否已开发票' }),
metadata: z
.object({
payWay: z.enum(BillPayWayEnum).meta({ description: '支付方式' }),
subMode: z.enum(SubModeEnum).optional().meta({ description: '订阅周期' }),
standSubLevel: z.enum(StandardSubLevelEnum).optional().meta({ description: '订阅等级' }),
month: z.number().optional().meta({ description: '月数' }),
datasetSize: z.number().optional().meta({ description: '数据集大小' }),
extraPoints: z.number().optional().meta({ description: '额外积分' })
})
.meta({ description: '元数据' }),
refundData: z
.object({
amount: z.number().meta({ description: '退款金额' }),
refundId: z.string().meta({ description: '退款 ID' }),
refundTime: z.date().meta({ description: '退款时间' })
})
.optional()
.meta({ description: '退款数据' })
});
export type BillSchemaType = z.infer<typeof BillSchema>;
export type ChatNodeUsageType = {
inputTokens?: number;
outputTokens?: number;
totalPoints: number;
moduleName: string;
model?: string;
};
export type InvoiceType = {
amount: number;
billIdList: string[];
} & TeamInvoiceHeaderType;
export type InvoiceSchemaType = {
_id: string;
teamId: string;
status: 1 | 2;
createTime: Date;
finishTime?: Date;
file?: Buffer;
} & InvoiceType;
export type AIPointsPriceOption = {
type: 'points';
points: number;
};
export type DatasetPriceOption = {
type: 'dataset';
size: number;
month: number;
};
export type PriceOption = AIPointsPriceOption | DatasetPriceOption;