mirror of
https://gitcode.com/ageerle/ruoyi-ai.git
synced 2026-09-13 08:25:00 +00:00
feat: 新增短剧/媒体生成能力并脱敏数据库脚本
- 新增音频/视频/图片生成服务与 Atlas、OpenAI 实现 - 新增短剧脚本生成、分镜与 ffmpeg 合成模块 - 新增 Coze/Dify 聊天 provider 及 Agent 配置 - 脱敏 SQL 脚本:移除真实 DeepSeek API Key,掩码 COS 桶名 - 清理过期的 SQL update 脚本与 chat 文档 Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -265,10 +265,6 @@ public class WorkflowEngine {
|
||||
String node = streamingOutput.node();
|
||||
String chunk = streamingOutput.chunk();
|
||||
log.info("node:{},chunk:{}", node, chunk);
|
||||
Map<String, String> strMap = new HashMap<>();
|
||||
strMap.put("ck", chunk);
|
||||
// SSEEmitterHelper.parseAndSendPartialMsg(sseEmitter, "[NODE_CHUNK_" + node + "]", strMap.toString());
|
||||
|
||||
SSEEmitterHelper.parseAndSendPartialMsg(sseEmitter, "[NODE_CHUNK_" + node + "]", chunk);
|
||||
} else {
|
||||
AbstractWfNode abstractWfNode = wfState.getCompletedNodes().stream()
|
||||
|
||||
@@ -1,336 +0,0 @@
|
||||
# MCP工具管理模块 - API接口文档
|
||||
|
||||
## 概述
|
||||
|
||||
本文档描述了MCP工具管理模块的REST API接口,供前端开发人员参考。
|
||||
|
||||
## 基础信息
|
||||
|
||||
- **Base URL**: `/api/mcp`
|
||||
- **认证方式**: Bearer Token (SaToken)
|
||||
- **响应格式**: JSON
|
||||
|
||||
---
|
||||
|
||||
## 1. MCP工具管理
|
||||
|
||||
### 1.1 查询工具列表(分页)
|
||||
|
||||
**接口**: `GET /tool/list`
|
||||
|
||||
**权限**: `mcp:tool:list`
|
||||
|
||||
**请求参数**:
|
||||
| 参数名 | 类型 | 必填 | 说明 |
|
||||
|--------|------|------|------|
|
||||
| name | String | 否 | 工具名称(模糊查询) |
|
||||
| description | String | 否 | 工具描述(模糊查询) |
|
||||
| type | String | 否 | 工具类型:LOCAL/REMOTE/BUILTIN |
|
||||
| status | String | 否 | 状态:0-启用, 1-禁用 |
|
||||
| pageNum | Integer | 是 | 页码,默认1 |
|
||||
| pageSize | Integer | 是 | 每页数量,默认10 |
|
||||
|
||||
**响应示例**:
|
||||
```json
|
||||
{
|
||||
"rows": [
|
||||
{
|
||||
"id": 1,
|
||||
"name": "ReadFileTool",
|
||||
"description": "读取文件内容工具",
|
||||
"type": "BUILTIN",
|
||||
"status": "0",
|
||||
"configJson": null,
|
||||
"createTime": "2026-03-08 10:00:00",
|
||||
"updateTime": "2026-03-08 10:00:00"
|
||||
}
|
||||
],
|
||||
"total": 1
|
||||
}
|
||||
```
|
||||
|
||||
### 1.2 查询工具列表(不分页)
|
||||
|
||||
**接口**: `GET /tool/all`
|
||||
|
||||
**权限**: `mcp:tool:list`
|
||||
|
||||
**请求参数**:
|
||||
| 参数名 | 类型 | 必填 | 说明 |
|
||||
|--------|------|------|------|
|
||||
| keyword | String | 否 | 关键词 |
|
||||
| type | String | 否 | 工具类型 |
|
||||
| status | String | 否 | 状态 |
|
||||
|
||||
**响应示例**:
|
||||
```json
|
||||
{
|
||||
"tools": [
|
||||
{
|
||||
"id": 1,
|
||||
"name": "ReadFileTool",
|
||||
"description": "读取文件内容工具",
|
||||
"type": "BUILTIN",
|
||||
"status": "0"
|
||||
}
|
||||
],
|
||||
"total": 1
|
||||
}
|
||||
```
|
||||
|
||||
### 1.3 获取工具详情
|
||||
|
||||
**接口**: `GET /tool/{id}`
|
||||
|
||||
**权限**: `mcp:tool:query`
|
||||
|
||||
**路径参数**:
|
||||
| 参数名 | 类型 | 必填 | 说明 |
|
||||
|--------|------|------|------|
|
||||
| id | Long | 是 | 工具ID |
|
||||
|
||||
### 1.4 新增工具
|
||||
|
||||
**接口**: `POST /tool`
|
||||
|
||||
**权限**: `mcp:tool:add`
|
||||
|
||||
**请求体**:
|
||||
```json
|
||||
{
|
||||
"name": "MyMcpTool",
|
||||
"description": "我的MCP工具",
|
||||
"type": "REMOTE",
|
||||
"status": "0",
|
||||
"configJson": "{\"baseUrl\": \"http://localhost:8080/mcp\"}"
|
||||
}
|
||||
```
|
||||
|
||||
### 1.5 修改工具
|
||||
|
||||
**接口**: `PUT /tool`
|
||||
|
||||
**权限**: `mcp:tool:edit`
|
||||
|
||||
**请求体**: 同新增工具
|
||||
|
||||
### 1.6 删除工具
|
||||
|
||||
**接口**: `DELETE /tool/{ids}`
|
||||
|
||||
**权限**: `mcp:tool:remove`
|
||||
|
||||
**路径参数**:
|
||||
| 参数名 | 类型 | 必填 | 说明 |
|
||||
|--------|------|------|------|
|
||||
| ids | String | 是 | 工具ID,多个用逗号分隔 |
|
||||
|
||||
### 1.7 更新工具状态
|
||||
|
||||
**接口**: `PUT /tool/{id}/status`
|
||||
|
||||
**权限**: `mcp:tool:edit`
|
||||
|
||||
**路径参数**:
|
||||
| 参数名 | 类型 | 必填 | 说明 |
|
||||
|--------|------|------|------|
|
||||
| id | Long | 是 | 工具ID |
|
||||
|
||||
**请求参数**:
|
||||
| 参数名 | 类型 | 必填 | 说明 |
|
||||
|--------|------|------|------|
|
||||
| status | String | 是 | 状态:0-启用, 1-禁用 |
|
||||
|
||||
### 1.8 测试工具连接
|
||||
|
||||
**接口**: `POST /tool/{id}/test`
|
||||
|
||||
**权限**: `mcp:tool:query`
|
||||
|
||||
**响应示例**:
|
||||
```json
|
||||
{
|
||||
"success": true,
|
||||
"message": "连接测试成功",
|
||||
"toolCount": 5,
|
||||
"tools": ["tool1", "tool2", "tool3", "tool4", "tool5"]
|
||||
}
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 2. MCP市场管理
|
||||
|
||||
### 2.1 查询市场列表
|
||||
|
||||
**接口**: `GET /market/list`
|
||||
|
||||
**权限**: `mcp:market:list`
|
||||
|
||||
**请求参数**:
|
||||
| 参数名 | 类型 | 必填 | 说明 |
|
||||
|--------|------|------|------|
|
||||
| name | String | 否 | 市场名称 |
|
||||
| description | String | 否 | 市场描述 |
|
||||
| status | String | 否 | 状态 |
|
||||
| pageNum | Integer | 是 | 页码 |
|
||||
| pageSize | Integer | 是 | 每页数量 |
|
||||
|
||||
### 2.2 获取市场工具列表
|
||||
|
||||
**接口**: `GET /market/{marketId}/tools`
|
||||
|
||||
**权限**: `mcp:market:query`
|
||||
|
||||
**路径参数**:
|
||||
| 参数名 | 类型 | 必填 | 说明 |
|
||||
|--------|------|------|------|
|
||||
| marketId | Long | 是 | 市场ID |
|
||||
|
||||
**请求参数**:
|
||||
| 参数名 | 类型 | 必填 | 说明 |
|
||||
|--------|------|------|------|
|
||||
| page | Integer | 否 | 页码,默认1 |
|
||||
| size | Integer | 否 | 每页数量,默认10 |
|
||||
|
||||
### 2.3 刷新市场工具
|
||||
|
||||
**接口**: `POST /market/{marketId}/refresh`
|
||||
|
||||
**权限**: `mcp:market:edit`
|
||||
|
||||
**响应示例**:
|
||||
```json
|
||||
{
|
||||
"success": true,
|
||||
"message": "刷新成功",
|
||||
"addedCount": 3,
|
||||
"updatedCount": 5
|
||||
}
|
||||
```
|
||||
|
||||
### 2.4 加载工具到本地
|
||||
|
||||
**接口**: `POST /market/tool/{toolId}/load`
|
||||
|
||||
**权限**: `mcp:market:edit`
|
||||
|
||||
**路径参数**:
|
||||
| 参数名 | 类型 | 必填 | 说明 |
|
||||
|--------|------|------|------|
|
||||
| toolId | Long | 是 | 市场工具ID |
|
||||
|
||||
### 2.5 批量加载工具
|
||||
|
||||
**接口**: `POST /market/tools/batchLoad`
|
||||
|
||||
**权限**: `mcp:market:edit`
|
||||
|
||||
**请求体**:
|
||||
```json
|
||||
{
|
||||
"toolIds": [1, 2, 3]
|
||||
}
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 3. 工具调用日志
|
||||
|
||||
### 3.1 查询调用日志
|
||||
|
||||
**接口**: `GET /tool/callLog`
|
||||
|
||||
**权限**: `mcp:tool:query`
|
||||
|
||||
**请求参数**:
|
||||
| 参数名 | 类型 | 必填 | 说明 |
|
||||
|--------|------|------|------|
|
||||
| toolId | Long | 否 | 工具ID |
|
||||
| sessionId | Long | 否 | 会话ID |
|
||||
| startDate | Date | 否 | 开始日期 |
|
||||
| endDate | Date | 否 | 结束日期 |
|
||||
| pageNum | Integer | 是 | 页码 |
|
||||
| pageSize | Integer | 是 | 每页数量 |
|
||||
|
||||
### 3.2 获取工具统计
|
||||
|
||||
**接口**: `GET /tool/{toolId}/metrics`
|
||||
|
||||
**权限**: `mcp:tool:query`
|
||||
|
||||
**响应示例**:
|
||||
```json
|
||||
{
|
||||
"toolId": 1,
|
||||
"toolName": "ReadFileTool",
|
||||
"today": {
|
||||
"callCount": 100,
|
||||
"successCount": 95,
|
||||
"failureCount": 5,
|
||||
"avgDurationMs": 150,
|
||||
"successRate": 95.0
|
||||
},
|
||||
"week": {
|
||||
"callCount": 500,
|
||||
"successCount": 475,
|
||||
"failureCount": 25,
|
||||
"avgDurationMs": 160,
|
||||
"successRate": 95.0
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 4. 状态码说明
|
||||
|
||||
| 状态码 | 说明 |
|
||||
|--------|------|
|
||||
| 200 | 请求成功 |
|
||||
| 401 | 未认证 |
|
||||
| 403 | 无权限 |
|
||||
| 404 | 资源不存在 |
|
||||
| 500 | 服务器错误 |
|
||||
|
||||
---
|
||||
|
||||
## 5. 前端页面需求
|
||||
|
||||
### 5.1 MCP工具管理页面 (`/mcp/tool`)
|
||||
|
||||
**功能**:
|
||||
- 工具列表展示(分页)
|
||||
- 工具搜索和筛选
|
||||
- 新增/编辑/删除工具
|
||||
- 工具状态切换
|
||||
- 工具连接测试
|
||||
|
||||
**表格列**:
|
||||
- 工具名称
|
||||
- 工具描述
|
||||
- 工具类型(标签显示)
|
||||
- 状态(开关)
|
||||
- 创建时间
|
||||
- 操作(编辑、删除、测试)
|
||||
|
||||
### 5.2 MCP市场管理页面 (`/mcp/market`)
|
||||
|
||||
**功能**:
|
||||
- 市场列表展示
|
||||
- 市场工具浏览
|
||||
- 刷新市场工具
|
||||
- 加载工具到本地
|
||||
|
||||
### 5.3 工具调用日志页面 (`/mcp/log`)
|
||||
|
||||
**功能**:
|
||||
- 调用日志列表
|
||||
- 按工具/日期筛选
|
||||
- 成功率统计
|
||||
- 响应时间统计
|
||||
|
||||
**图表**:
|
||||
- 每日调用次数趋势图
|
||||
- 工具调用成功率饼图
|
||||
- 平均响应时间柱状图
|
||||
@@ -1,152 +0,0 @@
|
||||
# 数据库操作智能体实现总结
|
||||
|
||||
## 概述
|
||||
基于 LangChain4j 的 **Pure agentic AI** 模式,完成了一个智能数据库查询系统。该系统能够根据用户的自然语言问题,自动分析数据库结构、生成查询计划并执行相应的数据库操作。
|
||||
|
||||
## 架构设计
|
||||
|
||||
### 1. 整体框架
|
||||
```
|
||||
用户请求 → SupervisorAgent(协调器) → SqlAgent(数据库专家) → 数据库工具 → 数据库
|
||||
↓
|
||||
结果处理与响应
|
||||
```
|
||||
|
||||
### 2. 核心组件
|
||||
|
||||
#### A. SqlAgent (数据库查询专家)
|
||||
- **文件**: `org.ruoyi.agent.SqlAgent`
|
||||
- **职责**: 根据用户的自然语言问题,调用相应的工具查询数据库
|
||||
- **使用的工具**:
|
||||
- `QueryAllTablesTool`: 查询所有表名和注释
|
||||
- `QueryTableSchemaTool`: 查询表的DDL(CREATE TABLE语句)
|
||||
- `ExecuteSqlQueryTool`: 执行SELECT查询
|
||||
|
||||
```java
|
||||
public interface SqlAgent {
|
||||
@SystemMessage("...") // 详细的系统提示
|
||||
@UserMessage("请回答以下问题:{{query}}")
|
||||
@Agent("一个智能数据库查询助手...")
|
||||
String getData(@V("query") String query);
|
||||
}
|
||||
```
|
||||
|
||||
#### B. SupervisorAgent (总体协调器)
|
||||
- 在 `OpenAIServiceImpl.doAgent()` 中创建
|
||||
- 作用:协调 SqlAgent 的执行,管理任务流程
|
||||
- 响应策略:`SUMMARY` - 返回所有操作的摘要
|
||||
|
||||
```java
|
||||
SupervisorAgent supervisor = AgenticServices
|
||||
.supervisorBuilder()
|
||||
.chatModel(PLANNER_MODEL)
|
||||
.subAgents(sqlAgent)
|
||||
.responseStrategy(SupervisorResponseStrategy.SUMMARY)
|
||||
.build();
|
||||
```
|
||||
|
||||
#### C. 数据库工具 (Tools)
|
||||
|
||||
##### 1. QueryAllTablesTool
|
||||
```java
|
||||
@Tool("Query all tables in the database and return table names and basic information")
|
||||
public String queryAllTables()
|
||||
```
|
||||
- 返回数据库中所有表的名称和注释
|
||||
- 使用注入的 `agentDataSource` DataSource
|
||||
|
||||
##### 2. QueryTableSchemaTool
|
||||
```java
|
||||
@Tool("Query the CREATE TABLE statement (DDL) for a specific table by table name")
|
||||
public String queryTableSchema(String tableName)
|
||||
```
|
||||
- 返回指定表的建表SQL语句
|
||||
- 包含SQL注入防护(表名有效性验证)
|
||||
|
||||
##### 3. ExecuteSqlQueryTool
|
||||
```java
|
||||
@Tool("Execute a SELECT SQL query and return the results. Example: SELECT * FROM sys_user")
|
||||
public String executeSql(String sql)
|
||||
```
|
||||
- 执行SELECT查询(安全性考虑,不允许执行其他操作)
|
||||
- 格式化查询结果,最多显示前20行
|
||||
|
||||
### 3. 配置体系
|
||||
|
||||
#### AgentMysqlProperties
|
||||
配置文件前缀:`agent.mysql`
|
||||
```yaml
|
||||
agent:
|
||||
mysql:
|
||||
enabled: true
|
||||
url: jdbc:mysql://localhost:3306/your_database
|
||||
username: your_username
|
||||
password: your_password
|
||||
max-pool-size: 10
|
||||
min-idle: 2
|
||||
```
|
||||
|
||||
#### AgentMysqlConfig
|
||||
- 创建独立的 DataSource Bean (`agentDataSource`)
|
||||
- 使用 HikariCP 连接池管理
|
||||
- 与项目主数据源隔离
|
||||
|
||||
#### TableSchemaManager
|
||||
- 在应用启动时初始化表结构缓存
|
||||
- 使用 `ConcurrentHashMap` 存储结构信息
|
||||
- 支持按需刷新单个表的结构
|
||||
|
||||
## 工作流程示例
|
||||
|
||||
### 用户查询: "数据库有哪些表?"
|
||||
|
||||
```
|
||||
1. SupervisorAgent 接收请求
|
||||
↓
|
||||
2. SupervisorAgent 分析请求,决定调用 SqlAgent
|
||||
↓
|
||||
3. SqlAgent 理解需求,调用 QueryAllTablesTool
|
||||
↓
|
||||
4. QueryAllTablesTool 连接数据库,获取所有表
|
||||
↓
|
||||
5. 结果返回给 SqlAgent
|
||||
↓
|
||||
6. SqlAgent 格式化结果
|
||||
↓
|
||||
7. SupervisorAgent 生成最终摘要
|
||||
↓
|
||||
8. 结果通过流式处理器返回给用户
|
||||
```
|
||||
|
||||
### 用户查询: "查询 sys_user 表中有多少条记录"
|
||||
|
||||
```
|
||||
1. SqlAgent 接收请求
|
||||
↓
|
||||
2. SqlAgent 分析需求,可能先调用 QueryTableSchemaTool 了解表结构
|
||||
↓
|
||||
3. 然后调用 ExecuteSqlQueryTool 执行 "SELECT COUNT(*) FROM sys_user"
|
||||
↓
|
||||
4. 获取查询结果并返回
|
||||
```
|
||||
|
||||
## Agentic AI 特性
|
||||
|
||||
### 自适应决策
|
||||
- Agent 能根据上下文和之前的结果决定下一步操作
|
||||
- 不是预定义的固定流程,而是动态适应
|
||||
|
||||
### 例子
|
||||
当询问"查询部门表的字段信息时":
|
||||
- SqlAgent 可能先调用 `QueryTableSchemaTool` 获取建表SQL
|
||||
- 如果发现需要具体的数据示例,会继续调用 `ExecuteSqlQueryTool`
|
||||
- 整个决策过程由 LLM 驱动,非硬编码
|
||||
|
||||
## 安全考虑
|
||||
|
||||
1. **数据源隔离**: Agent 使用独立的数据源(agentDataSource),与主应用隔离
|
||||
2. **SQL验证**: 只允许执行 SELECT 查询
|
||||
3. **表名验证**: 表名必须通过正则表达式验证(防止SQL注入)
|
||||
4. **权限限制**: 可通过 AGENT_ALLOWED_TABLES 环境变量限制可访问的表
|
||||
5. **凭证管理**: 数据库凭证通过配置文件管理,不硬编码
|
||||
|
||||
@@ -44,7 +44,7 @@
|
||||
<dependency>
|
||||
<groupId>dev.langchain4j</groupId>
|
||||
<artifactId>langchain4j-agentic</artifactId>
|
||||
<version>${langchain4j.community.version}</version>
|
||||
<version>${langchain4j.beta.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
@@ -69,7 +69,7 @@
|
||||
<dependency>
|
||||
<groupId>dev.langchain4j</groupId>
|
||||
<artifactId>langchain4j-document-parser-apache-tika</artifactId>
|
||||
<version>${langchain4j.community.version}</version>
|
||||
<version>${langchain4j.beta.version}</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>org.apache.commons</groupId>
|
||||
@@ -82,39 +82,39 @@
|
||||
<dependency>
|
||||
<groupId>dev.langchain4j</groupId>
|
||||
<artifactId>langchain4j-milvus</artifactId>
|
||||
<version>${langchain4j.community.version}</version>
|
||||
<version>${langchain4j.beta.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>dev.langchain4j</groupId>
|
||||
<artifactId>langchain4j-weaviate</artifactId>
|
||||
<version>${langchain4j.community.version}</version>
|
||||
<version>${langchain4j.beta.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>dev.langchain4j</groupId>
|
||||
<artifactId>langchain4j-qdrant</artifactId>
|
||||
<version>${langchain4j.community.version}</version>
|
||||
<version>${langchain4j.beta.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>dev.langchain4j</groupId>
|
||||
<artifactId>langchain4j-mcp</artifactId>
|
||||
<version>${langchain4j.community.version}</version>
|
||||
<version>${langchain4j.beta.version}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- LangChain4j Skills - 技能模块 -->
|
||||
<dependency>
|
||||
<groupId>dev.langchain4j</groupId>
|
||||
<artifactId>langchain4j-skills</artifactId>
|
||||
<version>${langchain4j.community.version}</version>
|
||||
<version>${langchain4j.beta.version}</version>
|
||||
</dependency>
|
||||
|
||||
|
||||
<dependency>
|
||||
<groupId>dev.langchain4j</groupId>
|
||||
<artifactId>langchain4j-experimental-skills-shell</artifactId>
|
||||
<version>${langchain4j.community.version}</version>
|
||||
<version>${langchain4j.beta.version}</version>
|
||||
</dependency>
|
||||
|
||||
|
||||
@@ -155,10 +155,24 @@
|
||||
<version>${dify.version}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- HikariCP 数据库连接池 -->
|
||||
<dependency>
|
||||
<groupId>com.zaxxer</groupId>
|
||||
<artifactId>HikariCP</artifactId>
|
||||
<groupId>com.coze</groupId>
|
||||
<artifactId>coze-api</artifactId>
|
||||
<version>${coze.version}</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>io.jsonwebtoken</groupId>
|
||||
<artifactId>jjwt-api</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>io.jsonwebtoken</groupId>
|
||||
<artifactId>jjwt-impl</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>io.jsonwebtoken</groupId>
|
||||
<artifactId>jjwt-jackson</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
|
||||
<!-- MySQL JDBC 驱动 -->
|
||||
|
||||
@@ -0,0 +1,51 @@
|
||||
package org.ruoyi.agent;
|
||||
|
||||
import dev.langchain4j.service.SystemMessage;
|
||||
import dev.langchain4j.service.UserMessage;
|
||||
import dev.langchain4j.service.V;
|
||||
import org.ruoyi.domain.bo.shortdrama.ShortDramaScriptResult;
|
||||
|
||||
/**
|
||||
* 短剧剧本打磨 Agent —— 使用 langchain4j AiServices 结构化输出
|
||||
* <p>
|
||||
* 框架自动生成 JSON Schema 并强制 LLM 返回符合结构的数据,无需手工 parse。
|
||||
*
|
||||
* @author ageerle
|
||||
*/
|
||||
public interface ShortDramaScriptAgent {
|
||||
|
||||
@SystemMessage("""
|
||||
你是顶级短剧编剧和创意总监。请根据用户的一个创意想法,创作完整的短剧剧本。
|
||||
|
||||
【核心原则 - 最高优先级】
|
||||
1. 剧本必须完整、有张力、有画面感
|
||||
2. 角色要有鲜明性格,不是工具人
|
||||
3. 情节紧凑,每句台词都推动剧情
|
||||
4. 场景描写具体,让分镜师能直接画出画面
|
||||
5. 对话自然有力,避免废话
|
||||
|
||||
【剧本格式】
|
||||
使用标准剧本格式,包含以下元素:
|
||||
1. 场景头(Scene Heading):内景/外景+地点+时间,如"内景 客厅 清晨"
|
||||
2. 场景描述(Scene Description):简洁描述场景环境、布局、关键道具
|
||||
3. 动作描述(Action):描述角色的动作、表情、行为,连续段落形式
|
||||
4. 对话(Dialogue):角色名: 台词内容
|
||||
5. 画外音(Voiceover):旁白、独白、回忆中的声音
|
||||
|
||||
【剧本长度要求】
|
||||
- scriptText:1000-3000字,含完整的开场、冲突发展、高潮、结尾
|
||||
- outlineText:400-800字,概述完整故事线
|
||||
|
||||
【角色塑造要求】
|
||||
- 每个角色要有明确的性格标签(如:霸道总裁、温柔女医、腹黑谋士)
|
||||
- 角色之间要有清晰的关系和冲突
|
||||
- 对话要符合角色性格
|
||||
|
||||
【情节要求】
|
||||
- 必须有清晰的冲突和反转
|
||||
- 情绪节奏要有起伏(紧张→舒缓→爆发)
|
||||
- 结尾要有记忆点(反转/留白/情感升华)
|
||||
""")
|
||||
@UserMessage("用户期望项目名:{{projectName}}\n用户创意:{{idea}}")
|
||||
ShortDramaScriptResult polish(@V("projectName") String projectName, @V("idea") String idea);
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
package org.ruoyi.config.agent;
|
||||
|
||||
import java.nio.file.Path;
|
||||
|
||||
/**
|
||||
* 磁盘 Skills 目录路径解析器
|
||||
* <p>
|
||||
* langchain4j 的 ShellSkills 通过 FileSystemSkillLoader 从磁盘加载 SKILL.md,
|
||||
* 路径硬编码在 ChatServiceFacade 中。抽到此工具类供智能体管理端与聊天流程共用,
|
||||
* 避免两处路径漂移。
|
||||
*
|
||||
* @author ruoyi team
|
||||
*/
|
||||
public final class SkillsPathResolver {
|
||||
|
||||
private SkillsPathResolver() {
|
||||
}
|
||||
|
||||
/**
|
||||
* skills 目录相对项目根目录的路径
|
||||
*/
|
||||
private static final String SKILLS_RELATIVE_PATH = "ruoyi-admin/src/main/resources/skills";
|
||||
|
||||
/**
|
||||
* 返回磁盘 skills 目录的绝对路径
|
||||
*/
|
||||
public static Path resolveSkillsPath() {
|
||||
String userDir = System.getProperty("user.dir");
|
||||
return Path.of(userDir, SKILLS_RELATIVE_PATH);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,72 @@
|
||||
package org.ruoyi.constant;
|
||||
|
||||
/**
|
||||
* 短剧图片资产常量 — 三视图 prompt 工程
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
public final class ShortDramaImageConstants {
|
||||
|
||||
private ShortDramaImageConstants() {}
|
||||
|
||||
/**
|
||||
* 角色三视图 prompt 前缀,生图时自动拼到用户 prompt 之前。
|
||||
* 把风格和构图指令放最前面,避免被角色描述稀释导致画风漂移。
|
||||
*/
|
||||
public static final String CHARACTER_PROMPT_PREFIX =
|
||||
"character design sheet, multiple views reference sheet, " +
|
||||
"front view / side view / back view full body, " +
|
||||
"clean white background, no props, no text. ";
|
||||
|
||||
/**
|
||||
* 角色三视图 prompt 后缀,生图时自动追加到用户 prompt 之后。
|
||||
* 左侧1/3正面特写 + 右侧2/3三视图横向排列(正面全身、侧面全身、背面全身)。
|
||||
*/
|
||||
public static final String CHARACTER_PROMPT_SUFFIX =
|
||||
"。角色设定图,画面分为左右两个区域:" +
|
||||
"【左侧区域】占约1/3宽度,是角色的正面特写" +
|
||||
"(完整正脸,最具辨识度的正面形态);" +
|
||||
"【右侧区域】占约2/3宽度,是角色三视图横向排列" +
|
||||
"(从左到右依次为:正面全身、侧面全身、背面全身)," +
|
||||
"三视图高度一致。纯白色背景,无其他元素。";
|
||||
|
||||
/** 场景图 prompt 前缀 */
|
||||
public static final String LOCATION_PROMPT_PREFIX = "宽广空间全景,";
|
||||
|
||||
/** 场景图 prompt 后缀 */
|
||||
public static final String LOCATION_PROMPT_SUFFIX = ",禁止出现任何角色,纯背景板";
|
||||
|
||||
/** 每个资产最多保留的图片变体数量 */
|
||||
public static final int MAX_IMAGE_VARIANTS = 20;
|
||||
|
||||
// ==================== 视觉风格 ====================
|
||||
|
||||
/** 项目视觉风格 → 生图 prompt 后缀映射,确保同项目所有图片风格一致 */
|
||||
public static final java.util.Map<String, String> ART_STYLE_PROMPTS = java.util.Map.of(
|
||||
"american-comic", "美式漫画风格,粗线条,高饱和度色彩,强烈光影对比",
|
||||
"chinese-comic", "现代国漫动画风格,Chinese donghua 2D comic style,赛璐璐平涂上色,干净锐利的黑色线稿,平面化光影无真实景深,动漫人物比例(略放大双眼、修长身形),皮肤平滑无毛孔无写实肤质,国风服饰剪裁与材质细节清晰,色彩饱满通透,画面精致干净;禁止真人写实、摄影实拍、3D渲染、CGI、厚涂油画、写实皮肤纹理、景深虚化",
|
||||
"japanese-anime", "现代日系动漫风格,赛璐璐上色,清晰干净的线条,视觉小说CG感,高质量2D风格",
|
||||
"realistic", "真实电影级画面质感,真实现实场景,色彩饱满通透,画面干净精致,真实感"
|
||||
);
|
||||
|
||||
/** 默认视觉风格 */
|
||||
public static final String DEFAULT_ART_STYLE = "realistic";
|
||||
|
||||
/** 查找 artStyle 对应的 prompt 后缀,找不到返回空字符串 */
|
||||
public static String artStylePrompt(String artStyle) {
|
||||
if (artStyle == null) return "";
|
||||
return ART_STYLE_PROMPTS.getOrDefault(artStyle, "");
|
||||
}
|
||||
|
||||
/**
|
||||
* 由项目 id 派生一个稳定的生图随机种子。
|
||||
* 同项目内所有角色/形象共用同一颗种子,渲染基调(光影、配色、笔触)更趋一致;
|
||||
* 不同项目派生不同种子,避免跨项目撞图。返回值落在 [0, 2_000_000_000),兼容各供应商。
|
||||
*/
|
||||
public static Integer styleSeed(Long projectId) {
|
||||
if (projectId == null) return null;
|
||||
long h = projectId;
|
||||
h ^= (h >>> 32);
|
||||
return (int) Math.floorMod(h * 2654435761L, 2_000_000_000L);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,130 @@
|
||||
package org.ruoyi.controller.agent;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.ruoyi.common.core.domain.R;
|
||||
import org.ruoyi.common.excel.utils.ExcelUtil;
|
||||
import org.ruoyi.common.idempotent.annotation.RepeatSubmit;
|
||||
import org.ruoyi.common.log.annotation.Log;
|
||||
import org.ruoyi.common.log.enums.BusinessType;
|
||||
import org.ruoyi.common.mybatis.core.page.PageQuery;
|
||||
import org.ruoyi.common.mybatis.core.page.TableDataInfo;
|
||||
import org.ruoyi.common.web.core.BaseController;
|
||||
import org.ruoyi.domain.bo.agent.AgentBo;
|
||||
import org.ruoyi.domain.vo.agent.AgentVo;
|
||||
import org.ruoyi.domain.vo.agent.SkillOptionVo;
|
||||
import org.ruoyi.service.agent.IAgentService;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 智能体管理 Controller
|
||||
*
|
||||
* @author ruoyi team
|
||||
*/
|
||||
@Validated
|
||||
@RequiredArgsConstructor
|
||||
@RestController
|
||||
@RequestMapping("/agent/agent")
|
||||
public class AgentController extends BaseController {
|
||||
|
||||
private final IAgentService agentService;
|
||||
|
||||
/**
|
||||
* 分页查询智能体列表
|
||||
*/
|
||||
@SaCheckPermission("agent:agent:list")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo<AgentVo> list(AgentBo bo, PageQuery pageQuery) {
|
||||
return agentService.queryPageList(bo, pageQuery);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询智能体列表(不分页,用于导出)
|
||||
*/
|
||||
@SaCheckPermission("agent:agent:list")
|
||||
@GetMapping("/queryList")
|
||||
public R<List<AgentVo>> queryList(AgentBo bo) {
|
||||
return R.ok(agentService.queryList(bo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出智能体列表
|
||||
*/
|
||||
@SaCheckPermission("agent:agent:export")
|
||||
@Log(title = "智能体管理", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(AgentBo bo, HttpServletResponse response) {
|
||||
List<AgentVo> list = agentService.queryList(bo);
|
||||
ExcelUtil.exportExcel(list, "智能体", AgentVo.class, response);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据ID获取智能体详情
|
||||
*/
|
||||
@SaCheckPermission("agent:agent:query")
|
||||
@GetMapping("/{id}")
|
||||
public R<AgentVo> getInfo(@PathVariable Long id) {
|
||||
return R.ok(agentService.queryById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增智能体
|
||||
*/
|
||||
@SaCheckPermission("agent:agent:add")
|
||||
@Log(title = "智能体管理", businessType = BusinessType.INSERT)
|
||||
@RepeatSubmit
|
||||
@PostMapping
|
||||
public R<Void> add(@Validated @RequestBody AgentBo bo) {
|
||||
return toAjax(agentService.insertByBo(bo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改智能体
|
||||
*/
|
||||
@SaCheckPermission("agent:agent:edit")
|
||||
@Log(title = "智能体管理", businessType = BusinessType.UPDATE)
|
||||
@RepeatSubmit
|
||||
@PutMapping
|
||||
public R<Void> edit(@Validated @RequestBody AgentBo bo) {
|
||||
return toAjax(agentService.updateByBo(bo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除智能体
|
||||
*/
|
||||
@SaCheckPermission("agent:agent:remove")
|
||||
@Log(title = "智能体管理", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ids}")
|
||||
public R<Void> remove(@PathVariable Long[] ids) {
|
||||
return toAjax(agentService.deleteByIds(List.of(ids)));
|
||||
}
|
||||
|
||||
/**
|
||||
* 用户端聊天页智能体下拉选项(启用状态,不需权限校验)
|
||||
*/
|
||||
@GetMapping("/agentOptions")
|
||||
public R<List<AgentVo>> agentOptions() {
|
||||
return R.ok(agentService.queryEnabledOptions());
|
||||
}
|
||||
|
||||
/**
|
||||
* 列出磁盘上可用的 Skills(供管理端表单勾选)
|
||||
*/
|
||||
@SaCheckPermission("agent:agent:list")
|
||||
@GetMapping("/skillOptions")
|
||||
public R<List<SkillOptionVo>> skillOptions() {
|
||||
return R.ok(agentService.listSkillOptions());
|
||||
}
|
||||
|
||||
}
|
||||
@@ -9,6 +9,7 @@ import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import org.ruoyi.common.chat.service.chat.IChatModelService;
|
||||
import org.ruoyi.common.chat.domain.bo.chat.ChatModelBo;
|
||||
import org.ruoyi.common.chat.domain.vo.chat.ChatModelVo;
|
||||
import org.ruoyi.common.core.utils.StringUtils;
|
||||
import org.ruoyi.enums.ChatModeType;
|
||||
import org.ruoyi.enums.ModelType;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
@@ -54,7 +55,9 @@ public class ChatModelController extends BaseController {
|
||||
*/
|
||||
@GetMapping("/modelList")
|
||||
public R<List<ChatModelVo>> modelList(ChatModelBo bo) {
|
||||
bo.setCategory(ModelType.CHAT.getKey());
|
||||
if (StringUtils.isBlank(bo.getCategory())) {
|
||||
bo.setCategory(ModelType.CHAT.getKey());
|
||||
}
|
||||
return R.ok(chatModelService.queryList(bo));
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,141 @@
|
||||
package org.ruoyi.controller.chat;
|
||||
|
||||
import jakarta.validation.Valid;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.ruoyi.common.chat.domain.vo.chat.ChatModelVo;
|
||||
import org.ruoyi.common.chat.entity.audio.AudioContext;
|
||||
import org.ruoyi.common.chat.entity.image.ImageContext;
|
||||
import org.ruoyi.common.chat.entity.media.MediaGenerationResponse;
|
||||
import org.ruoyi.common.chat.entity.video.VideoContext;
|
||||
import org.ruoyi.common.chat.factory.AudioServiceFactory;
|
||||
import org.ruoyi.common.chat.factory.ImageServiceFactory;
|
||||
import org.ruoyi.common.chat.factory.VideoServiceFactory;
|
||||
import org.ruoyi.common.chat.service.chat.IChatModelService;
|
||||
import org.ruoyi.common.core.domain.R;
|
||||
import org.ruoyi.domain.bo.media.ImageGenerationRequest;
|
||||
import org.ruoyi.domain.bo.media.SpeechGenerationRequest;
|
||||
import org.ruoyi.domain.bo.media.VideoGenerationRequest;
|
||||
import org.ruoyi.enums.ModelType;
|
||||
import org.ruoyi.service.media.AtlasPredictionService;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
@Validated
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@RequestMapping("/media")
|
||||
public class MediaGenerationController {
|
||||
|
||||
private final IChatModelService chatModelService;
|
||||
private final AudioServiceFactory audioServiceFactory;
|
||||
private final ImageServiceFactory imageServiceFactory;
|
||||
private final VideoServiceFactory videoServiceFactory;
|
||||
private final AtlasPredictionService atlasPredictionService;
|
||||
|
||||
@PostMapping("/speech")
|
||||
public R<MediaGenerationResponse> speech(@Valid @RequestBody SpeechGenerationRequest request) {
|
||||
ChatModelVo model = loadModel(request.getModel(), ModelType.AUDIO.getKey());
|
||||
MediaGenerationResponse response = audioServiceFactory.getOriginalService(model.getProviderCode())
|
||||
.generateSpeech(AudioContext.builder()
|
||||
.chatModelVo(model)
|
||||
.input(request.getInput())
|
||||
.voice(request.getVoice())
|
||||
.responseFormat(request.getResponseFormat())
|
||||
.speed(request.getSpeed())
|
||||
.instructions(request.getInstructions())
|
||||
.build());
|
||||
return R.ok(response);
|
||||
}
|
||||
|
||||
@PostMapping("/image")
|
||||
public R<MediaGenerationResponse> image(@Valid @RequestBody ImageGenerationRequest request) {
|
||||
ChatModelVo model = loadModel(request.getModel(), ModelType.IMAGE.getKey());
|
||||
String result = imageServiceFactory.getOriginalService(model.getProviderCode())
|
||||
.generateImage(ImageContext.builder()
|
||||
.chatModelVo(model)
|
||||
.prompt(request.getPrompt())
|
||||
.size(request.getSize())
|
||||
.seed(request.getSeed())
|
||||
.build());
|
||||
return R.ok(toImageResponse(result));
|
||||
}
|
||||
|
||||
@PostMapping("/video")
|
||||
public R<MediaGenerationResponse> video(@Valid @RequestBody VideoGenerationRequest request) {
|
||||
ChatModelVo model = loadModel(request.getModel(), ModelType.VIDEO.getKey());
|
||||
MediaGenerationResponse response = videoServiceFactory.getOriginalService(model.getProviderCode())
|
||||
.generateVideo(VideoContext.builder()
|
||||
.chatModelVo(model)
|
||||
.prompt(request.getPrompt())
|
||||
.size(request.getSize())
|
||||
.seconds(request.getSeconds())
|
||||
.quality(request.getQuality())
|
||||
.build());
|
||||
return R.ok(response);
|
||||
}
|
||||
|
||||
@GetMapping("/video")
|
||||
public R<MediaGenerationResponse> videoResult(@NotBlank(message = "模型不能为空") @RequestParam String model,
|
||||
@NotBlank(message = "videoId不能为空") @RequestParam String videoId) {
|
||||
ChatModelVo chatModelVo = loadModel(model, ModelType.VIDEO.getKey());
|
||||
MediaGenerationResponse response = videoServiceFactory.getOriginalService(chatModelVo.getProviderCode())
|
||||
.retrieveVideo(VideoContext.builder()
|
||||
.chatModelVo(chatModelVo)
|
||||
.prompt("retrieve")
|
||||
.videoId(videoId)
|
||||
.build());
|
||||
return R.ok(response);
|
||||
}
|
||||
|
||||
@GetMapping("/prediction")
|
||||
public R<MediaGenerationResponse> prediction(@NotBlank(message = "模型不能为空") @RequestParam String model,
|
||||
@NotBlank(message = "predictionId不能为空") @RequestParam String predictionId) {
|
||||
ChatModelVo chatModelVo = chatModelService.selectModelByName(model);
|
||||
if (chatModelVo == null) {
|
||||
throw new IllegalArgumentException("未找到模型配置: " + model);
|
||||
}
|
||||
return R.ok(atlasPredictionService.retrieve(chatModelVo, predictionId));
|
||||
}
|
||||
|
||||
private ChatModelVo loadModel(String modelName, String category) {
|
||||
ChatModelVo model = chatModelService.selectModelByName(modelName);
|
||||
if (model == null) {
|
||||
throw new IllegalArgumentException("未找到模型配置: " + modelName);
|
||||
}
|
||||
if (!category.equals(model.getCategory())) {
|
||||
throw new IllegalArgumentException("模型分类不匹配,期望: " + category + ", 实际: " + model.getCategory());
|
||||
}
|
||||
return model;
|
||||
}
|
||||
|
||||
private MediaGenerationResponse toImageResponse(String result) {
|
||||
if (result != null && result.startsWith("{")) {
|
||||
try {
|
||||
return atlasPredictionService.toResponse(result, "image");
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException("图片生成响应解析失败: " + e.getMessage(), e);
|
||||
}
|
||||
}
|
||||
if (result != null && result.startsWith("data:")) {
|
||||
String mimeType = result.substring("data:".length(), result.indexOf(";base64,"));
|
||||
String b64 = result.substring(result.indexOf(";base64,") + ";base64,".length());
|
||||
return MediaGenerationResponse.builder()
|
||||
.type("image")
|
||||
.mimeType(mimeType)
|
||||
.b64Json(b64)
|
||||
.dataUrl(result)
|
||||
.build();
|
||||
}
|
||||
return MediaGenerationResponse.builder()
|
||||
.type("image")
|
||||
.mimeType("image/png")
|
||||
.url(result)
|
||||
.build();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,377 @@
|
||||
package org.ruoyi.controller.shortdrama;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import jakarta.validation.Valid;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.ruoyi.common.chat.entity.media.MediaGenerationResponse;
|
||||
import org.ruoyi.common.core.domain.R;
|
||||
import org.ruoyi.common.core.exception.ServiceException;
|
||||
import org.ruoyi.common.core.service.OssService;
|
||||
import org.ruoyi.common.satoken.utils.LoginHelper;
|
||||
import org.ruoyi.domain.bo.shortdrama.ShortDramaCharacterBo;
|
||||
import org.ruoyi.domain.bo.shortdrama.ShortDramaCharacterAppearanceBo;
|
||||
import org.ruoyi.domain.bo.shortdrama.ShortDramaComposeVideoBo;
|
||||
import org.ruoyi.domain.bo.shortdrama.ShortDramaLocationBo;
|
||||
import org.ruoyi.domain.bo.shortdrama.ShortDramaProjectBo;
|
||||
import org.ruoyi.domain.bo.shortdrama.ShortDramaScriptBo;
|
||||
import org.ruoyi.domain.bo.shortdrama.ShortDramaStoryboardBo;
|
||||
import org.ruoyi.domain.bo.shortdrama.ShortDramaIdeaBo;
|
||||
import org.ruoyi.domain.vo.shortdrama.ShortDramaCharacterVo;
|
||||
import org.ruoyi.domain.vo.shortdrama.ShortDramaCharacterAppearanceVo;
|
||||
import org.ruoyi.domain.vo.shortdrama.ShortDramaComposeVideoVo;
|
||||
import org.ruoyi.domain.vo.shortdrama.ShortDramaDetailVo;
|
||||
import org.ruoyi.domain.vo.shortdrama.ShortDramaLocationVo;
|
||||
import org.ruoyi.domain.vo.shortdrama.ShortDramaProjectVo;
|
||||
import org.ruoyi.domain.vo.shortdrama.ShortDramaScriptVo;
|
||||
import org.ruoyi.domain.vo.shortdrama.ShortDramaStoryboardVo;
|
||||
import org.ruoyi.service.shortdrama.IShortDramaService;
|
||||
import org.ruoyi.service.shortdrama.IShortDramaVideoComposeService;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RequestPart;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.servlet.mvc.method.annotation.SseEmitter;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.util.List;
|
||||
|
||||
@Validated
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@RequestMapping("/short-drama")
|
||||
public class ShortDramaController {
|
||||
|
||||
private final IShortDramaService shortDramaService;
|
||||
|
||||
private final IShortDramaVideoComposeService videoComposeService;
|
||||
|
||||
private final OssService ossService;
|
||||
|
||||
// ==================== 项目 ====================
|
||||
|
||||
@GetMapping("/projects")
|
||||
public R<List<ShortDramaProjectVo>> projects() {
|
||||
return R.ok(shortDramaService.listProjects(LoginHelper.getUserId()));
|
||||
}
|
||||
|
||||
@GetMapping("/{projectId}")
|
||||
public R<ShortDramaDetailVo> detail(@PathVariable Long projectId) {
|
||||
return R.ok(shortDramaService.getDetail(projectId, LoginHelper.getUserId()));
|
||||
}
|
||||
|
||||
@PostMapping("/create-from-idea")
|
||||
public R<ShortDramaDetailVo> createFromIdea(@Valid @RequestBody ShortDramaIdeaBo bo) {
|
||||
return R.ok(shortDramaService.createFromIdea(bo, LoginHelper.getUserId()));
|
||||
}
|
||||
|
||||
/** SSE 流式创建:逐阶段推送进度,避免用户等待焦虑 */
|
||||
@PostMapping("/create-from-idea/stream")
|
||||
public SseEmitter createFromIdeaStream(@Valid @RequestBody ShortDramaIdeaBo bo) {
|
||||
return shortDramaService.createFromIdeaStream(bo, LoginHelper.getUserId());
|
||||
}
|
||||
|
||||
@PostMapping("/project")
|
||||
public R<Long> saveProject(@Valid @RequestBody ShortDramaProjectBo bo) {
|
||||
return R.ok(shortDramaService.saveProject(bo, LoginHelper.getUserId()));
|
||||
}
|
||||
|
||||
@PutMapping("/project")
|
||||
public R<Long> updateProject(@Valid @RequestBody ShortDramaProjectBo bo) {
|
||||
return R.ok(shortDramaService.saveProject(bo, LoginHelper.getUserId()));
|
||||
}
|
||||
|
||||
@DeleteMapping("/project/{projectId}")
|
||||
public R<Void> deleteProject(@NotNull @PathVariable Long projectId) {
|
||||
shortDramaService.deleteProject(projectId, LoginHelper.getUserId());
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
// ==================== 剧本 ====================
|
||||
|
||||
@PostMapping("/script")
|
||||
public R<ShortDramaScriptVo> saveScript(@Valid @RequestBody ShortDramaScriptBo bo) {
|
||||
return R.ok(shortDramaService.saveScript(bo, LoginHelper.getUserId()));
|
||||
}
|
||||
|
||||
// ==================== 分镜 ====================
|
||||
|
||||
@PostMapping("/storyboards/generate")
|
||||
public R<List<ShortDramaStoryboardVo>> generate(@NotNull @RequestParam Long projectId,
|
||||
@NotNull @RequestParam Long scriptId,
|
||||
@RequestParam(required = false) String model) {
|
||||
return R.ok(shortDramaService.generateStoryboards(projectId, scriptId, model, LoginHelper.getUserId()));
|
||||
}
|
||||
|
||||
@PostMapping("/storyboard")
|
||||
public R<ShortDramaStoryboardVo> saveStoryboard(@Valid @RequestBody ShortDramaStoryboardBo bo) {
|
||||
return R.ok(shortDramaService.saveStoryboard(bo, LoginHelper.getUserId()));
|
||||
}
|
||||
|
||||
@PostMapping("/storyboard/{storyboardId}/generate-video")
|
||||
public R<ShortDramaStoryboardVo> generateVideo(@NotNull @PathVariable Long storyboardId,
|
||||
@NotBlank @RequestParam String model) {
|
||||
return R.ok(shortDramaService.generateVideo(storyboardId, model, LoginHelper.getUserId()));
|
||||
}
|
||||
|
||||
@GetMapping("/storyboard/{storyboardId}/video-result")
|
||||
public R<ShortDramaStoryboardVo> videoResult(@NotNull @PathVariable Long storyboardId,
|
||||
@NotBlank @RequestParam String model) {
|
||||
return R.ok(shortDramaService.retrieveVideo(storyboardId, model, LoginHelper.getUserId()));
|
||||
}
|
||||
|
||||
@PostMapping("/{projectId}/generate-all-videos")
|
||||
public R<List<ShortDramaStoryboardVo>> generateAllVideos(@NotNull @PathVariable Long projectId,
|
||||
@NotBlank @RequestParam String model) {
|
||||
return R.ok(shortDramaService.generateAllVideos(projectId, model, LoginHelper.getUserId()));
|
||||
}
|
||||
|
||||
@PostMapping("/{projectId}/compose-video")
|
||||
public R<ShortDramaComposeVideoVo> composeVideo(@NotNull @PathVariable Long projectId,
|
||||
@Valid @RequestBody ShortDramaComposeVideoBo bo) {
|
||||
return R.ok(videoComposeService.composeVideo(projectId, bo, LoginHelper.getUserId()));
|
||||
}
|
||||
|
||||
@GetMapping("/{projectId}/compose-video")
|
||||
public R<ShortDramaComposeVideoVo> getComposedVideo(@NotNull @PathVariable Long projectId) {
|
||||
return R.ok(videoComposeService.getComposedVideo(projectId, LoginHelper.getUserId()));
|
||||
}
|
||||
|
||||
@GetMapping("/{projectId}/compose-video/download")
|
||||
public void downloadComposedVideo(@NotNull @PathVariable Long projectId, HttpServletResponse response)
|
||||
throws IOException {
|
||||
ShortDramaComposeVideoVo composition = videoComposeService.getComposedVideo(projectId, LoginHelper.getUserId());
|
||||
if (composition == null || !"done".equals(composition.getStatus())) {
|
||||
throw new ServiceException("成片尚未生成完成");
|
||||
}
|
||||
if (composition.getVideoOssId() != null) {
|
||||
ossService.downloadFile(composition.getVideoOssId(), response);
|
||||
return;
|
||||
}
|
||||
Path localVideo = videoComposeService.getLocalComposedVideo(projectId, LoginHelper.getUserId());
|
||||
response.setContentType("video/mp4");
|
||||
response.setHeader("Content-Disposition", "attachment; filename=short-drama-" + projectId + ".mp4");
|
||||
response.setContentLengthLong(Files.size(localVideo));
|
||||
Files.copy(localVideo, response.getOutputStream());
|
||||
}
|
||||
|
||||
// ==================== 阶段式流水线端点 ====================
|
||||
|
||||
/** Phase 1: 剧本打磨 */
|
||||
@PostMapping("/{projectId}/polish-script")
|
||||
public R<ShortDramaDetailVo> polishScript(@NotNull @PathVariable Long projectId) {
|
||||
return R.ok(shortDramaService.polishScript(projectId, LoginHelper.getUserId()));
|
||||
}
|
||||
|
||||
// ==================== 资产分析 ====================
|
||||
|
||||
/** Phase 2: 资产分析(角色+场景提取) */
|
||||
@PostMapping("/{projectId}/analyze-assets")
|
||||
public R<ShortDramaDetailVo> analyzeAssets(@NotNull @PathVariable Long projectId,
|
||||
@NotNull @RequestParam Long scriptId) {
|
||||
return R.ok(shortDramaService.analyzeAssets(projectId, scriptId, LoginHelper.getUserId()));
|
||||
}
|
||||
|
||||
// ==================== 分镜流水线 ====================
|
||||
|
||||
/** Phase 3-6: 分镜规划+摄影规则+表演指导+分镜细化 */
|
||||
@PostMapping("/{projectId}/plan-storyboard")
|
||||
public R<List<ShortDramaStoryboardVo>> planStoryboard(@NotNull @PathVariable Long projectId,
|
||||
@NotNull @RequestParam Long scriptId,
|
||||
@RequestParam(required = false) String model) {
|
||||
return R.ok(shortDramaService.planStoryboard(projectId, scriptId, model, LoginHelper.getUserId()));
|
||||
}
|
||||
|
||||
/** Phase 3-6: SSE 流式生成分镜,持续推送规划和细化进度 */
|
||||
@PostMapping("/{projectId}/plan-storyboard/stream")
|
||||
public SseEmitter planStoryboardStream(@NotNull @PathVariable Long projectId,
|
||||
@NotNull @RequestParam Long scriptId,
|
||||
@RequestParam(required = false) String model) {
|
||||
return shortDramaService.planStoryboardStream(projectId, scriptId, model, LoginHelper.getUserId());
|
||||
}
|
||||
|
||||
/** Phase 4: 重新生成摄影规则 */
|
||||
@PostMapping("/{projectId}/photography-rules")
|
||||
public R<List<ShortDramaStoryboardVo>> generatePhotographyRules(@NotNull @PathVariable Long projectId,
|
||||
@NotNull @RequestParam Long scriptId) {
|
||||
return R.ok(shortDramaService.generatePhotographyRules(projectId, scriptId, LoginHelper.getUserId()));
|
||||
}
|
||||
|
||||
/** Phase 5: 重新生成表演指导 */
|
||||
@PostMapping("/{projectId}/acting-directions")
|
||||
public R<List<ShortDramaStoryboardVo>> generateActingDirections(@NotNull @PathVariable Long projectId,
|
||||
@NotNull @RequestParam Long scriptId) {
|
||||
return R.ok(shortDramaService.generateActingDirections(projectId, scriptId, LoginHelper.getUserId()));
|
||||
}
|
||||
|
||||
// ==================== 角色管理 ====================
|
||||
|
||||
@PostMapping("/character")
|
||||
public R<ShortDramaCharacterVo> saveCharacter(@Valid @RequestBody ShortDramaCharacterBo bo) {
|
||||
return R.ok(shortDramaService.saveCharacter(bo, LoginHelper.getUserId()));
|
||||
}
|
||||
|
||||
@PutMapping("/character")
|
||||
public R<ShortDramaCharacterVo> updateCharacter(@Valid @RequestBody ShortDramaCharacterBo bo) {
|
||||
return R.ok(shortDramaService.saveCharacter(bo, LoginHelper.getUserId()));
|
||||
}
|
||||
|
||||
@DeleteMapping("/character/{characterId}")
|
||||
public R<Void> deleteCharacter(@NotNull @PathVariable Long characterId) {
|
||||
shortDramaService.deleteCharacter(characterId, LoginHelper.getUserId());
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
@PostMapping("/character/{characterId}/generate-image")
|
||||
public R<ShortDramaCharacterVo> generateCharacterImage(@NotNull @PathVariable Long characterId,
|
||||
@NotBlank @RequestParam String model,
|
||||
@RequestParam(required = false) String referenceImageUrl) {
|
||||
return R.ok(shortDramaService.generateCharacterImage(characterId, model, referenceImageUrl, LoginHelper.getUserId()));
|
||||
}
|
||||
|
||||
// ==================== 角色形象管理 ====================
|
||||
|
||||
@PostMapping("/character-appearance")
|
||||
public R<ShortDramaCharacterAppearanceVo> saveAppearance(@Valid @RequestBody ShortDramaCharacterAppearanceBo bo) {
|
||||
return R.ok(shortDramaService.saveAppearance(bo, LoginHelper.getUserId()));
|
||||
}
|
||||
|
||||
@PutMapping("/character-appearance")
|
||||
public R<ShortDramaCharacterAppearanceVo> updateAppearance(@Valid @RequestBody ShortDramaCharacterAppearanceBo bo) {
|
||||
return R.ok(shortDramaService.saveAppearance(bo, LoginHelper.getUserId()));
|
||||
}
|
||||
|
||||
@DeleteMapping("/character-appearance/{appearanceId}")
|
||||
public R<Void> deleteAppearance(@NotNull @PathVariable Long appearanceId) {
|
||||
shortDramaService.deleteAppearance(appearanceId, LoginHelper.getUserId());
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
@PostMapping("/character-appearance/{appearanceId}/generate-image")
|
||||
public R<ShortDramaCharacterAppearanceVo> generateAppearanceImage(@NotNull @PathVariable Long appearanceId,
|
||||
@NotBlank @RequestParam String model,
|
||||
@RequestParam(required = false) String referenceImageUrl) {
|
||||
return R.ok(shortDramaService.generateAppearanceImage(appearanceId, model, referenceImageUrl, LoginHelper.getUserId()));
|
||||
}
|
||||
|
||||
@PostMapping("/character-appearance/{appearanceId}/regenerate")
|
||||
public R<ShortDramaCharacterAppearanceVo> regenerateAppearanceImage(@NotNull @PathVariable Long appearanceId,
|
||||
@NotBlank @RequestParam String model,
|
||||
@RequestParam(required = false) String referenceImageUrl) {
|
||||
return R.ok(shortDramaService.regenerateAppearanceImage(appearanceId, model, referenceImageUrl, LoginHelper.getUserId()));
|
||||
}
|
||||
|
||||
@PostMapping("/character-appearance/{appearanceId}/select-image")
|
||||
public R<ShortDramaCharacterAppearanceVo> selectAppearanceImage(@NotNull @PathVariable Long appearanceId,
|
||||
@NotNull @RequestParam Integer index) {
|
||||
return R.ok(shortDramaService.selectAppearanceImage(appearanceId, index, LoginHelper.getUserId()));
|
||||
}
|
||||
|
||||
@DeleteMapping("/character-appearance/{appearanceId}/image")
|
||||
public R<ShortDramaCharacterAppearanceVo> deleteAppearanceImage(@NotNull @PathVariable Long appearanceId,
|
||||
@NotNull @RequestParam Integer index) {
|
||||
return R.ok(shortDramaService.deleteAppearanceImage(appearanceId, index, LoginHelper.getUserId()));
|
||||
}
|
||||
|
||||
@PostMapping("/character-appearance/{appearanceId}/undo-image")
|
||||
public R<ShortDramaCharacterAppearanceVo> undoAppearanceImage(@NotNull @PathVariable Long appearanceId) {
|
||||
return R.ok(shortDramaService.undoAppearanceImage(appearanceId, LoginHelper.getUserId()));
|
||||
}
|
||||
|
||||
// ==================== 场景管理 ====================
|
||||
|
||||
@PostMapping("/location")
|
||||
public R<ShortDramaLocationVo> saveLocation(@Valid @RequestBody ShortDramaLocationBo bo) {
|
||||
return R.ok(shortDramaService.saveLocation(bo, LoginHelper.getUserId()));
|
||||
}
|
||||
|
||||
@PutMapping("/location")
|
||||
public R<ShortDramaLocationVo> updateLocation(@Valid @RequestBody ShortDramaLocationBo bo) {
|
||||
return R.ok(shortDramaService.saveLocation(bo, LoginHelper.getUserId()));
|
||||
}
|
||||
|
||||
@DeleteMapping("/location/{locationId}")
|
||||
public R<Void> deleteLocation(@NotNull @PathVariable Long locationId) {
|
||||
shortDramaService.deleteLocation(locationId, LoginHelper.getUserId());
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
@PostMapping("/location/{locationId}/generate-image")
|
||||
public R<ShortDramaLocationVo> generateLocationImage(@NotNull @PathVariable Long locationId,
|
||||
@NotBlank @RequestParam String model,
|
||||
@RequestParam(required = false) String referenceImageUrl) {
|
||||
return R.ok(shortDramaService.generateLocationImage(locationId, model, referenceImageUrl, LoginHelper.getUserId()));
|
||||
}
|
||||
|
||||
@PostMapping("/location/{locationId}/regenerate")
|
||||
public R<ShortDramaLocationVo> regenerateLocationImage(@NotNull @PathVariable Long locationId,
|
||||
@NotBlank @RequestParam String model,
|
||||
@RequestParam(required = false) String referenceImageUrl) {
|
||||
return R.ok(shortDramaService.regenerateLocationImage(locationId, model, referenceImageUrl, LoginHelper.getUserId()));
|
||||
}
|
||||
|
||||
@PostMapping("/location/{locationId}/select-image")
|
||||
public R<ShortDramaLocationVo> selectLocationImage(@NotNull @PathVariable Long locationId,
|
||||
@NotNull @RequestParam Integer index) {
|
||||
return R.ok(shortDramaService.selectLocationImage(locationId, index, LoginHelper.getUserId()));
|
||||
}
|
||||
|
||||
@DeleteMapping("/location/{locationId}/image")
|
||||
public R<ShortDramaLocationVo> deleteLocationImage(@NotNull @PathVariable Long locationId,
|
||||
@NotNull @RequestParam Integer index) {
|
||||
return R.ok(shortDramaService.deleteLocationImage(locationId, index, LoginHelper.getUserId()));
|
||||
}
|
||||
|
||||
@PostMapping("/location/{locationId}/undo-image")
|
||||
public R<ShortDramaLocationVo> undoLocationImage(@NotNull @PathVariable Long locationId) {
|
||||
return R.ok(shortDramaService.undoLocationImage(locationId, LoginHelper.getUserId()));
|
||||
}
|
||||
|
||||
// ==================== 异步图片生成(轮询进度) ====================
|
||||
|
||||
/** 上传本地照片到图片供应商,返回当前生成会话使用的临时 URL。 */
|
||||
@PostMapping(value = "/image/upload-reference", consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
|
||||
public R<String> uploadReferenceImage(@RequestPart("file") MultipartFile file,
|
||||
@NotBlank @RequestParam String model) {
|
||||
String temporaryUrl = shortDramaService.uploadReferenceImage(file, model, LoginHelper.getUserId());
|
||||
return R.ok("上传成功", temporaryUrl);
|
||||
}
|
||||
|
||||
/** 异步启动图片生成,返回 predictionId 供前端轮询 */
|
||||
@PostMapping("/image/start")
|
||||
public R<MediaGenerationResponse> startImage(@NotBlank @RequestParam String assetType,
|
||||
@NotNull @RequestParam Long assetId,
|
||||
@NotBlank @RequestParam String model,
|
||||
@RequestParam(required = false) String referenceImageUrl) {
|
||||
return R.ok(shortDramaService.startImageGeneration(assetType, assetId, model, referenceImageUrl, LoginHelper.getUserId()));
|
||||
}
|
||||
|
||||
/** 轮询确认形象图片并保存 */
|
||||
@PostMapping("/character-appearance/{id}/confirm-image")
|
||||
public R<ShortDramaCharacterAppearanceVo> confirmAppearanceImage(@NotNull @PathVariable Long id,
|
||||
@NotBlank @RequestParam String predictionId,
|
||||
@NotBlank @RequestParam String model) {
|
||||
return R.ok(shortDramaService.confirmAppearanceImage(id, predictionId, model, LoginHelper.getUserId()));
|
||||
}
|
||||
|
||||
/** 轮询确认场景图片并保存 */
|
||||
@PostMapping("/location/{id}/confirm-image")
|
||||
public R<ShortDramaLocationVo> confirmLocationImage(@NotNull @PathVariable Long id,
|
||||
@NotBlank @RequestParam String predictionId,
|
||||
@NotBlank @RequestParam String model) {
|
||||
return R.ok(shortDramaService.confirmLocationImage(id, predictionId, model, LoginHelper.getUserId()));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,95 @@
|
||||
package org.ruoyi.domain.bo.agent;
|
||||
|
||||
import io.github.linpeilie.annotations.AutoMapper;
|
||||
import io.github.linpeilie.annotations.AutoMapping;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import jakarta.validation.constraints.Size;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import org.ruoyi.common.mybatis.core.domain.BaseEntity;
|
||||
import org.ruoyi.domain.entity.agent.Agent;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 智能体业务对象
|
||||
*
|
||||
* @author ruoyi team
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@AutoMapper(target = Agent.class, reverseConvertGenerate = false)
|
||||
public class AgentBo extends BaseEntity {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 智能体ID
|
||||
*/
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 智能体名称
|
||||
*/
|
||||
@NotBlank(message = "智能体名称不能为空")
|
||||
@Size(min = 0, max = 200, message = "智能体名称不能超过{max}个字符")
|
||||
private String agentName;
|
||||
|
||||
/**
|
||||
* 智能体描述
|
||||
*/
|
||||
private String agentDescribe;
|
||||
|
||||
/**
|
||||
* 展示图标/头像URL
|
||||
*/
|
||||
private String agentShow;
|
||||
|
||||
/**
|
||||
* 绑定的聊天模型ID
|
||||
*/
|
||||
@NotNull(message = "绑定模型不能为空")
|
||||
private Long modelId;
|
||||
|
||||
/**
|
||||
* 是否启用深度思考:0 否 1 是
|
||||
*/
|
||||
private String enableThinking;
|
||||
|
||||
/**
|
||||
* 自定义系统提示词
|
||||
*/
|
||||
private String systemPrompt;
|
||||
|
||||
/**
|
||||
* 关联MCP工具ID列表
|
||||
*/
|
||||
@AutoMapping(target = "mcpToolIds", expression = "java(org.ruoyi.common.json.utils.JsonUtils.toJsonString(source.getMcpToolIds()))")
|
||||
private List<Long> mcpToolIds;
|
||||
|
||||
/**
|
||||
* 关联磁盘技能名列表
|
||||
*/
|
||||
@AutoMapping(target = "skillNames", expression = "java(org.ruoyi.common.json.utils.JsonUtils.toJsonString(source.getSkillNames()))")
|
||||
private List<String> skillNames;
|
||||
|
||||
/**
|
||||
* 关联知识库ID列表
|
||||
*/
|
||||
@AutoMapping(target = "knowledgeIds", expression = "java(org.ruoyi.common.json.utils.JsonUtils.toJsonString(source.getKnowledgeIds()))")
|
||||
private List<Long> knowledgeIds;
|
||||
|
||||
/**
|
||||
* 状态:0 正常 1 停用
|
||||
*/
|
||||
private String status;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String remark;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
package org.ruoyi.domain.bo.media;
|
||||
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.Max;
|
||||
import jakarta.validation.constraints.Min;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class ImageGenerationRequest {
|
||||
|
||||
@NotBlank(message = "模型不能为空")
|
||||
private String model;
|
||||
|
||||
@NotBlank(message = "提示词不能为空")
|
||||
private String prompt;
|
||||
|
||||
private String size;
|
||||
|
||||
@Min(value = 0, message = "随机种子不能小于0")
|
||||
@Max(value = 2147483647, message = "随机种子不能大于2147483647")
|
||||
private Integer seed;
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
package org.ruoyi.domain.bo.media;
|
||||
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class SpeechGenerationRequest {
|
||||
|
||||
@NotBlank(message = "模型不能为空")
|
||||
private String model;
|
||||
|
||||
@NotBlank(message = "输入文本不能为空")
|
||||
private String input;
|
||||
|
||||
private String voice;
|
||||
|
||||
private String responseFormat;
|
||||
|
||||
private Double speed;
|
||||
|
||||
private String instructions;
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package org.ruoyi.domain.bo.media;
|
||||
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class VideoGenerationRequest {
|
||||
|
||||
@NotBlank(message = "模型不能为空")
|
||||
private String model;
|
||||
|
||||
@NotBlank(message = "提示词不能为空")
|
||||
private String prompt;
|
||||
|
||||
private String size;
|
||||
|
||||
private Integer seconds;
|
||||
|
||||
private String quality;
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
package org.ruoyi.domain.bo.shortdrama;
|
||||
|
||||
import io.github.linpeilie.annotations.AutoMapper;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import org.ruoyi.common.mybatis.core.domain.BaseEntity;
|
||||
import org.ruoyi.domain.entity.shortdrama.ShortDramaCharacterAppearance;
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@AutoMapper(target = ShortDramaCharacterAppearance.class, reverseConvertGenerate = false)
|
||||
public class ShortDramaCharacterAppearanceBo extends BaseEntity {
|
||||
|
||||
private Long id;
|
||||
|
||||
private Long characterId;
|
||||
|
||||
private Integer appearanceIndex;
|
||||
|
||||
private String changeReason;
|
||||
|
||||
private String description;
|
||||
|
||||
private String referenceImageUrl;
|
||||
|
||||
private String imageUrls;
|
||||
|
||||
private String imageDescriptions;
|
||||
|
||||
private Integer selectedImageIndex;
|
||||
|
||||
private String previousImageUrls;
|
||||
|
||||
private String previousDescriptions;
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
package org.ruoyi.domain.bo.shortdrama;
|
||||
|
||||
import io.github.linpeilie.annotations.AutoMapper;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import org.ruoyi.common.mybatis.core.domain.BaseEntity;
|
||||
import org.ruoyi.domain.entity.shortdrama.ShortDramaCharacter;
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@AutoMapper(target = ShortDramaCharacter.class, reverseConvertGenerate = false)
|
||||
public class ShortDramaCharacterBo extends BaseEntity {
|
||||
|
||||
private Long id;
|
||||
|
||||
private Long projectId;
|
||||
|
||||
private String name;
|
||||
|
||||
private String aliases;
|
||||
|
||||
private String introduction;
|
||||
|
||||
private String roleLevel;
|
||||
|
||||
private String gender;
|
||||
|
||||
private String ageRange;
|
||||
|
||||
private String personalityTags;
|
||||
|
||||
private Integer costumeTier;
|
||||
|
||||
private String visualDescription;
|
||||
|
||||
private String referenceImageUrl;
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
package org.ruoyi.domain.bo.shortdrama;
|
||||
|
||||
import jakarta.validation.constraints.DecimalMin;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import jakarta.validation.constraints.Pattern;
|
||||
import jakarta.validation.constraints.Size;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class ShortDramaComposeVideoBo {
|
||||
|
||||
@NotBlank(message = "转场类型不能为空")
|
||||
@Pattern(regexp = "none|dissolve|fade|slide", message = "不支持的转场类型")
|
||||
private String transitionType = "dissolve";
|
||||
|
||||
@NotNull(message = "转场时长不能为空")
|
||||
@DecimalMin(value = "0.0", message = "转场时长不能小于0秒")
|
||||
private BigDecimal transitionDurationSeconds = new BigDecimal("0.5");
|
||||
|
||||
@NotBlank(message = "成片画幅不能为空")
|
||||
@Pattern(regexp = "9:16|16:9|1:1", message = "不支持的成片画幅")
|
||||
private String aspectRatio = "9:16";
|
||||
@Size(min = 2, message = "至少选择2个分镜视频")
|
||||
private List<Long> storyboardIds;
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package org.ruoyi.domain.bo.shortdrama;
|
||||
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class ShortDramaIdeaBo {
|
||||
|
||||
@NotBlank(message = "创意想法不能为空")
|
||||
private String idea;
|
||||
|
||||
@NotBlank(message = "模型不能为空")
|
||||
private String model;
|
||||
|
||||
private String projectName;
|
||||
|
||||
private String artStyle;
|
||||
|
||||
private String aspectRatio;
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
package org.ruoyi.domain.bo.shortdrama;
|
||||
|
||||
import io.github.linpeilie.annotations.AutoMapper;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import org.ruoyi.common.mybatis.core.domain.BaseEntity;
|
||||
import org.ruoyi.domain.entity.shortdrama.ShortDramaLocation;
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@AutoMapper(target = ShortDramaLocation.class, reverseConvertGenerate = false)
|
||||
public class ShortDramaLocationBo extends BaseEntity {
|
||||
|
||||
private Long id;
|
||||
|
||||
private Long projectId;
|
||||
|
||||
private String name;
|
||||
|
||||
private String summary;
|
||||
|
||||
private Boolean hasCrowd;
|
||||
|
||||
private String crowdDescription;
|
||||
|
||||
private String availableSlots;
|
||||
|
||||
private String descriptions;
|
||||
|
||||
private String referenceImageUrl;
|
||||
|
||||
private String imageUrls;
|
||||
|
||||
private String imageDescriptions;
|
||||
|
||||
private Integer selectedImageIndex;
|
||||
|
||||
private String previousImageUrls;
|
||||
|
||||
private String previousDescriptions;
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
package org.ruoyi.domain.bo.shortdrama;
|
||||
|
||||
import io.github.linpeilie.annotations.AutoMapper;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import org.ruoyi.common.mybatis.core.domain.BaseEntity;
|
||||
import org.ruoyi.domain.entity.shortdrama.ShortDramaProject;
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@AutoMapper(target = ShortDramaProject.class, reverseConvertGenerate = false)
|
||||
public class ShortDramaProjectBo extends BaseEntity {
|
||||
|
||||
private Long id;
|
||||
|
||||
private Long userId;
|
||||
|
||||
private String projectName;
|
||||
|
||||
private String description;
|
||||
|
||||
private String status;
|
||||
|
||||
private String artStyle;
|
||||
|
||||
private String composeAspectRatio;
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
package org.ruoyi.domain.bo.shortdrama;
|
||||
|
||||
import io.github.linpeilie.annotations.AutoMapper;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import org.ruoyi.common.mybatis.core.domain.BaseEntity;
|
||||
import org.ruoyi.domain.entity.shortdrama.ShortDramaScript;
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@AutoMapper(target = ShortDramaScript.class, reverseConvertGenerate = false)
|
||||
public class ShortDramaScriptBo extends BaseEntity {
|
||||
|
||||
private Long id;
|
||||
|
||||
private Long projectId;
|
||||
|
||||
private String scriptName;
|
||||
|
||||
private String scriptText;
|
||||
|
||||
private String outlineText;
|
||||
|
||||
private String tone;
|
||||
|
||||
private String sourceType;
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
package org.ruoyi.domain.bo.shortdrama;
|
||||
|
||||
import dev.langchain4j.model.output.structured.Description;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* Phase 1 剧本打磨结构化响应 —— langchain4j AiServices 自动解析用
|
||||
*
|
||||
* @author ageerle
|
||||
*/
|
||||
@Data
|
||||
public class ShortDramaScriptResult {
|
||||
|
||||
@Description("项目名称(有吸引力的短剧名)")
|
||||
private String projectName;
|
||||
|
||||
@Description("一句话简介(20-50字)")
|
||||
private String description;
|
||||
|
||||
@Description("剧本名称")
|
||||
private String scriptName;
|
||||
|
||||
@Description("风格基调(如:都市甜宠/古装虐恋/悬疑惊悚/喜剧爽文)")
|
||||
private String tone;
|
||||
|
||||
@Description("剧情大纲(400-800字,完整故事线)")
|
||||
private String outlineText;
|
||||
|
||||
@Description("完整短剧文本(1000-3000字,标准剧本格式,含场景头、动作描述、对话)")
|
||||
private String scriptText;
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
package org.ruoyi.domain.bo.shortdrama;
|
||||
|
||||
import io.github.linpeilie.annotations.AutoMapper;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import org.ruoyi.common.mybatis.core.domain.BaseEntity;
|
||||
import org.ruoyi.domain.entity.shortdrama.ShortDramaStoryboard;
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@AutoMapper(target = ShortDramaStoryboard.class, reverseConvertGenerate = false)
|
||||
public class ShortDramaStoryboardBo extends BaseEntity {
|
||||
|
||||
private Long id;
|
||||
|
||||
private Long projectId;
|
||||
|
||||
private Long scriptId;
|
||||
|
||||
private Integer sceneNo;
|
||||
|
||||
private String sceneTitle;
|
||||
|
||||
private String sceneText;
|
||||
|
||||
private String sceneType;
|
||||
|
||||
private String shotType;
|
||||
|
||||
private String cameraMove;
|
||||
|
||||
private String charactersJson;
|
||||
|
||||
private String locationName;
|
||||
|
||||
private String photographyRules;
|
||||
|
||||
private String actingNotes;
|
||||
|
||||
private String continuityJson;
|
||||
|
||||
private String sourceText;
|
||||
|
||||
private String imagePrompt;
|
||||
|
||||
private Integer durationSeconds;
|
||||
|
||||
private String videoPrompt;
|
||||
}
|
||||
@@ -0,0 +1,84 @@
|
||||
package org.ruoyi.domain.entity.agent;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import org.ruoyi.common.tenant.core.TenantEntity;
|
||||
|
||||
/**
|
||||
* 智能体信息实体
|
||||
* <p>
|
||||
* 一个智能体聚合:一个聊天模型 + 一组 MCP 工具 + 一组磁盘技能 + 一组知识库 + 自定义提示词
|
||||
* 关联以 JSON 数组字符串列存储:mcp_tool_ids / skill_names / knowledge_ids
|
||||
*
|
||||
* @author ruoyi team
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@TableName("agent_info")
|
||||
public class Agent extends TenantEntity {
|
||||
|
||||
/**
|
||||
* 智能体ID
|
||||
*/
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 智能体名称
|
||||
*/
|
||||
private String agentName;
|
||||
|
||||
/**
|
||||
* 智能体描述(下拉展示用)
|
||||
*/
|
||||
private String agentDescribe;
|
||||
|
||||
/**
|
||||
* 展示图标/头像URL
|
||||
*/
|
||||
private String agentShow;
|
||||
|
||||
/**
|
||||
* 绑定的聊天模型ID(chat_model.id, category=chat)
|
||||
*/
|
||||
private Long modelId;
|
||||
|
||||
/**
|
||||
* 是否启用深度思考(ReAct多子Agent):0 否 1 是
|
||||
*/
|
||||
private String enableThinking;
|
||||
|
||||
/**
|
||||
* 自定义系统提示词
|
||||
*/
|
||||
private String systemPrompt;
|
||||
|
||||
/**
|
||||
* 关联MCP工具ID列表(JSON数组,[Long])
|
||||
*/
|
||||
private String mcpToolIds;
|
||||
|
||||
/**
|
||||
* 关联磁盘技能名列表(JSON数组,[String])
|
||||
*/
|
||||
private String skillNames;
|
||||
|
||||
/**
|
||||
* 关联知识库ID列表(JSON数组,[Long])
|
||||
*/
|
||||
private String knowledgeIds;
|
||||
|
||||
/**
|
||||
* 状态:0 正常 1 停用
|
||||
*/
|
||||
private String status;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String remark;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
package org.ruoyi.domain.entity.shortdrama;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import org.ruoyi.common.mybatis.core.domain.BaseEntity;
|
||||
|
||||
import java.io.Serial;
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@TableName("short_drama_character")
|
||||
public class ShortDramaCharacter extends BaseEntity {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@TableId(value = "id")
|
||||
private Long id;
|
||||
|
||||
private Long projectId;
|
||||
|
||||
private String name;
|
||||
|
||||
private String aliases;
|
||||
|
||||
private String introduction;
|
||||
|
||||
private String roleLevel;
|
||||
|
||||
private String gender;
|
||||
|
||||
private String ageRange;
|
||||
|
||||
private String personalityTags;
|
||||
|
||||
private Integer costumeTier;
|
||||
|
||||
private String visualDescription;
|
||||
|
||||
private String referenceImageUrl;
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
package org.ruoyi.domain.entity.shortdrama;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import org.ruoyi.common.mybatis.core.domain.BaseEntity;
|
||||
|
||||
import java.io.Serial;
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@TableName("short_drama_character_appearance")
|
||||
public class ShortDramaCharacterAppearance extends BaseEntity {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@TableId(value = "id")
|
||||
private Long id;
|
||||
|
||||
private Long characterId;
|
||||
|
||||
private Integer appearanceIndex;
|
||||
|
||||
private String changeReason;
|
||||
|
||||
private String description;
|
||||
|
||||
private String referenceImageUrl;
|
||||
|
||||
/** 生成图片URL列表(JSON数组) */
|
||||
private String imageUrls;
|
||||
|
||||
/** 每张图片对应的提示词(JSON数组) */
|
||||
private String imageDescriptions;
|
||||
|
||||
/** 当前选中的图片索引 */
|
||||
private Integer selectedImageIndex;
|
||||
|
||||
/** 上一轮图片URL列表(撤销用,JSON数组) */
|
||||
private String previousImageUrls;
|
||||
|
||||
/** 上一轮提示词列表(撤销用,JSON数组) */
|
||||
private String previousDescriptions;
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
package org.ruoyi.domain.entity.shortdrama;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import org.ruoyi.common.mybatis.core.domain.BaseEntity;
|
||||
|
||||
import java.io.Serial;
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@TableName("short_drama_location")
|
||||
public class ShortDramaLocation extends BaseEntity {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@TableId(value = "id")
|
||||
private Long id;
|
||||
|
||||
private Long projectId;
|
||||
|
||||
private String name;
|
||||
|
||||
private String summary;
|
||||
|
||||
private Boolean hasCrowd;
|
||||
|
||||
private String crowdDescription;
|
||||
|
||||
private String availableSlots;
|
||||
|
||||
private String descriptions;
|
||||
|
||||
private String referenceImageUrl;
|
||||
|
||||
/** 生成图片URL列表(JSON数组) */
|
||||
private String imageUrls;
|
||||
|
||||
/** 每张图片对应的提示词(JSON数组) */
|
||||
private String imageDescriptions;
|
||||
|
||||
/** 当前选中的图片索引 */
|
||||
private Integer selectedImageIndex;
|
||||
|
||||
/** 上一轮图片URL列表(撤销用,JSON数组) */
|
||||
private String previousImageUrls;
|
||||
|
||||
/** 上一轮提示词列表(撤销用,JSON数组) */
|
||||
private String previousDescriptions;
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
package org.ruoyi.domain.entity.shortdrama;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import org.ruoyi.common.mybatis.core.domain.BaseEntity;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@TableName("short_drama_project")
|
||||
public class ShortDramaProject extends BaseEntity {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@TableId(value = "id")
|
||||
private Long id;
|
||||
|
||||
private Long userId;
|
||||
|
||||
private String projectName;
|
||||
|
||||
private String description;
|
||||
|
||||
private String status;
|
||||
|
||||
private String artStyle;
|
||||
|
||||
private Long composedVideoOssId;
|
||||
|
||||
private String composeStatus;
|
||||
|
||||
private String composeJobId;
|
||||
|
||||
private Integer composeProgress;
|
||||
|
||||
private String composeTransitionType;
|
||||
|
||||
private BigDecimal composeTransitionDurationSeconds;
|
||||
|
||||
private String composeAspectRatio;
|
||||
|
||||
private BigDecimal composedVideoDurationSeconds;
|
||||
|
||||
private String composeErrorMessage;
|
||||
|
||||
private Date composedAt;
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
package org.ruoyi.domain.entity.shortdrama;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import org.ruoyi.common.mybatis.core.domain.BaseEntity;
|
||||
|
||||
import java.io.Serial;
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@TableName("short_drama_script")
|
||||
public class ShortDramaScript extends BaseEntity {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@TableId(value = "id")
|
||||
private Long id;
|
||||
|
||||
private Long projectId;
|
||||
|
||||
private String scriptName;
|
||||
|
||||
private String scriptText;
|
||||
|
||||
private String outlineText;
|
||||
|
||||
private String tone;
|
||||
|
||||
private String sourceType;
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
package org.ruoyi.domain.entity.shortdrama;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import org.ruoyi.common.mybatis.core.domain.BaseEntity;
|
||||
|
||||
import java.io.Serial;
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@TableName("short_drama_storyboard")
|
||||
public class ShortDramaStoryboard extends BaseEntity {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@TableId(value = "id")
|
||||
private Long id;
|
||||
|
||||
private Long projectId;
|
||||
|
||||
private Long scriptId;
|
||||
|
||||
private Integer sceneNo;
|
||||
|
||||
private String sceneTitle;
|
||||
|
||||
private String sceneText;
|
||||
|
||||
private String sceneType;
|
||||
|
||||
private String shotType;
|
||||
|
||||
private String cameraMove;
|
||||
|
||||
private String charactersJson;
|
||||
|
||||
private String locationName;
|
||||
|
||||
private String photographyRules;
|
||||
|
||||
private String actingNotes;
|
||||
|
||||
private String continuityJson;
|
||||
|
||||
private String sourceText;
|
||||
|
||||
private String imagePrompt;
|
||||
|
||||
private Integer durationSeconds;
|
||||
|
||||
private String videoPrompt;
|
||||
|
||||
private String videoUrl;
|
||||
|
||||
private String videoId;
|
||||
|
||||
private String videoStatus;
|
||||
}
|
||||
@@ -0,0 +1,121 @@
|
||||
package org.ruoyi.domain.vo.agent;
|
||||
|
||||
import cn.idev.excel.annotation.ExcelIgnoreUnannotated;
|
||||
import cn.idev.excel.annotation.ExcelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 智能体视图对象
|
||||
* <p>
|
||||
* 注意:不使用 @AutoMapper,因为 entity 的 mcpToolIds/skillNames/knowledgeIds 是 JSON 字符串列,
|
||||
* 而 VO 是 List 类型,MapStruct 无法双向自动转换。由 AgentServiceImpl.toVo 手动组装。
|
||||
*
|
||||
* @author ruoyi team
|
||||
*/
|
||||
@Data
|
||||
@ExcelIgnoreUnannotated
|
||||
public class AgentVo implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 智能体ID
|
||||
*/
|
||||
@ExcelProperty(value = "智能体ID")
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 智能体名称
|
||||
*/
|
||||
@ExcelProperty(value = "智能体名称")
|
||||
private String agentName;
|
||||
|
||||
/**
|
||||
* 智能体描述
|
||||
*/
|
||||
@ExcelProperty(value = "智能体描述")
|
||||
private String agentDescribe;
|
||||
|
||||
/**
|
||||
* 展示图标/头像URL
|
||||
*/
|
||||
private String agentShow;
|
||||
|
||||
/**
|
||||
* 绑定的聊天模型ID
|
||||
*/
|
||||
@ExcelProperty(value = "绑定模型ID")
|
||||
private Long modelId;
|
||||
|
||||
/**
|
||||
* 绑定的聊天模型名称(关联展示)
|
||||
*/
|
||||
@ExcelProperty(value = "绑定模型")
|
||||
private String modelName;
|
||||
|
||||
/**
|
||||
* 是否启用深度思考:0 否 1 是
|
||||
*/
|
||||
@ExcelProperty(value = "深度思考")
|
||||
private String enableThinking;
|
||||
|
||||
/**
|
||||
* 自定义系统提示词
|
||||
*/
|
||||
private String systemPrompt;
|
||||
|
||||
/**
|
||||
* 关联MCP工具ID列表
|
||||
*/
|
||||
private List<Long> mcpToolIds;
|
||||
|
||||
/**
|
||||
* 关联MCP工具名称列表(关联展示)
|
||||
*/
|
||||
private List<String> mcpToolNames;
|
||||
|
||||
/**
|
||||
* 关联磁盘技能名列表
|
||||
*/
|
||||
private List<String> skillNames;
|
||||
|
||||
/**
|
||||
* 关联知识库ID列表
|
||||
*/
|
||||
private List<Long> knowledgeIds;
|
||||
|
||||
/**
|
||||
* 关联知识库名称列表(关联展示)
|
||||
*/
|
||||
private List<String> knowledgeNames;
|
||||
|
||||
/**
|
||||
* 状态:0 正常 1 停用
|
||||
*/
|
||||
@ExcelProperty(value = "状态")
|
||||
private String status;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String remark;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@ExcelProperty(value = "创建时间")
|
||||
private Date createTime;
|
||||
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
@ExcelProperty(value = "更新时间")
|
||||
private Date updateTime;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
package org.ruoyi.domain.vo.agent;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 磁盘技能可选项
|
||||
*
|
||||
* @author ruoyi team
|
||||
*/
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class SkillOptionVo implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 技能名称(对应 SKILL.md front-matter name)
|
||||
*/
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 技能描述
|
||||
*/
|
||||
private String description;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
package org.ruoyi.domain.vo.shortdrama;
|
||||
|
||||
import io.github.linpeilie.annotations.AutoMapper;
|
||||
import lombok.Data;
|
||||
import org.ruoyi.domain.entity.shortdrama.ShortDramaCharacterAppearance;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
@Data
|
||||
@AutoMapper(target = ShortDramaCharacterAppearance.class)
|
||||
public class ShortDramaCharacterAppearanceVo implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private Long id;
|
||||
|
||||
private Long characterId;
|
||||
|
||||
private Integer appearanceIndex;
|
||||
|
||||
private String changeReason;
|
||||
|
||||
private String description;
|
||||
|
||||
private String referenceImageUrl;
|
||||
|
||||
private String imageUrls;
|
||||
|
||||
private String imageDescriptions;
|
||||
|
||||
private Integer selectedImageIndex;
|
||||
|
||||
private String previousImageUrls;
|
||||
|
||||
private String previousDescriptions;
|
||||
|
||||
private Date createTime;
|
||||
|
||||
private Date updateTime;
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
package org.ruoyi.domain.vo.shortdrama;
|
||||
|
||||
import io.github.linpeilie.annotations.AutoMapper;
|
||||
import lombok.Data;
|
||||
import org.ruoyi.domain.entity.shortdrama.ShortDramaCharacter;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
@AutoMapper(target = ShortDramaCharacter.class)
|
||||
public class ShortDramaCharacterVo implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private Long id;
|
||||
|
||||
private Long projectId;
|
||||
|
||||
private String name;
|
||||
|
||||
private String aliases;
|
||||
|
||||
private String introduction;
|
||||
|
||||
private String roleLevel;
|
||||
|
||||
private String gender;
|
||||
|
||||
private String ageRange;
|
||||
|
||||
private String personalityTags;
|
||||
|
||||
private Integer costumeTier;
|
||||
|
||||
private String visualDescription;
|
||||
|
||||
private String referenceImageUrl;
|
||||
|
||||
private List<ShortDramaCharacterAppearanceVo> appearances;
|
||||
|
||||
private Date createTime;
|
||||
|
||||
private Date updateTime;
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
package org.ruoyi.domain.vo.shortdrama;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class ShortDramaComposeVideoVo implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private Long projectId;
|
||||
|
||||
private String status;
|
||||
|
||||
private Integer progress;
|
||||
|
||||
private String transitionType;
|
||||
|
||||
private BigDecimal transitionDurationSeconds;
|
||||
|
||||
private String aspectRatio;
|
||||
|
||||
/** Actual duration measured from the final MP4 with ffprobe. */
|
||||
private BigDecimal outputDurationSeconds;
|
||||
|
||||
private Long videoOssId;
|
||||
|
||||
/** Freshly resolved URL; private-bucket URLs may be short lived. */
|
||||
private String videoUrl;
|
||||
|
||||
private String errorMessage;
|
||||
|
||||
private Date composedAt;
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
package org.ruoyi.domain.vo.shortdrama;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class ShortDramaDetailVo implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private ShortDramaProjectVo project;
|
||||
|
||||
private ShortDramaScriptVo script;
|
||||
|
||||
private List<ShortDramaCharacterVo> characters;
|
||||
|
||||
private List<ShortDramaLocationVo> locations;
|
||||
|
||||
private List<ShortDramaStoryboardVo> storyboards;
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
package org.ruoyi.domain.vo.shortdrama;
|
||||
|
||||
import io.github.linpeilie.annotations.AutoMapper;
|
||||
import lombok.Data;
|
||||
import org.ruoyi.domain.entity.shortdrama.ShortDramaLocation;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
@Data
|
||||
@AutoMapper(target = ShortDramaLocation.class)
|
||||
public class ShortDramaLocationVo implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private Long id;
|
||||
|
||||
private Long projectId;
|
||||
|
||||
private String name;
|
||||
|
||||
private String summary;
|
||||
|
||||
private Boolean hasCrowd;
|
||||
|
||||
private String crowdDescription;
|
||||
|
||||
private String availableSlots;
|
||||
|
||||
private String descriptions;
|
||||
|
||||
private String referenceImageUrl;
|
||||
|
||||
private String imageUrls;
|
||||
|
||||
private String imageDescriptions;
|
||||
|
||||
private Integer selectedImageIndex;
|
||||
|
||||
private String previousImageUrls;
|
||||
|
||||
private String previousDescriptions;
|
||||
|
||||
private Date createTime;
|
||||
|
||||
private Date updateTime;
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
package org.ruoyi.domain.vo.shortdrama;
|
||||
|
||||
import io.github.linpeilie.annotations.AutoMapper;
|
||||
import lombok.Data;
|
||||
import org.ruoyi.domain.entity.shortdrama.ShortDramaProject;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
@Data
|
||||
@AutoMapper(target = ShortDramaProject.class)
|
||||
public class ShortDramaProjectVo implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private Long id;
|
||||
|
||||
private Long userId;
|
||||
|
||||
private String projectName;
|
||||
|
||||
private String description;
|
||||
|
||||
private String status;
|
||||
|
||||
private String artStyle;
|
||||
|
||||
private Long composedVideoOssId;
|
||||
|
||||
private String composeStatus;
|
||||
|
||||
private Integer composeProgress;
|
||||
|
||||
private String composeTransitionType;
|
||||
|
||||
private BigDecimal composeTransitionDurationSeconds;
|
||||
|
||||
private String composeAspectRatio;
|
||||
|
||||
private BigDecimal composedVideoDurationSeconds;
|
||||
|
||||
private String composeErrorMessage;
|
||||
|
||||
private Date composedAt;
|
||||
|
||||
private Date createTime;
|
||||
|
||||
private Date updateTime;
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
package org.ruoyi.domain.vo.shortdrama;
|
||||
|
||||
import io.github.linpeilie.annotations.AutoMapper;
|
||||
import lombok.Data;
|
||||
import org.ruoyi.domain.entity.shortdrama.ShortDramaScript;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
@Data
|
||||
@AutoMapper(target = ShortDramaScript.class)
|
||||
public class ShortDramaScriptVo implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private Long id;
|
||||
|
||||
private Long projectId;
|
||||
|
||||
private String scriptName;
|
||||
|
||||
private String scriptText;
|
||||
|
||||
private String outlineText;
|
||||
|
||||
private String tone;
|
||||
|
||||
private String sourceType;
|
||||
|
||||
private Date createTime;
|
||||
|
||||
private Date updateTime;
|
||||
}
|
||||
@@ -0,0 +1,63 @@
|
||||
package org.ruoyi.domain.vo.shortdrama;
|
||||
|
||||
import io.github.linpeilie.annotations.AutoMapper;
|
||||
import lombok.Data;
|
||||
import org.ruoyi.domain.entity.shortdrama.ShortDramaStoryboard;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
@Data
|
||||
@AutoMapper(target = ShortDramaStoryboard.class)
|
||||
public class ShortDramaStoryboardVo implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private Long id;
|
||||
|
||||
private Long projectId;
|
||||
|
||||
private Long scriptId;
|
||||
|
||||
private Integer sceneNo;
|
||||
|
||||
private String sceneTitle;
|
||||
|
||||
private String sceneText;
|
||||
|
||||
private String sceneType;
|
||||
|
||||
private String shotType;
|
||||
|
||||
private String cameraMove;
|
||||
|
||||
private String charactersJson;
|
||||
|
||||
private String locationName;
|
||||
|
||||
private String photographyRules;
|
||||
|
||||
private String actingNotes;
|
||||
|
||||
private String continuityJson;
|
||||
|
||||
private String sourceText;
|
||||
|
||||
private String imagePrompt;
|
||||
|
||||
private Integer durationSeconds;
|
||||
|
||||
private String videoPrompt;
|
||||
|
||||
private String videoUrl;
|
||||
|
||||
private String videoId;
|
||||
|
||||
private String videoStatus;
|
||||
|
||||
private Date createTime;
|
||||
|
||||
private Date updateTime;
|
||||
}
|
||||
@@ -18,6 +18,8 @@ public enum ChatModeType {
|
||||
ATLAS("atlas", "Atlas Cloud"),
|
||||
CUSTOM_API("custom_api", "自定义API"),
|
||||
MINIMAX("minimax", "MiniMax"),
|
||||
DIFY("dify", "Dify"),
|
||||
COZE("coze", "Coze"),
|
||||
XIAOMI("xiaomi", "小米MiMo");
|
||||
private final String code;
|
||||
private final String description;
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
package org.ruoyi.mapper.agent;
|
||||
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.ruoyi.common.mybatis.core.mapper.BaseMapperPlus;
|
||||
import org.ruoyi.domain.entity.agent.Agent;
|
||||
import org.ruoyi.domain.vo.agent.AgentVo;
|
||||
/**
|
||||
* 智能体信息 Mapper
|
||||
*
|
||||
* @author ruoyi team
|
||||
*/
|
||||
@Mapper
|
||||
public interface AgentMapper extends BaseMapperPlus<Agent, AgentVo> {
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
package org.ruoyi.mapper.shortdrama;
|
||||
|
||||
import org.ruoyi.common.mybatis.core.mapper.BaseMapperPlus;
|
||||
import org.ruoyi.domain.entity.shortdrama.ShortDramaCharacterAppearance;
|
||||
import org.ruoyi.domain.vo.shortdrama.ShortDramaCharacterAppearanceVo;
|
||||
|
||||
public interface ShortDramaCharacterAppearanceMapper extends BaseMapperPlus<ShortDramaCharacterAppearance, ShortDramaCharacterAppearanceVo> {
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
package org.ruoyi.mapper.shortdrama;
|
||||
|
||||
import org.ruoyi.common.mybatis.core.mapper.BaseMapperPlus;
|
||||
import org.ruoyi.domain.entity.shortdrama.ShortDramaCharacter;
|
||||
import org.ruoyi.domain.vo.shortdrama.ShortDramaCharacterVo;
|
||||
|
||||
public interface ShortDramaCharacterMapper extends BaseMapperPlus<ShortDramaCharacter, ShortDramaCharacterVo> {
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
package org.ruoyi.mapper.shortdrama;
|
||||
|
||||
import org.ruoyi.common.mybatis.core.mapper.BaseMapperPlus;
|
||||
import org.ruoyi.domain.entity.shortdrama.ShortDramaLocation;
|
||||
import org.ruoyi.domain.vo.shortdrama.ShortDramaLocationVo;
|
||||
|
||||
public interface ShortDramaLocationMapper extends BaseMapperPlus<ShortDramaLocation, ShortDramaLocationVo> {
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
package org.ruoyi.mapper.shortdrama;
|
||||
|
||||
import org.ruoyi.common.mybatis.core.mapper.BaseMapperPlus;
|
||||
import org.ruoyi.domain.entity.shortdrama.ShortDramaProject;
|
||||
import org.ruoyi.domain.vo.shortdrama.ShortDramaProjectVo;
|
||||
|
||||
public interface ShortDramaProjectMapper extends BaseMapperPlus<ShortDramaProject, ShortDramaProjectVo> {
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
package org.ruoyi.mapper.shortdrama;
|
||||
|
||||
import org.ruoyi.common.mybatis.core.mapper.BaseMapperPlus;
|
||||
import org.ruoyi.domain.entity.shortdrama.ShortDramaScript;
|
||||
import org.ruoyi.domain.vo.shortdrama.ShortDramaScriptVo;
|
||||
|
||||
public interface ShortDramaScriptMapper extends BaseMapperPlus<ShortDramaScript, ShortDramaScriptVo> {
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
package org.ruoyi.mapper.shortdrama;
|
||||
|
||||
import org.ruoyi.common.mybatis.core.mapper.BaseMapperPlus;
|
||||
import org.ruoyi.domain.entity.shortdrama.ShortDramaStoryboard;
|
||||
import org.ruoyi.domain.vo.shortdrama.ShortDramaStoryboardVo;
|
||||
|
||||
public interface ShortDramaStoryboardMapper extends BaseMapperPlus<ShortDramaStoryboard, ShortDramaStoryboardVo> {
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
package org.ruoyi.service.agent;
|
||||
|
||||
import org.ruoyi.common.mybatis.core.page.PageQuery;
|
||||
import org.ruoyi.common.mybatis.core.page.TableDataInfo;
|
||||
import org.ruoyi.domain.bo.agent.AgentBo;
|
||||
import org.ruoyi.domain.vo.agent.AgentVo;
|
||||
import org.ruoyi.domain.vo.agent.SkillOptionVo;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 智能体服务接口
|
||||
*
|
||||
* @author ruoyi team
|
||||
*/
|
||||
public interface IAgentService {
|
||||
|
||||
/**
|
||||
* 分页查询智能体列表
|
||||
*/
|
||||
TableDataInfo<AgentVo> queryPageList(AgentBo bo, PageQuery pageQuery);
|
||||
|
||||
/**
|
||||
* 查询符合条件的智能体列表(用于导出)
|
||||
*/
|
||||
List<AgentVo> queryList(AgentBo bo);
|
||||
|
||||
/**
|
||||
* 根据ID查询智能体(展开 JSON 数组字段为 List,关联填充模型/工具/知识库名称)
|
||||
*/
|
||||
AgentVo queryById(Long id);
|
||||
|
||||
/**
|
||||
* 新增智能体
|
||||
*/
|
||||
Boolean insertByBo(AgentBo bo);
|
||||
|
||||
/**
|
||||
* 修改智能体
|
||||
*/
|
||||
Boolean updateByBo(AgentBo bo);
|
||||
|
||||
/**
|
||||
* 批量删除智能体
|
||||
*/
|
||||
Boolean deleteByIds(Collection<Long> ids);
|
||||
|
||||
/**
|
||||
* 查询启用的智能体下拉选项(用户端聊天页选择用,status=0)
|
||||
*/
|
||||
List<AgentVo> queryEnabledOptions();
|
||||
|
||||
/**
|
||||
* 列出磁盘上可用的 Skills(供管理端表单勾选用)
|
||||
*/
|
||||
List<SkillOptionVo> listSkillOptions();
|
||||
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user