chenpei d0dc94e36d feat: 将弹幕功能替换为AI聊天助手
新功能:
- 创建AI聊天助手组件(AIChatWidget)
- 支持文字+图片多模态对话
- 集成Gemini AI API
- 支持图片编辑和内容生成
- 实时对话历史管理
- 优雅的UI设计,支持黑夜模式

技术实现:
- 后端API代理Gemini API(/api/ai-chat)
- 支持最多5张图片上传
- 流式响应处理
- 对话历史管理
- Base64图片处理

配置:
- 在.env中添加Gemini API配置
- GEMINI_API_KEY
- GEMINI_API_BASE_URL
- GEMINI_MODEL

替换原弹幕功能,提供更强大的AI助手体验!
2025-10-27 17:45:37 +08:00

335 lines
7.6 KiB
JavaScript
Executable File

import Ajv from "ajv";
import { createResponseSchema } from "./response";
const ajv = new Ajv();
export const listBillReponseSchemaValidate = ajv.compile(
createResponseSchema({
type: "object",
properties: {
Limit: {
type: "number",
},
Offset: { type: "number" },
Total: {
type: "number",
},
BillList: {
type: "array",
items: {
type: "object",
properties: {
BillPeriod: {
type: "string",
},
PayerID: {
type: "string",
},
PayerUserName: {
type: "string",
},
PayerCustomerName: {
type: "string",
},
OwnerID: {
type: "string",
},
OwnerUserName: {
type: "string",
},
OwnerCustomerName: {
type: "string",
},
Product: {
type: "string",
},
ProductZh: {
type: "string",
},
BusinessMode: {
type: "string",
},
BillingMode: {
type: "string",
},
ExpenseBeginTime: {
type: "string",
},
ExpenseEndTime: {
type: "string",
},
TradeTime: {
type: "string",
},
BillID: {
type: "string",
},
BillCategoryParent: {
type: "string",
},
OriginalBillAmount: {
type: "string",
},
PreferentialBillAmount: {
type: "string",
},
RoundBillAmount: {
type: "string",
},
DiscountBillAmount: {
type: "string",
},
CouponAmount: {
type: "string",
},
PayableAmount: {
type: "string",
},
PaidAmount: {
type: "string",
},
UnpaidAmount: {
type: "string",
},
Currency: {
type: "string",
},
PayStatus: {
type: "string",
},
},
},
},
},
required: ["Limit", "Offset", "Total", "BillList"],
})
);
export const listBillDetailReponseSchemaValidate = ajv.compile(
createResponseSchema({
type: "object",
properties: {
Limit: {
type: "number",
},
Offset: { type: "number" },
Total: {
type: "number",
},
BillList: {
type: "array",
items: {
type: "object",
properties: {
BillPeriod: {
type: "string",
},
ExpenseDate: {
type: "string",
},
PayerID: {
type: "string",
},
PayerUserName: {
type: "string",
},
PayerCustomerName: {
type: "string",
},
OwnerID: {
type: "string",
},
OwnerUserName: {
type: "string",
},
OwnerCustomerName: {
type: "string",
},
BusinessMode: {
type: "string",
},
Product: {
type: "string",
},
ProductZh: {
type: "string",
},
BillingMode: {
type: "string",
},
ExpenseBeginTime: {
type: "string",
},
ExpenseEndTime: {
type: "string",
},
UseDuration: {
type: "string",
},
UseDurationUnit: {
type: "string",
},
TradeTime: {
type: "string",
},
BillID: {
type: "string",
},
BillCategory: {
type: "string",
},
InstanceNo: {
type: "string",
},
InstanceName: {
type: "string",
},
ConfigName: {
type: "string",
},
Element: {
type: "string",
},
Region: {
type: "string",
},
Zone: {
type: "string",
},
Factor: {
type: "string",
},
ExpandField: {
type: "string",
},
Price: {
type: "string",
},
PriceUnit: {
type: "string",
},
Count: {
type: "string",
},
Unit: {
type: "string",
},
DeductionCount: {
type: "string",
},
OriginalBillAmount: {
type: "string",
},
PreferentialBillAmount: {
type: "string",
},
DiscountBillAmount: {
type: "string",
},
CouponAmount: {
type: "string",
},
PayableAmount: {
type: "string",
},
PaidAmount: {
type: "string",
},
UnpaidAmount: {
type: "string",
},
Currency: {
type: "string",
},
},
},
},
},
required: ["Limit", "Offset", "Total", "BillDetailList"],
})
);
export const listBillOverviewByProdReponseSchemaValidate = ajv.compile(
createResponseSchema({
type: "object",
properties: {
Limit: {
type: "number",
},
Offset: { type: "number" },
Total: {
type: "number",
},
BillList: {
type: "array",
items: {
type: "object",
properties: {
BillPeriod: {
type: "string",
},
PayerID: {
type: "string",
},
PayerUserName: {
type: "string",
},
PayerCustomerName: {
type: "string",
},
OwnerID: {
type: "string",
},
OwnerUserName: {
type: "string",
},
OwnerCustomerName: {
type: "string",
},
BusinessMode: {
type: "string",
},
Product: {
type: "string",
},
ProductZh: {
type: "string",
},
BillingMode: {
type: "string",
},
BillCategoryParent: {
type: "string",
},
OriginalBillAmount: {
type: "string",
},
PreferentialBillAmount: {
type: "string",
},
RoundBillAmount: {
type: "string",
},
DiscountBillAmount: {
type: "string",
},
CouponAmount: {
type: "string",
},
PayableAmount: {
type: "string",
},
PaidAmount: {
type: "string",
},
UnpaidAmount: {
type: "string",
},
},
},
},
},
required: ["Limit", "Offset", "Total", "BillOverviewByProdList"],
})
);