新增AI教练模块,包括控制器、服务、模型及数据传输对象,更新应用模块以引入新模块,同时在打卡模块中添加按时间范围返回每日打卡状态的功能

This commit is contained in:
richarjiang
2025-08-14 09:12:44 +08:00
parent 866143d3ad
commit d1a6e3d42e
15 changed files with 556 additions and 5 deletions

View File

@@ -0,0 +1,62 @@
import { Column, DataType, Index, Model, PrimaryKey, Table } from 'sequelize-typescript';
export enum RoleType {
System = 'system',
User = 'user',
Assistant = 'assistant',
}
@Table({
tableName: 't_ai_messages',
underscored: true,
})
export class AiMessage extends Model {
@PrimaryKey
@Column({
type: DataType.STRING,
allowNull: false,
comment: '会话ID',
primaryKey: true,
})
declare conversationId: string;
@Column({
type: DataType.STRING,
allowNull: false,
comment: '用户ID',
})
declare userId: string;
@Column({
type: DataType.ENUM('system', 'user', 'assistant'),
allowNull: false,
})
declare role: RoleType;
@Column({
type: DataType.TEXT('long'),
allowNull: false,
})
declare content: string;
@Column({
type: DataType.JSON,
allowNull: true,
comment: '扩展元数据如token用量、模型名等',
})
declare metadata: Record<string, any> | null;
@Column({
type: DataType.DATE,
defaultValue: DataType.NOW,
})
declare createdAt: Date;
@Column({
type: DataType.DATE,
defaultValue: DataType.NOW,
})
declare updatedAt: Date;
}