Skip to content

Let's use AI to Earn!

refactor: 移除 aicso、修复 backend 构建流水线,重构 workflow 消除 skip 链问题

Sakuraea6a13214e62
diff --git a/.github/workflows/backend-build.yml b/.github/workflows/backend-build.yml
index 50811557..c84935d3 100644
--- a/.github/workflows/backend-build.yml
+++ b/.github/workflows/backend-build.yml
@@ -51,41 +51,8 @@ env:
MONOREPO_DIR: project/aitoearn-backend
jobs:
- parse-manual-apps:
- runs-on: ubuntu-latest
- outputs:
- manual_apps: ${{ steps.parse.outputs.manual_apps }}
- if: github.event_name == 'workflow_dispatch'
- steps:
- - name: Parse manual app selection
- id: parse
- run: |
- APPS=""
-
- if [ "${{ inputs.build_aitoearn_ai }}" = "true" ]; then
- APPS="aitoearn-ai"
- fi
-
- if [ "${{ inputs.build_aitoearn_server }}" = "true" ]; then
- if [ -n "$APPS" ]; then
- APPS="$APPS,aitoearn-server"
- else
- APPS="aitoearn-server"
- fi
- fi
-
- echo "manual_apps=$APPS" >> $GITHUB_OUTPUT
-
- if [ -n "$APPS" ]; then
- echo "✅ Manually selected apps: $APPS"
- else
- echo "⚠️ No apps selected"
- fi
-
generate-matrix:
runs-on: ubuntu-latest
- needs: [parse-manual-apps]
- if: always() && (needs.parse-manual-apps.result == 'success' || needs.parse-manual-apps.result == 'skipped')
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
has_changes: ${{ steps.set-matrix.outputs.has_changes }}
@@ -113,21 +80,44 @@ jobs:
working-directory: ${{ env.MONOREPO_DIR }}
run: pnpm install --frozen-lockfile
- - name: Detect affected apps
- id: detect-changes
- working-directory: ${{ env.MONOREPO_DIR }}
+ - name: Parse manual app selection
+ id: parse-manual
run: |
- # Get manually selected apps (from workflow_dispatch or workflow_call)
MANUAL_APPS=""
- if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
- MANUAL_APPS="${{ needs.parse-manual-apps.outputs.manual_apps }}"
- if [ -z "$MANUAL_APPS" ]; then
- echo "⚠️ Manual trigger but no apps selected, will auto-detect affected apps"
- fi
- elif [ "${{ github.event_name }}" = "workflow_call" ] && [ -n "${{ inputs.manual_apps }}" ]; then
+
+ # If manual_apps passed via workflow_call, use directly
+ if [ -n "${{ inputs.manual_apps }}" ]; then
MANUAL_APPS="${{ inputs.manual_apps }}"
+ echo "✅ Using workflow_call manual apps: $MANUAL_APPS"
+ else
+ # Parse workflow_dispatch boolean inputs
+ if [ "${{ inputs.build_aitoearn_ai }}" = "true" ]; then
+ MANUAL_APPS="aitoearn-ai"
+ fi
+
+ if [ "${{ inputs.build_aitoearn_server }}" = "true" ]; then
+ if [ -n "$MANUAL_APPS" ]; then
+ MANUAL_APPS="$MANUAL_APPS,aitoearn-server"
+ else
+ MANUAL_APPS="aitoearn-server"
+ fi
+ fi
+
+ if [ -n "$MANUAL_APPS" ]; then
+ echo "✅ Manually selected apps: $MANUAL_APPS"
+ else
+ echo "⚠️ No apps manually selected"
+ fi
fi
-
+
+ echo "manual_apps=$MANUAL_APPS" >> $GITHUB_OUTPUT
+
+ - name: Detect affected apps
+ id: detect-changes
+ working-directory: ${{ env.MONOREPO_DIR }}
+ run: |
+ MANUAL_APPS="${{ steps.parse-manual.outputs.manual_apps }}"
+
# Check if manual mode
if [ -n "$MANUAL_APPS" ]; then
echo "🎯 Manual build mode: Using specified app list"
@@ -157,10 +147,30 @@ jobs:
echo "Base: $BASE_REF"
echo "Head: HEAD"
- AFFECTED_APPS=$(pnpm nx show projects --affected --type=app --sep "," --exclude="@yikart/source" --exclude="browser-automation-worker" --base=$BASE_REF --head=HEAD 2>/dev/null || echo "")
+ echo ""
+ echo "📊 Diagnostic:"
+ git log --oneline -3
+ echo ""
+ echo "Changed files:"
+ git diff --name-only $BASE_REF HEAD 2>/dev/null || true
+ echo ""
+
+ NX_OUTPUT=$(pnpm nx show projects --affected --type=app --sep "," --exclude="@yikart/source" --base=$BASE_REF --head=HEAD 2>&1)
+ NX_EXIT_CODE=$?
+
+ echo "Nx exit code: $NX_EXIT_CODE"
+ echo "Nx output: $NX_OUTPUT"
+
+ if [ $NX_EXIT_CODE -ne 0 ]; then
+ echo "⚠️ Nx affected detection failed (exit code: $NX_EXIT_CODE)"
+ echo "Falling back to building ALL apps"
+ AFFECTED_APPS="aitoearn-ai,aitoearn-server"
+ else
+ AFFECTED_APPS="$NX_OUTPUT"
+ fi
if [ -z "$AFFECTED_APPS" ]; then
- echo "⚠️ No affected apps detected"
+ echo "ℹ️ No affected apps detected"
echo "affected_apps=" >> $GITHUB_OUTPUT
else
echo "✅ Affected apps: $AFFECTED_APPS"
diff --git a/DOCKER_DEPLOYMENT_CN.md b/DOCKER_DEPLOYMENT_CN.md
index 1b405833..5473b062 100644
--- a/DOCKER_DEPLOYMENT_CN.md
+++ b/DOCKER_DEPLOYMENT_CN.md
@@ -118,6 +118,12 @@ OPENAI_BASE_URL: https://your-new-api-host/v1
OPENAI_API_KEY: sk-your-new-api-key
```
+配置好环境变量后,还需要确认 `project/aitoearn-backend/apps/aitoearn-ai/config/config.js` 中的模型配置与你的 API 服务匹配(详见下方 [AI 服务与模型配置](#ai-服务与模型配置)),然后重启服务:
+
+```bash
+docker compose up -d
+```
+
### 生产环境安全配置
默认密码均为 `password`,**生产环境务必修改**。
@@ -208,7 +214,7 @@ ASSETS_CONFIG: '{"provider":"s3","region":"ap-southeast-1","bucketName":"your-bu
| 变量 | 所属服务 | 说明 | 获取方式 |
|------|----------|------|----------|
-| `MAIL_USER` / `MAIL_PASS` | aitoearn-server | 邮件服务(AWS SES SMTP) | AWS Console → SES → SMTP |
+| `MAIL_USER` / `MAIL_PASS` | aitoearn-server | SMTP 邮件服务 | 你的 SMTP 服务商 |
| `ALI_SMS_ACCESS_KEY_ID` 等 4 项 | aitoearn-server | 阿里云短信 | https://dysms.console.aliyun.com |
---
@@ -267,24 +273,99 @@ ASSETS_CONFIG: '{"provider":"s3","region":"ap-southeast-1","bucketName":"your-bu
| `RELAY_API_KEY` | aitoearn-server | 你的 API Key |
| `RELAY_CALLBACK_URL` | aitoearn-server | OAuth 回调地址(`http://127.0.0.1:8080/api/plat/relay-callback`) |
-### AI 服务
+### AI 服务与模型配置
-| 变量 | 说明 |
-|------|------|
-| `OPENAI_API_KEY` | OpenAI / 中转服务 API 密钥(两个服务都需要) |
-| `OPENAI_BASE_URL` | API 地址(两个服务都需要) |
-| `ANTHROPIC_API_KEY` | Anthropic Claude |
-| `ANTHROPIC_BASE_URL` | Anthropic API 地址 |
-| `VOLCENGINE_API_KEY` | 火山引擎(豆包) |
-| `VOLCENGINE_ACCESS_KEY_ID` | 火山引擎 Access Key |
-| `VOLCENGINE_SECRET_ACCESS_KEY` | 火山引擎 Secret Key |
-| `VOLCENGINE_VOD_SPACE_NAME` | 火山引擎 VOD 空间 |
-| `GROK_API_KEY` | xAI (Grok) |
-| `AICSO_API_KEY` | AICSO 服务 |
-| `AICSO_BASE_URL` | AICSO 地址 |
-| `GEMINI_KEY_PAIRS` | Google Gemini(JSON 数组) |
-| `GEMINI_LOCATION` | Gemini 区域(默认 `us-central1`) |
-| `AI_PROXY_URL` | AI 代理地址(可选) |
+AI 变量配置在 `aitoearn-ai` 服务中(部分变量 `aitoearn-server` 也需要,下文会标注)。默认的占位密钥允许应用正常启动,但 AI 功能需要填入真实密钥才能使用。
+
+模型定义在 `project/aitoearn-backend/apps/aitoearn-ai/config/config.js` 的 `ai.models` 中,可自行增删改模型。所有模型定价必须设置为 `0`。修改后需重启服务生效:`docker compose restart aitoearn-ai`。
+
+#### OpenAI / 中转服务
+
+> **推荐使用 [new-api](https://github.com/Calcium-Ion/new-api) 或 [one-api](https://github.com/songquanpeng/one-api)**,一个地址统一管理 OpenAI、Claude、Gemini 等所有模型。
+
+| 变量 | 说明 | 默认值 |
+|------|------|--------|
+| `OPENAI_API_KEY` | API 密钥(`aitoearn-ai` + `aitoearn-server` 都需要) | `sk-placeholder` |
+| `OPENAI_BASE_URL` | API 地址(`aitoearn-ai` + `aitoearn-server` 都需要) | `https://api.openai.com/v1` |
+
+**内置模型:**
+
+| 模型 ID | 类型 | 说明 |
+|---------|------|------|
+| `gpt-5` | 对话 | text/image → text |
+| `gpt-image-1.5` | 图片生成/编辑 | 支持尺寸 1024x1024, 1536x1024, 1024x1536, auto |
+
+<details>
+<summary>模型配置示例</summary>
+
+```js
+// 对话模型 → ai.models.chat
+{
+ name: 'gpt-5', // 模型 ID
+ description: 'GPT 5', // 显示名称
+ inputModalities: ['text', 'image'], // 支持的输入类型
+ outputModalities: ['text'], // 输出类型
+ pricing: { // 定价(必须为 0)
+ tiers: [{ input: { text: '0', image: '0' }, output: { text: '0' } }],
+ },
+},
+
+// 图片模型 → ai.models.image.generation
+{
+ name: 'gpt-image-1.5', // 模型 ID
+ description: 'gpt-image-1.5', // 显示名称
+ sizes: ['1024x1024', '1536x1024', '1024x1536', 'auto'], // 支持的尺寸
+ qualities: ['high', 'medium', 'low'], // 质量选项
+ styles: [], // 风格选项
+ pricing: '0', // 单价(必须为 0)
+},
+```
+
+</details>
+
+#### Anthropic Claude
+
+| 变量 | 说明 | 默认值 |
+|------|------|--------|
+| `ANTHROPIC_API_KEY` | Anthropic API 密钥 | `sk-placeholder` |
+| `ANTHROPIC_BASE_URL` | Anthropic API 地址 | `https://api.anthropic.com` |
+
+> Agent(智能体)功能也通过此组变量调用 Claude。
+
+**内置模型:**
+
+| 模型 ID | 类型 | 说明 |
+|---------|------|------|
+| `claude-opus-4-5-20251101` | 对话 | Claude Opus 4.5 |
+| `claude-opus-4-6` | 对话 | Claude Opus 4.6 |
+| `claude-sonnet-4-5-20250929` | 对话 | Claude Sonnet 4.5 |
+
+<details>
+<summary>模型配置示例</summary>
+
+```js
+// 对话模型 → ai.models.chat
+{
+ name: 'claude-sonnet-4-5-20250929', // 模型 ID
+ description: 'Claude Sonnet 4.5', // 显示名称
+ inputModalities: ['text', 'image'], // 支持的输入类型
+ outputModalities: ['text'], // 输出类型
+ pricing: { // 定价(必须为 0)
+ tiers: [{ input: { text: '0', image: '0' }, output: { text: '0' } }],
+ },
+},
+```
+
+</details>
+
+#### Google Gemini
+
+| 变量 | 说明 | 默认值 |
+|------|------|--------|
+| `GEMINI_KEY_PAIRS` | Vertex AI 密钥对(JSON 数组),用于对话和视频 | `'[]'` |
+| `GEMINI_LOCATION` | Vertex AI 区域 | `us-central1` |
+| `GEMINI_API_KEY` | 图片生成 API Key | |
+| `GEMINI_BASE_URL` | 图片生成 API 地址 | |
`GEMINI_KEY_PAIRS` 格式:
@@ -293,50 +374,127 @@ ASSETS_CONFIG: '{"provider":"s3","region":"ap-southeast-1","bucketName":"your-bu
GEMINI_KEY_PAIRS: '[]'
# 使用 Gemini
-GEMINI_KEY_PAIRS: '[{"projectId":"your-project","apiKey":"your-key","bucket":"your-bucket"}]'
+GEMINI_KEY_PAIRS: '[{"projectId":"your-project","apiKey":"your-key","keyFile":"/path/to/sa.json","bucket":"your-bucket"}]'
```
----
+**内置模型:**
-## AI 模型配置参考
+| 模型 ID | 类型 | 说明 |
+|---------|------|------|
+| `gemini-3.1-pro-preview` | 对话 | Gemini 3.1 Pro Preview,text/image/audio/video → text |
+| `gemini-3-flash-preview` | 对话 | Gemini 3 Flash Preview,text/image/audio/video → text |
+| `gemini-3.1-flash-image-preview` | 图片生成 / 草稿生成 | NanoBanana 2,text/image → image |
+| `gemini-3-pro-image-preview` | 图片生成 / 草稿生成 | NanoBanana Pro,text/image → image |
-AI 模型定义在 `project/aitoearn-backend/apps/aitoearn-ai/config/config.js` 中配置。
+<details>
+<summary>模型配置示例</summary>
+
+```js
+// 多模态对话模型 → ai.models.chat
+{
+ name: 'gemini-3.1-pro-preview', // 模型 ID
+ description: 'Gemini 3.1 Pro Preview', // 显示名称
+ inputModalities: ['text', 'image', 'audio', 'video'], // 支持的输入类型
+ outputModalities: ['text'], // 输出类型
+ pricing: { // 分层定价(必须为 0)
+ tiers: [
+ {
+ maxInputTokens: 200000, // 该层最大输入 token 数
+ input: { text: '0', image: '0', video: '0', audio: '0' },
+ output: { text: '0' },
+ },
+ { // 超过 200K token 的定价层
+ input: { text: '0', image: '0', video: '0', audio: '0' },
+ output: { text: '0' },
+ },
+ ],
+ },
+},
+
+// 图片生成模型 → ai.models.chat(outputModalities 含 image)
+{
+ name: 'gemini-3.1-flash-image-preview', // 模型 ID
+ description: 'Nano Banana 2', // 显示名称
+ inputModalities: ['text', 'image'], // 支持的输入类型
+ outputModalities: ['image'], // 输出类型为图片
+ pricing: { // 定价(必须为 0)
+ tiers: [{ input: { text: '0', image: '0' }, output: { text: '0', image: '0' } }],
+ },
+},
+```
-### 对话模型(ai.models.chat)
+</details>
-| 模型 ID | 显示名称 | 输入 | 输出 |
-|---------|----------|------|------|
-| `gemini-3.1-pro-preview` | Gemini 3.1 Pro Preview | text/image/audio/video | text |
-| `gemini-3-flash-preview` | Gemini 3 Flash Preview | text/image/audio/video | text |
-| `gpt-5.1-all` | GPT 5.1 | text/image | text |
-| `gpt-5` | GPT 5 | text/image | text |
-| `gemini-3.1-flash-image-preview` | Nano Banana 2 | text/image | image |
-| `gemini-3-pro-image-preview` | Nano Banana Pro | text/image | image |
-| `claude-opus-4-5-20251101` | Claude Opus 4.5 | text/image | text |
-| `claude-opus-4-6` | Claude Opus 4.6 | text/image | text |
-| `claude-sonnet-4-5-20250929` | Claude Sonnet 4.5 | text/image | text |
-| `gemini-2.5-flash` | Gemini 2.5 Flash | text/image/audio/video | text |
+#### xAI (Grok)
-### 图片模型(ai.models.image)
+| 变量 | 说明 |
+|------|------|
+| `GROK_API_KEY` | xAI Grok API Key |
-| 模型 ID | 支持尺寸 | 质量选项 | 编辑最大输入图片数 |
-|---------|----------|----------|-------------------|
-| `gpt-image-1.5` | 1024x1024, 1536x1024, 1024x1536, auto | high, medium, low | 16(仅编辑模式) |
+**内置模型:**
-### 视频模型(ai.models.video.generation)
+| 模型 ID | 类型 | 说明 |
+|---------|------|------|
+| `grok-imagine-video` | 视频生成 | text/image/video → video,720p,1-15 秒 |
-| 模型 ID | 显示名称 | 生成模式 | 分辨率 | 时长 | 宽高比 |
-|---------|----------|----------|--------|------|--------|
-| `grok-imagine-video` | Grok Video | text/image/video → video | 720p | 1-15 秒 | 1:1, 16:9, 9:16, 4:3, 3:4, 3:2, 2:3 |
-| `grok-video-3-15s` | Grok Video 15s | text/image → video | 720p | 15 秒 | 2:3, 3:2, 1:1 |
-| `veo3.1-components-4k` | Veo 3.1 4K | text/image → video | 4k | 8 秒 | 9:16, 16:9, 1:1 |
-| `veo3.1-components` | Veo 3.1 | text/image → video | 720p | 8 秒 | 9:16, 16:9, 1:1 |
+<details>
+<summary>模型配置示例</summary>
+
+```js
+// 视频模型 → ai.models.video.generation
+{
+ name: 'grok-imagine-video', // 模型 ID
+ description: 'Grok Video', // 显示名称
+ channel: 'grok', // 关联的 AI 服务渠道
+ modes: ['text2video', 'image2video', 'video2video'], // 支持的生成模式
+ resolutions: ['720p'], // 支持的分辨率
+ durations: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15], // 支持的时长(秒)
+ maxInputImages: 1, // 最大输入图片数
+ aspectRatios: ['1:1', '16:9', '9:16', '4:3', '3:4', '3:2', '2:3'], // 支持的宽高比
+ defaults: { duration: 8, aspectRatio: '9:16' }, // 默认参数
+ pricing: [ // 按时长定价(必须为 0)
+ { duration: 5, price: 0 },
+ { duration: 10, price: 0 },
+ { duration: 15, price: 0 },
+ ],
+},
+```
+
+</details>
-### 草稿生成图片模型(ai.draftGeneration.imageModels)
+#### 火山引擎
-| 模型 ID | 显示名称 | 支持宽高比 | 最大输入图片数 |
-|---------|----------|-----------|---------------|
-| `gemini-3.1-flash-image-preview` | NanoBanana 2 | 1:1, 2:3, 3:2, 3:4, 4:3, 4:5, 5:4, 9:16, 16:9 | 14 |
-| `gemini-3-pro-image-preview` | NanoBanana Pro | 同上 | 14 |
+| 变量 | 说明 |
+|------|------|
+| `VOLCENGINE_API_KEY` | 火山引擎 API Key |
+| `VOLCENGINE_ACCESS_KEY_ID` | Access Key ID |
+| `VOLCENGINE_SECRET_ACCESS_KEY` | Secret Access Key |
+| `VOLCENGINE_VOD_SPACE_NAME` | VOD 点播空间名称 |
-定价按分辨率(1K/2K/4K),默认均为 `0`(免费)。
+提供以下功能:
+- **豆包视频生成**:在 `ai.models.video.generation` 中配置,channel 为 `volcengine`
+- **Aideo**:AI 视频编辑系列功能,包括视频风格转换、视频理解、高光智剪、面容翻译、字幕擦除、视频编辑、短剧解说、风格迁移,定价必须全部为 `0`
+
+<details>
+<summary>视频模型配置示例</summary>
+
+```js
+// 视频模型 → ai.models.video.generation
+{
+ name: 'doubao-seedance-1-0-lite-i2v', // 模型 ID
+ description: 'Doubao Seedance Lite', // 显示名称
+ channel: 'volcengine', // 关联的 AI 服务渠道
+ modes: ['text2video', 'image2video'], // 支持的生成模式
+ resolutions: ['720p', '1080p'], // 支持的分辨率
+ durations: [5, 10], // 支持的时长(秒)
+ maxInputImages: 1, // 最大输入图片数
+ aspectRatios: ['1:1', '16:9', '9:16'], // 支持的宽高比
+ defaults: { duration: 5, aspectRatio: '16:9' }, // 默认参数
+ pricing: [ // 按时长定价(必须为 0)
+ { duration: 5, price: 0 },
+ { duration: 10, price: 0 },
+ ],
+},
+```
+
+</details>
diff --git a/DOCKER_DEPLOYMENT_EN.md b/DOCKER_DEPLOYMENT_EN.md
index 0ba1557b..884ea319 100644
--- a/DOCKER_DEPLOYMENT_EN.md
+++ b/DOCKER_DEPLOYMENT_EN.md
@@ -118,6 +118,12 @@ OPENAI_BASE_URL: https://your-new-api-host/v1
OPENAI_API_KEY: sk-your-new-api-key
```
+After configuring environment variables, verify that the model configuration in `project/aitoearn-backend/apps/aitoearn-ai/config/config.js` matches your API service (see [AI Services & Model Configuration](#ai-services--model-configuration) below), then restart:
+
+```bash
+docker compose up -d
+```
+
### Production Security
Default passwords are all `password`. **Change them for production.**
@@ -208,7 +214,7 @@ ASSETS_CONFIG: '{"provider":"s3","region":"ap-southeast-1","bucketName":"your-bu
| Variable | Service | Description | How to get |
|----------|---------|-------------|-----------|
-| `MAIL_USER` / `MAIL_PASS` | aitoearn-server | Email (AWS SES SMTP) | AWS Console → SES → SMTP |
+| `MAIL_USER` / `MAIL_PASS` | aitoearn-server | SMTP email service | Your SMTP provider |
| `ALI_SMS_*` (4 vars) | aitoearn-server | Aliyun SMS | https://dysms.console.aliyun.com |
---
@@ -267,24 +273,99 @@ All variables are in the `environment` section of each service in `docker-compos
| `RELAY_API_KEY` | aitoearn-server | Your API Key |
| `RELAY_CALLBACK_URL` | aitoearn-server | OAuth callback (`http://127.0.0.1:8080/api/plat/relay-callback`) |
-### AI Services
+### AI Services & Model Configuration
-| Variable | Description |
-|----------|-------------|
-| `OPENAI_API_KEY` | OpenAI / relay API key (both services) |
-| `OPENAI_BASE_URL` | API URL (both services) |
-| `ANTHROPIC_API_KEY` | Anthropic Claude |
-| `ANTHROPIC_BASE_URL` | Anthropic API URL |
-| `VOLCENGINE_API_KEY` | Volcengine (Doubao) |
-| `VOLCENGINE_ACCESS_KEY_ID` | Volcengine Access Key |
-| `VOLCENGINE_SECRET_ACCESS_KEY` | Volcengine Secret Key |
-| `VOLCENGINE_VOD_SPACE_NAME` | Volcengine VOD space |
-| `GROK_API_KEY` | xAI (Grok) |
-| `AICSO_API_KEY` | AICSO service |
-| `AICSO_BASE_URL` | AICSO URL |
-| `GEMINI_KEY_PAIRS` | Google Gemini (JSON array) |
-| `GEMINI_LOCATION` | Gemini region (default: `us-central1`) |
-| `AI_PROXY_URL` | AI proxy URL (optional) |
+AI variables are configured in the `aitoearn-ai` service (some are also needed in `aitoearn-server`, noted below). Default placeholder keys allow the app to start, but AI features require real keys.
+
+Models are defined in `project/aitoearn-backend/apps/aitoearn-ai/config/config.js` under `ai.models`. You can add, remove, or modify models. All model pricing must be set to `0`. Restart the service after changes: `docker compose restart aitoearn-ai`.
+
+#### OpenAI / Relay Service
+
+> **Recommended: use [new-api](https://github.com/Calcium-Ion/new-api) or [one-api](https://github.com/songquanpeng/one-api)** to manage all AI models (OpenAI, Claude, Gemini, etc.) through a single endpoint.
+
+| Variable | Description | Default |
+|----------|-------------|---------|
+| `OPENAI_API_KEY` | API key (`aitoearn-ai` + `aitoearn-server`) | `sk-placeholder` |
+| `OPENAI_BASE_URL` | API URL (`aitoearn-ai` + `aitoearn-server`) | `https://api.openai.com/v1` |
+
+**Built-in models:**
+
+| Model ID | Type | Description |
+|----------|------|-------------|
+| `gpt-5` | Chat | text/image → text |
+| `gpt-image-1.5` | Image generation/edit | Sizes: 1024x1024, 1536x1024, 1024x1536, auto |
+
+<details>
+<summary>Model configuration example</summary>
+
+```js
+// Chat model → ai.models.chat
+{
+ name: 'gpt-5', // Model ID
+ description: 'GPT 5', // Display name
+ inputModalities: ['text', 'image'], // Supported input types
+ outputModalities: ['text'], // Output type
+ pricing: { // Pricing (must be 0)
+ tiers: [{ input: { text: '0', image: '0' }, output: { text: '0' } }],
+ },
+},
+
+// Image model → ai.models.image.generation
+{
+ name: 'gpt-image-1.5', // Model ID
+ description: 'gpt-image-1.5', // Display name
+ sizes: ['1024x1024', '1536x1024', '1024x1536', 'auto'], // Supported sizes
+ qualities: ['high', 'medium', 'low'], // Quality options
+ styles: [], // Style options
+ pricing: '0', // Price (must be 0)
+},
+```
+
+</details>
+
+#### Anthropic Claude
+
+| Variable | Description | Default |
+|----------|-------------|---------|
+| `ANTHROPIC_API_KEY` | Anthropic API key | `sk-placeholder` |
+| `ANTHROPIC_BASE_URL` | Anthropic API URL | `https://api.anthropic.com` |
+
+> The Agent feature also uses these variables to call Claude.
+
+**Built-in models:**
+
+| Model ID | Type | Description |
+|----------|------|-------------|
+| `claude-opus-4-5-20251101` | Chat | Claude Opus 4.5 |
+| `claude-opus-4-6` | Chat | Claude Opus 4.6 |
+| `claude-sonnet-4-5-20250929` | Chat | Claude Sonnet 4.5 |
+
+<details>
+<summary>Model configuration example</summary>
+
+```js
+// Chat model → ai.models.chat
+{
+ name: 'claude-sonnet-4-5-20250929', // Model ID
+ description: 'Claude Sonnet 4.5', // Display name
+ inputModalities: ['text', 'image'], // Supported input types
+ outputModalities: ['text'], // Output type
+ pricing: { // Pricing (must be 0)
+ tiers: [{ input: { text: '0', image: '0' }, output: { text: '0' } }],
+ },
+},
+```
+
+</details>
+
+#### Google Gemini
+
+| Variable | Description | Default |
+|----------|-------------|---------|
+| `GEMINI_KEY_PAIRS` | Vertex AI key pairs (JSON array) for chat and video | `'[]'` |
+| `GEMINI_LOCATION` | Vertex AI region | `us-central1` |
+| `GEMINI_API_KEY` | Image generation API key | |
+| `GEMINI_BASE_URL` | Image generation API URL | |
`GEMINI_KEY_PAIRS` format:
@@ -293,50 +374,127 @@ All variables are in the `environment` section of each service in `docker-compos
GEMINI_KEY_PAIRS: '[]'
# Enabled
-GEMINI_KEY_PAIRS: '[{"projectId":"your-project","apiKey":"your-key","bucket":"your-bucket"}]'
+GEMINI_KEY_PAIRS: '[{"projectId":"your-project","apiKey":"your-key","keyFile":"/path/to/sa.json","bucket":"your-bucket"}]'
```
----
+**Built-in models:**
+
+| Model ID | Type | Description |
+|----------|------|-------------|
+| `gemini-3.1-pro-preview` | Chat | Gemini 3.1 Pro Preview, text/image/audio/video → text |
+| `gemini-3-flash-preview` | Chat | Gemini 3 Flash Preview, text/image/audio/video → text |
+| `gemini-3.1-flash-image-preview` | Image / Draft generation | NanoBanana 2, text/image → image |
+| `gemini-3-pro-image-preview` | Image / Draft generation | NanoBanana Pro, text/image → image |
+
+<details>
+<summary>Model configuration example</summary>
+
+```js
+// Multimodal chat model → ai.models.chat
+{
+ name: 'gemini-3.1-pro-preview', // Model ID
+ description: 'Gemini 3.1 Pro Preview', // Display name
+ inputModalities: ['text', 'image', 'audio', 'video'], // Supported input types
+ outputModalities: ['text'], // Output type
+ pricing: { // Tiered pricing (must be 0)
+ tiers: [
+ {
+ maxInputTokens: 200000, // Max input tokens for this tier
+ input: { text: '0', image: '0', video: '0', audio: '0' },
+ output: { text: '0' },
+ },
+ { // Pricing tier for >200K tokens
+ input: { text: '0', image: '0', video: '0', audio: '0' },
+ output: { text: '0' },
+ },
+ ],
+ },
+},
+
+// Image generation model → ai.models.chat (outputModalities includes image)
+{
+ name: 'gemini-3.1-flash-image-preview', // Model ID
+ description: 'Nano Banana 2', // Display name
+ inputModalities: ['text', 'image'], // Supported input types
+ outputModalities: ['image'], // Output type is image
+ pricing: { // Pricing (must be 0)
+ tiers: [{ input: { text: '0', image: '0' }, output: { text: '0', image: '0' } }],
+ },
+},
+```
-## AI Model Reference
+</details>
+
+#### xAI (Grok)
-AI models are defined in `project/aitoearn-backend/apps/aitoearn-ai/config/config.js`.
+| Variable | Description |
+|----------|-------------|
+| `GROK_API_KEY` | xAI Grok API key |
-### Chat Models (ai.models.chat)
+**Built-in models:**
-| Model ID | Display Name | Input | Output |
-|----------|-------------|-------|--------|
-| `gemini-3.1-pro-preview` | Gemini 3.1 Pro Preview | text/image/audio/video | text |
-| `gemini-3-flash-preview` | Gemini 3 Flash Preview | text/image/audio/video | text |
-| `gpt-5.1-all` | GPT 5.1 | text/image | text |
-| `gpt-5` | GPT 5 | text/image | text |
-| `gemini-3.1-flash-image-preview` | Nano Banana 2 | text/image | image |
-| `gemini-3-pro-image-preview` | Nano Banana Pro | text/image | image |
-| `claude-opus-4-5-20251101` | Claude Opus 4.5 | text/image | text |
-| `claude-opus-4-6` | Claude Opus 4.6 | text/image | text |
-| `claude-sonnet-4-5-20250929` | Claude Sonnet 4.5 | text/image | text |
-| `gemini-2.5-flash` | Gemini 2.5 Flash | text/image/audio/video | text |
+| Model ID | Type | Description |
+|----------|------|-------------|
+| `grok-imagine-video` | Video generation | text/image/video → video, 720p, 1-15s |
-### Image Models (ai.models.image)
+<details>
+<summary>Model configuration example</summary>
+
+```js
+// Video model → ai.models.video.generation
+{
+ name: 'grok-imagine-video', // Model ID
+ description: 'Grok Video', // Display name
+ channel: 'grok', // AI service channel
+ modes: ['text2video', 'image2video', 'video2video'], // Supported generation modes
+ resolutions: ['720p'], // Supported resolutions
+ durations: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15], // Supported durations (seconds)
+ maxInputImages: 1, // Max input images
+ aspectRatios: ['1:1', '16:9', '9:16', '4:3', '3:4', '3:2', '2:3'], // Supported aspect ratios
+ defaults: { duration: 8, aspectRatio: '9:16' }, // Default parameters
+ pricing: [ // Per-duration pricing (must be 0)
+ { duration: 5, price: 0 },
+ { duration: 10, price: 0 },
+ { duration: 15, price: 0 },
+ ],
+},
+```
-| Model ID | Supported Sizes | Quality Options | Max Input Images (edit) |
-|----------|----------------|-----------------|------------------------|
-| `gpt-image-1.5` | 1024x1024, 1536x1024, 1024x1536, auto | high, medium, low | 16 (edit mode only) |
+</details>
-### Video Models (ai.models.video.generation)
+#### Volcengine
-| Model ID | Display Name | Modes | Resolution | Duration | Aspect Ratios |
-|----------|-------------|-------|------------|----------|---------------|
-| `grok-imagine-video` | Grok Video | text/image/video → video | 720p | 1-15s | 1:1, 16:9, 9:16, 4:3, 3:4, 3:2, 2:3 |
-| `grok-video-3-15s` | Grok Video 15s | text/image → video | 720p | 15s | 2:3, 3:2, 1:1 |
-| `veo3.1-components-4k` | Veo 3.1 4K | text/image → video | 4k | 8s | 9:16, 16:9, 1:1 |
-| `veo3.1-components` | Veo 3.1 | text/image → video | 720p | 8s | 9:16, 16:9, 1:1 |
+| Variable | Description |
+|----------|-------------|
+| `VOLCENGINE_API_KEY` | Volcengine API key |
+| `VOLCENGINE_ACCESS_KEY_ID` | Access Key ID |
+| `VOLCENGINE_SECRET_ACCESS_KEY` | Secret Access Key |
+| `VOLCENGINE_VOD_SPACE_NAME` | VOD space name |
-### Draft Generation Image Models (ai.draftGeneration.imageModels)
+Features:
+- **Doubao video generation**: Configure in `ai.models.video.generation` with channel `volcengine`
+- **Aideo**: AI video editing features including style transfer, video understanding, highlight editing, facial translation, subtitle erasing, video editing, drama recap, and style migration. All pricing must be `0`
-| Model ID | Display Name | Supported Aspect Ratios | Max Input Images |
-|----------|-------------|------------------------|-----------------|
-| `gemini-3.1-flash-image-preview` | NanoBanana 2 | 1:1, 2:3, 3:2, 3:4, 4:3, 4:5, 5:4, 9:16, 16:9 | 14 |
-| `gemini-3-pro-image-preview` | NanoBanana Pro | Same as above | 14 |
+<details>
+<summary>Video model configuration example</summary>
+
+```js
+// Video model → ai.models.video.generation
+{
+ name: 'doubao-seedance-1-0-lite-i2v', // Model ID
+ description: 'Doubao Seedance Lite', // Display name
+ channel: 'volcengine', // AI service channel
+ modes: ['text2video', 'image2video'], // Supported generation modes
+ resolutions: ['720p', '1080p'], // Supported resolutions
+ durations: [5, 10], // Supported durations (seconds)
+ maxInputImages: 1, // Max input images
+ aspectRatios: ['1:1', '16:9', '9:16'], // Supported aspect ratios
+ defaults: { duration: 5, aspectRatio: '16:9' }, // Default parameters
+ pricing: [ // Per-duration pricing (must be 0)
+ { duration: 5, price: 0 },
+ { duration: 10, price: 0 },
+ ],
+},
+```
-Pricing is per resolution (1K/2K/4K), all default to `0` (free).
+</details>
diff --git a/docker-compose.yml b/docker-compose.yml
index 18c95cc8..4c44f750 100644
--- a/docker-compose.yml
+++ b/docker-compose.yml
@@ -154,11 +154,10 @@ services:
VOLCENGINE_SECRET_ACCESS_KEY: ""
VOLCENGINE_VOD_SPACE_NAME: ""
GROK_API_KEY: ""
- AICSO_API_KEY: ""
- AICSO_BASE_URL: ""
+ GEMINI_API_KEY: ""
+ GEMINI_BASE_URL: ""
GEMINI_KEY_PAIRS: '[]'
GEMINI_LOCATION: us-central1
- AI_PROXY_URL: ""
healthcheck:
test: ["CMD", "node", "-e", "require('http').get('http://localhost:3010/health', (r) => { process.exit(r.statusCode === 200 ? 0 : 1) })"]
interval: 30s
diff --git a/project/aitoearn-backend/apps/aitoearn-ai/config/config.js b/project/aitoearn-backend/apps/aitoearn-ai/config/config.js
index 26bf5850..31fbadb1 100644
--- a/project/aitoearn-backend/apps/aitoearn-ai/config/config.js
+++ b/project/aitoearn-backend/apps/aitoearn-ai/config/config.js
@@ -26,8 +26,8 @@ const {
ANTHROPIC_BASE_URL,
ANTHROPIC_API_KEY,
GROK_API_KEY,
- AICSO_API_KEY,
- AICSO_BASE_URL,
+ GEMINI_API_KEY,
+ GEMINI_BASE_URL,
} = process.env
const {
@@ -37,7 +37,6 @@ const {
const {
GEMINI_KEY_PAIRS,
GEMINI_LOCATION,
- AI_PROXY_URL,
} = process.env
const {
@@ -106,28 +105,22 @@ module.exports = {
urlAuthPrimaryKey: 'd8eea018341d4e9687ead69bea628271',
},
openai: {
- baseUrl: AI_PROXY_URL ? `${AI_PROXY_URL}/${OPENAI_BASE_URL}` : OPENAI_BASE_URL,
+ baseUrl: OPENAI_BASE_URL,
apiKey: OPENAI_API_KEY,
},
grok: {
baseUrl: 'https://api.x.ai',
apiKey: GROK_API_KEY,
- ...(AI_PROXY_URL && { proxyUrl: AI_PROXY_URL }),
},
anthropic: {
- baseUrl: AI_PROXY_URL ? `${AI_PROXY_URL}/${ANTHROPIC_BASE_URL}` : ANTHROPIC_BASE_URL,
+ baseUrl: ANTHROPIC_BASE_URL,
apiKey: ANTHROPIC_API_KEY,
},
gemini: {
keyPairs: parseGeminiKeyPairs(),
location: GEMINI_LOCATION || 'us-central1',
- apiKey: AICSO_API_KEY,
- baseUrl: AICSO_BASE_URL,
- ...(AI_PROXY_URL && { proxyUrl: AI_PROXY_URL }),
- },
- aicso: {
- apiKey: AICSO_API_KEY,
- ...(AICSO_BASE_URL && { baseUrl: AICSO_BASE_URL }),
+ apiKey: GEMINI_API_KEY,
+ baseUrl: GEMINI_BASE_URL,
},
aideo: {
vCreative: {
@@ -190,20 +183,6 @@ module.exports = {
],
},
},
- {
- name: 'gpt-5.1-all',
- description: 'GPT 5.1',
- inputModalities: ['text', 'image'],
- outputModalities: ['text'],
- pricing: {
- tiers: [
- {
- input: { text: '0', image: '0' },
- output: { text: '0' },
- },
- ],
- },
- },
{
name: 'gpt-5',
description: 'GPT 5',
@@ -288,20 +267,6 @@ module.exports = {
],
},
},
- {
- name: 'gemini-2.5-flash',
- description: 'Gemini 2.5 Flash',
- inputModalities: ['text', 'image', 'audio', 'video'],
- outputModalities: ['text'],
- pricing: {
- tiers: [
- {
- input: { text: '0', image: '0', video: '0', audio: '0' },
- output: { text: '0' },
- },
- ],
- },
- },
],
image: {
generation: [
@@ -328,60 +293,6 @@ module.exports = {
},
video: {
generation: [
- {
- name: 'grok-video-3-15s',
- description: 'Grok Video 15s',
- channel: 'aicso-grok',
- modes: ['text2video', 'image2video'],
- resolutions: ['720p'],
- durations: [15],
- maxInputImages: 1,
- aspectRatios: ['2:3', '3:2', '1:1'],
- tags: [{ 'en-US': 'Sale', 'zh-CN': '限时' }],
- defaults: {
- duration: 15,
- aspectRatio: '9:16',
- },
- pricing: [
- { duration: 15, price: 0 },
- ],
- },
- {
- name: 'veo3.1-components-4k',
- description: 'Veo 3.1 4K',
- channel: 'aicso-veo',
- modes: ['text2video', 'image2video'],
- resolutions: ['4k'],
- durations: [8],
- maxInputImages: 3,
- aspectRatios: ['9:16', '16:9', '1:1'],
- tags: [{ 'en-US': 'Sale', 'zh-CN': '限时' }],
- defaults: {
- duration: 8,
- aspectRatio: '9:16',
- },
- pricing: [
- { duration: 8, price: 0 },
- ],
- },
- {
- name: 'veo3.1-components',
- description: 'Veo 3.1',
- channel: 'aicso-veo',
- modes: ['text2video', 'image2video'],
- resolutions: ['720p'],
- durations: [8],
- maxInputImages: 3,
- aspectRatios: ['9:16', '16:9', '1:1'],
- tags: [{ 'en-US': 'Sale', 'zh-CN': '限时' }],
- defaults: {
- duration: 8,
- aspectRatio: '9:16',
- },
- pricing: [
- { duration: 8, price: 0 },
- ],
- },
{
name: 'grok-imagine-video',
description: 'Grok Video',
@@ -452,7 +363,7 @@ module.exports = {
},
},
agent: {
- baseUrl: AI_PROXY_URL ? `${AI_PROXY_URL}/${OPENAI_BASE_URL}/messages` : `${OPENAI_BASE_URL}/messages`,
+ baseUrl: `${OPENAI_BASE_URL}/messages`,
apiKey: OPENAI_API_KEY,
},
}
diff --git a/project/aitoearn-backend/apps/aitoearn-ai/src/config.ts b/project/aitoearn-backend/apps/aitoearn-ai/src/config.ts
index 65067012..bc45fe19 100644
--- a/project/aitoearn-backend/apps/aitoearn-ai/src/config.ts
+++ b/project/aitoearn-backend/apps/aitoearn-ai/src/config.ts
@@ -6,7 +6,6 @@ import { AiLogChannel, mongodbConfigSchema } from '@yikart/mongodb'
import { redisConfigSchema } from '@yikart/redis'
import { redlockConfigSchema } from '@yikart/redlock'
import z from 'zod'
-import { aicsoConfigSchema } from './core/ai/libs/aicso'
import { geminiConfigSchema } from './core/ai/libs/gemini'
import { grokConfigSchema } from './core/ai/libs/grok'
import { openaiConfigSchema } from './core/ai/libs/openai'
@@ -171,7 +170,6 @@ export const aiConfigSchema = z.object({
callbackUrl: z.string().optional(),
}),
grok: grokConfigSchema,
- aicso: aicsoConfigSchema,
aideo: aideoPricingConfigSchema,
gemini: geminiConfigSchema,
anthropic: z.object({
diff --git a/project/aitoearn-backend/apps/aitoearn-ai/src/core/ai/libs/aicso/aicso.config.ts b/project/aitoearn-backend/apps/aitoearn-ai/src/core/ai/libs/aicso/aicso.config.ts
deleted file mode 100644
index 8bc87d46..00000000
--- a/project/aitoearn-backend/apps/aitoearn-ai/src/core/ai/libs/aicso/aicso.config.ts
+++ /dev/null
@@ -1,9 +0,0 @@
-import { createZodDto } from '@yikart/common'
-import { z } from 'zod'
-
-export const aicsoConfigSchema = z.object({
- apiKey: z.string().describe('Aicso API Key'),
- baseUrl: z.string().default('https://api.aicso.top').describe('Aicso API Base URL'),
-})
-
-export class AicsoConfig extends createZodDto(aicsoConfigSchema) {}
diff --git a/project/aitoearn-backend/apps/aitoearn-ai/src/core/ai/libs/aicso/aicso.interface.ts b/project/aitoearn-backend/apps/aitoearn-ai/src/core/ai/libs/aicso/aicso.interface.ts
deleted file mode 100644
index 9f61b2e6..00000000
--- a/project/aitoearn-backend/apps/aitoearn-ai/src/core/ai/libs/aicso/aicso.interface.ts
+++ /dev/null
@@ -1,37 +0,0 @@
-export enum AicsoTaskStatus {
- Pending = 'pending',
- Processing = 'processing',
- Completed = 'completed',
- Failed = 'failed',
-}
-
-export interface AicsoCreateVideoRequest {
- model: string
- prompt: string
- images?: string[]
- enhance_prompt?: boolean
- enable_upsample?: boolean
- aspect_ratio?: string
- size?: string
-}
-
-export interface AicsoCreateVideoResponse {
- id: string
- status: string
- status_update_time: number
-}
-
-export interface AicsoQueryResponse {
- id: string
- status: AicsoTaskStatus
- video_url: string | null
- enhanced_prompt?: string
- status_update_time: number
- error?: string
- detail?: {
- video_url?: string
- upsample_video_url?: string
- error_message?: string
- video_generation_error?: string
- }
-}
diff --git a/project/aitoearn-backend/apps/aitoearn-ai/src/core/ai/libs/aicso/aicso.module.ts b/project/aitoearn-backend/apps/aitoearn-ai/src/core/ai/libs/aicso/aicso.module.ts
deleted file mode 100644
index af66856d..00000000
--- a/project/aitoearn-backend/apps/aitoearn-ai/src/core/ai/libs/aicso/aicso.module.ts
+++ /dev/null
@@ -1,21 +0,0 @@
-import { DynamicModule, Module } from '@nestjs/common'
-import { AicsoConfig } from './aicso.config'
-import { AicsoLibService } from './aicso.service'
-
-@Module({})
-export class AicsoLibModule {
- static forRoot(config: AicsoConfig): DynamicModule {
- return {
- global: true,
- module: AicsoLibModule,
- providers: [
- {
- provide: AicsoConfig,
- useValue: config,
- },
- AicsoLibService,
- ],
- exports: [AicsoLibService],
- }
- }
-}
diff --git a/project/aitoearn-backend/apps/aitoearn-ai/src/core/ai/libs/aicso/aicso.service.ts b/project/aitoearn-backend/apps/aitoearn-ai/src/core/ai/libs/aicso/aicso.service.ts
deleted file mode 100644
index bb86cb8c..00000000
--- a/project/aitoearn-backend/apps/aitoearn-ai/src/core/ai/libs/aicso/aicso.service.ts
+++ /dev/null
@@ -1,48 +0,0 @@
-import { Injectable, Logger } from '@nestjs/common'
-import axios, { AxiosInstance, AxiosResponse } from 'axios'
-import { AicsoConfig } from './aicso.config'
-import {
- AicsoCreateVideoRequest,
- AicsoCreateVideoResponse,
- AicsoQueryResponse,
-} from './aicso.interface'
-
-@Injectable()
-export class AicsoLibService {
- private readonly logger = new Logger(AicsoLibService.name)
- private readonly httpClient: AxiosInstance
-
- constructor(
- private readonly config: AicsoConfig,
- ) {
- this.httpClient = this._createHttpClient()
- }
-
- private _createHttpClient(): AxiosInstance {
- return axios.create({
- baseURL: this.config.baseUrl,
- timeout: 60000,
- headers: {
- 'Content-Type': 'application/json',
- 'Accept': 'application/json',
- 'Authorization': `Bearer ${this.config.apiKey}`,
- },
- })
- }
-
- async createVideo(request: AicsoCreateVideoRequest): Promise<AicsoCreateVideoResponse> {
- const response: AxiosResponse<AicsoCreateVideoResponse> = await this.httpClient.post(
- '/v1/video/create',
- request,
- )
- return response.data
- }
-
- async getVideoStatus(taskId: string): Promise<AicsoQueryResponse> {
- const response: AxiosResponse<AicsoQueryResponse> = await this.httpClient.get(
- '/v1/video/query',
- { params: { id: taskId } },
- )
- return response.data
- }
-}
diff --git a/project/aitoearn-backend/apps/aitoearn-ai/src/core/ai/libs/aicso/index.ts b/project/aitoearn-backend/apps/aitoearn-ai/src/core/ai/libs/aicso/index.ts
deleted file mode 100644
index dfe11b51..00000000
--- a/project/aitoearn-backend/apps/aitoearn-ai/src/core/ai/libs/aicso/index.ts
+++ /dev/null
@@ -1,4 +0,0 @@
-export * from './aicso.config'
-export * from './aicso.interface'
-export * from './aicso.module'
-export * from './aicso.service'
diff --git a/project/aitoearn-backend/apps/aitoearn-ai/src/core/ai/video/aicso-grok/aicso-grok.module.ts b/project/aitoearn-backend/apps/aitoearn-ai/src/core/ai/video/aicso-grok/aicso-grok.module.ts
deleted file mode 100644
index 5d38bcd8..00000000
--- a/project/aitoearn-backend/apps/aitoearn-ai/src/core/ai/video/aicso-grok/aicso-grok.module.ts
+++ /dev/null
@@ -1,12 +0,0 @@
-import { Module } from '@nestjs/common'
-import { ModelsConfigModule } from '../../models-config'
-import { AicsoGrokVideoService } from './aicso-grok.service'
-
-@Module({
- imports: [
- ModelsConfigModule,
- ],
- providers: [AicsoGrokVideoService],
- exports: [AicsoGrokVideoService],
-})
-export class AicsoGrokVideoModule {}
diff --git a/project/aitoearn-backend/apps/aitoearn-ai/src/core/ai/video/aicso-grok/aicso-grok.service.ts b/project/aitoearn-backend/apps/aitoearn-ai/src/core/ai/video/aicso-grok/aicso-grok.service.ts
deleted file mode 100644
index 4c44de1f..00000000
--- a/project/aitoearn-backend/apps/aitoearn-ai/src/core/ai/video/aicso-grok/aicso-grok.service.ts
+++ /dev/null
@@ -1,217 +0,0 @@
-import { Injectable, Logger } from '@nestjs/common'
-import { AssetsService } from '@yikart/assets'
-import { AppException, CreditsType, FileUtil, ResponseCode, UserType } from '@yikart/common'
-import { CreditsHelperService } from '@yikart/helpers'
-import { AiLogChannel, AiLogRepository, AiLogStatus, AiLogType, AssetType } from '@yikart/mongodb'
-import { TaskStatus } from '../../../../common'
-import { AicsoLibService, AicsoQueryResponse, AicsoTaskStatus } from '../../libs/aicso'
-import { ModelsConfigService } from '../../models-config'
-
-export interface AicsoGrokVideoCreateRequest {
- userId: string
- userType: UserType
- model: string
- prompt: string
- images?: string[]
- aspectRatio?: string
- size?: string
-}
-
-export interface AicsoGrokVideoCallbackDto {
- id: string
- status: AicsoTaskStatus
- videoUrl?: string
- error?: string
-}
-
-@Injectable()
-export class AicsoGrokVideoService {
- private readonly logger = new Logger(AicsoGrokVideoService.name)
-
- constructor(
- private readonly aicsoLibService: AicsoLibService,
- private readonly aiLogRepo: AiLogRepository,
- private readonly assetsService: AssetsService,
- private readonly modelsConfigService: ModelsConfigService,
- private readonly creditsHelper: CreditsHelperService,
- ) {}
-
- calculatePrice(params: { model: string, duration?: number, mode?: string }): number {
- const { model, duration, mode } = params
-
- const modelConfig = this.modelsConfigService.config.video.generation.find(m => m.name === model)
- if (!modelConfig) {
- throw new AppException(ResponseCode.InvalidModel)
- }
-
- const defaults = modelConfig.defaults || {}
- const finalDuration = duration || defaults.duration
-
- const pricingConfig = modelConfig.pricing.find((pricing) => {
- const durationMatch = !pricing.duration || !finalDuration || pricing.duration === finalDuration
- const modeMatch = mode ? pricing.mode === mode : !pricing.mode
- return durationMatch && modeMatch
- })
-
- if (!pricingConfig) {
- throw new AppException(ResponseCode.InvalidModel)
- }
-
- return pricingConfig.price
- }
-
- async createVideo(request: AicsoGrokVideoCreateRequest) {
- const { userId, userType, model, prompt, images, aspectRatio, size } = request
-
- const pricing = this.calculatePrice({ model })
-
- if (userType === UserType.User) {
- const balance = await this.creditsHelper.getBalance(userId)
- if (balance < pricing) {
- throw new AppException(ResponseCode.UserCreditsInsufficient)
- }
- }
-
- const startedAt = new Date()
-
- const result = await this.aicsoLibService.createVideo({
- model,
- prompt,
- images,
- aspect_ratio: aspectRatio,
- size,
- })
-
- if (userType === UserType.User) {
- await this.creditsHelper.deductCredits({
- userId,
- amount: pricing,
- type: CreditsType.AiService,
- description: model,
- })
- }
-
- const aiLog = await this.aiLogRepo.create({
- userId,
- userType,
- taskId: result.id,
- model,
- channel: AiLogChannel.AicsoGrok,
- startedAt,
- type: AiLogType.Video,
- points: pricing,
- request: { model, prompt, images, aspectRatio, size },
- status: AiLogStatus.Generating,
- })
-
- return {
- id: aiLog.id,
- requestId: result.id,
- points: pricing,
- }
- }
-
- async callback(queryResult: AicsoQueryResponse): Promise<AicsoGrokVideoCallbackDto> {
- const aiLog = await this.aiLogRepo.getByTaskId(queryResult.id)
- if (!aiLog || aiLog.channel !== AiLogChannel.AicsoGrok) {
- throw new AppException(ResponseCode.InvalidAiTaskId)
- }
-
- if (aiLog.status !== AiLogStatus.Generating) {
- return aiLog.response as AicsoGrokVideoCallbackDto
- }
-
- this.logger.debug({ queryResult }, 'AicsoGrok callback')
-
- const videoUrl = queryResult.video_url
-
- if (queryResult.status === AicsoTaskStatus.Completed && videoUrl) {
- const uploaded = await this.assetsService.uploadFromUrl(aiLog.userId, {
- url: videoUrl,
- type: AssetType.AiVideo,
- }, aiLog.model)
-
- const elapsedMs = Date.now() - aiLog.startedAt.getTime()
- const callbackData: AicsoGrokVideoCallbackDto = {
- id: queryResult.id,
- status: AicsoTaskStatus.Completed,
- videoUrl: uploaded.asset.path,
- }
-
- await this.aiLogRepo.updateById(aiLog.id, {
- status: AiLogStatus.Success,
- response: callbackData,
- duration: elapsedMs,
- })
-
- return callbackData
- }
-
- if ((queryResult.status === AicsoTaskStatus.Completed && !videoUrl)
- || queryResult.status === AicsoTaskStatus.Failed) {
- const elapsedMs = Date.now() - aiLog.startedAt.getTime()
- const errorMessage = queryResult.error
- || (queryResult.status === AicsoTaskStatus.Completed ? 'Video generation completed but no video URL returned' : 'Video generation failed')
- const callbackData: AicsoGrokVideoCallbackDto = {
- id: queryResult.id,
- status: AicsoTaskStatus.Failed,
- error: errorMessage,
- }
-
- await this.aiLogRepo.updateById(aiLog.id, {
- status: AiLogStatus.Failed,
- response: callbackData,
- duration: elapsedMs,
- errorMessage,
- })
-
- return callbackData
- }
-
- return {
- id: queryResult.id,
- status: queryResult.status === AicsoTaskStatus.Processing
- ? AicsoTaskStatus.Processing
- : AicsoTaskStatus.Pending,
- }
- }
-
- getTaskResult(result: AicsoGrokVideoCallbackDto) {
- const status = {
- [AicsoTaskStatus.Completed]: TaskStatus.Success,
- [AicsoTaskStatus.Failed]: TaskStatus.Failure,
- [AicsoTaskStatus.Pending]: TaskStatus.InProgress,
- [AicsoTaskStatus.Processing]: TaskStatus.InProgress,
- }[result.status]
-
- return {
- status,
- videoUrl: result.videoUrl ? FileUtil.buildUrl(result.videoUrl) : undefined,
- error: result.error ? { message: result.error } : undefined,
- }
- }
-
- extractInput(request: Record<string, unknown>) {
- return {
- prompt: (request['prompt'] as string) || '',
- image: request['images'] as string[] | undefined,
- aspectRatio: request['aspectRatio'] as string | undefined,
- size: request['size'] as string | undefined,
- }
- }
-
- async getTask(userId: string, userType: UserType, logId: string): Promise<AicsoGrokVideoCallbackDto> {
- const aiLog = await this.aiLogRepo.getByIdAndUserId(logId, userId, userType)
-
- if (aiLog == null || !aiLog.taskId || aiLog.type !== AiLogType.Video || aiLog.channel !== AiLogChannel.AicsoGrok) {
- throw new AppException(ResponseCode.InvalidAiTaskId)
- }
-
- if (aiLog.status === AiLogStatus.Generating) {
- const result = await this.aicsoLibService.getVideoStatus(aiLog.taskId)
- return this.callback(result)
- }
-
- return aiLog.response as AicsoGrokVideoCallbackDto
- }
-}
diff --git a/project/aitoearn-backend/apps/aitoearn-ai/src/core/ai/video/aicso-grok/index.ts b/project/aitoearn-backend/apps/aitoearn-ai/src/core/ai/video/aicso-grok/index.ts
deleted file mode 100644
index 3197f9ce..00000000
--- a/project/aitoearn-backend/apps/aitoearn-ai/src/core/ai/video/aicso-grok/index.ts
+++ /dev/null
@@ -1,2 +0,0 @@
-export * from './aicso-grok.module'
-export * from './aicso-grok.service'
diff --git a/project/aitoearn-backend/apps/aitoearn-ai/src/core/ai/video/aicso-veo/aicso-veo.module.ts b/project/aitoearn-backend/apps/aitoearn-ai/src/core/ai/video/aicso-veo/aicso-veo.module.ts
deleted file mode 100644
index a83c0c9b..00000000
--- a/project/aitoearn-backend/apps/aitoearn-ai/src/core/ai/video/aicso-veo/aicso-veo.module.ts
+++ /dev/null
@@ -1,15 +0,0 @@
-import { Module } from '@nestjs/common'
-import { config } from '../../../../config'
-import { AicsoLibModule } from '../../libs/aicso'
-import { ModelsConfigModule } from '../../models-config'
-import { AicsoVeoVideoService } from './aicso-veo.service'
-
-@Module({
- imports: [
- AicsoLibModule.forRoot(config.ai.aicso),
- ModelsConfigModule,
- ],
- providers: [AicsoVeoVideoService],
- exports: [AicsoVeoVideoService],
-})
-export class AicsoVeoVideoModule {}
diff --git a/project/aitoearn-backend/apps/aitoearn-ai/src/core/ai/video/aicso-veo/aicso-veo.service.ts b/project/aitoearn-backend/apps/aitoearn-ai/src/core/ai/video/aicso-veo/aicso-veo.service.ts
deleted file mode 100644
index 646515ec..00000000
--- a/project/aitoearn-backend/apps/aitoearn-ai/src/core/ai/video/aicso-veo/aicso-veo.service.ts
+++ /dev/null
@@ -1,221 +0,0 @@
-import { Injectable, Logger } from '@nestjs/common'
-import { AssetsService } from '@yikart/assets'
-import { AppException, CreditsType, FileUtil, ResponseCode, UserType } from '@yikart/common'
-import { CreditsHelperService } from '@yikart/helpers'
-import { AiLogChannel, AiLogRepository, AiLogStatus, AiLogType, AssetType } from '@yikart/mongodb'
-import { TaskStatus } from '../../../../common'
-import { AicsoLibService, AicsoQueryResponse, AicsoTaskStatus } from '../../libs/aicso'
-import { ModelsConfigService } from '../../models-config'
-
-export interface AicsoVeoVideoCreateRequest {
- userId: string
- userType: UserType
- model: string
- prompt: string
- images?: string[]
- aspectRatio?: string
-}
-
-export interface AicsoVeoVideoCallbackDto {
- id: string
- status: AicsoTaskStatus
- videoUrl?: string
- error?: string
-}
-
-@Injectable()
-export class AicsoVeoVideoService {
- private readonly logger = new Logger(AicsoVeoVideoService.name)
-
- constructor(
- private readonly aicsoLibService: AicsoLibService,
- private readonly aiLogRepo: AiLogRepository,
- private readonly assetsService: AssetsService,
- private readonly modelsConfigService: ModelsConfigService,
- private readonly creditsHelper: CreditsHelperService,
- ) {}
-
- calculatePrice(params: { model: string, duration?: number, mode?: string }): number {
- const { model, duration, mode } = params
-
- const modelConfig = this.modelsConfigService.config.video.generation.find(m => m.name === model)
- if (!modelConfig) {
- throw new AppException(ResponseCode.InvalidModel)
- }
-
- const defaults = modelConfig.defaults || {}
- const finalDuration = duration || defaults.duration
-
- const pricingConfig = modelConfig.pricing.find((pricing) => {
- const durationMatch = !pricing.duration || !finalDuration || pricing.duration === finalDuration
- const modeMatch = mode ? pricing.mode === mode : !pricing.mode
- return durationMatch && modeMatch
- })
-
- if (!pricingConfig) {
- throw new AppException(ResponseCode.InvalidModel)
- }
-
- return pricingConfig.price
- }
-
- async createVideo(request: AicsoVeoVideoCreateRequest) {
- const { userId, userType, model, prompt, images, aspectRatio } = request
-
- const pricing = this.calculatePrice({ model })
-
- if (userType === UserType.User) {
- const balance = await this.creditsHelper.getBalance(userId)
- if (balance < pricing) {
- throw new AppException(ResponseCode.UserCreditsInsufficient)
- }
- }
-
- const startedAt = new Date()
-
- const result = await this.aicsoLibService.createVideo({
- model,
- prompt,
- images,
- enhance_prompt: true,
- enable_upsample: true,
- aspect_ratio: aspectRatio || '16:9',
- })
-
- if (userType === UserType.User) {
- await this.creditsHelper.deductCredits({
- userId,
- amount: pricing,
- type: CreditsType.AiService,
- description: model,
- })
- }
-
- const aiLog = await this.aiLogRepo.create({
- userId,
- userType,
- taskId: result.id,
- model,
- channel: AiLogChannel.AicsoVeo,
- startedAt,
- type: AiLogType.Video,
- points: pricing,
- request: { model, prompt, images, aspectRatio },
- status: AiLogStatus.Generating,
- })
-
- return {
- id: aiLog.id,
- requestId: result.id,
- points: pricing,
- }
- }
-
- /**
- * 回调处理:根据查询结果更新 AiLog,上传视频,失败退款
- */
- async callback(queryResult: AicsoQueryResponse): Promise<AicsoVeoVideoCallbackDto> {
- const aiLog = await this.aiLogRepo.getByTaskId(queryResult.id)
- if (!aiLog || aiLog.channel !== AiLogChannel.AicsoVeo) {
- throw new AppException(ResponseCode.InvalidAiTaskId)
- }
-
- if (aiLog.status !== AiLogStatus.Generating) {
- return aiLog.response as AicsoVeoVideoCallbackDto
- }
-
- this.logger.debug({ queryResult }, 'AicsoVeo callback')
-
- const videoUrl = queryResult.detail?.upsample_video_url || queryResult.detail?.video_url || queryResult.video_url
-
- if (queryResult.status === AicsoTaskStatus.Completed && videoUrl) {
- const uploaded = await this.assetsService.uploadFromUrl(aiLog.userId, {
- url: videoUrl,
- type: AssetType.AiVideo,
- }, aiLog.model)
-
- const elapsedMs = Date.now() - aiLog.startedAt.getTime()
- const callbackData: AicsoVeoVideoCallbackDto = {
- id: queryResult.id,
- status: AicsoTaskStatus.Completed,
- videoUrl: uploaded.asset.path,
- }
-
- await this.aiLogRepo.updateById(aiLog.id, {
- status: AiLogStatus.Success,
- response: callbackData,
- duration: elapsedMs,
- })
-
- return callbackData
- }
-
- if ((queryResult.status === AicsoTaskStatus.Completed && !videoUrl)
- || queryResult.status === AicsoTaskStatus.Failed) {
- const elapsedMs = Date.now() - aiLog.startedAt.getTime()
- const errorMessage = queryResult.detail?.error_message
- || queryResult.detail?.video_generation_error
- || (queryResult.status === AicsoTaskStatus.Completed ? 'Video generation completed but no video URL returned' : 'Video generation failed')
- const callbackData: AicsoVeoVideoCallbackDto = {
- id: queryResult.id,
- status: AicsoTaskStatus.Failed,
- error: errorMessage,
- }
-
- await this.aiLogRepo.updateById(aiLog.id, {
- status: AiLogStatus.Failed,
- response: callbackData,
- duration: elapsedMs,
- errorMessage,
- })
-
- return callbackData
- }
-
- return {
- id: queryResult.id,
- status: AicsoTaskStatus.Pending,
- }
- }
-
- /**
- * 将回调数据转为统一的任务结果格式
- */
- getTaskResult(result: AicsoVeoVideoCallbackDto) {
- const status = {
- [AicsoTaskStatus.Completed]: TaskStatus.Success,
- [AicsoTaskStatus.Failed]: TaskStatus.Failure,
- [AicsoTaskStatus.Pending]: TaskStatus.InProgress,
- [AicsoTaskStatus.Processing]: TaskStatus.InProgress,
- }[result.status]
-
- return {
- status,
- videoUrl: result.videoUrl ? FileUtil.buildUrl(result.videoUrl) : undefined,
- error: result.error ? { message: result.error } : undefined,
- }
- }
-
- extractInput(request: Record<string, unknown>) {
- return {
- prompt: (request['prompt'] as string) || '',
- image: request['images'] as string[] | undefined,
- aspectRatio: request['aspectRatio'] as string | undefined,
- }
- }
-
- async getTask(userId: string, userType: UserType, logId: string): Promise<AicsoVeoVideoCallbackDto> {
- const aiLog = await this.aiLogRepo.getByIdAndUserId(logId, userId, userType)
-
- if (aiLog == null || !aiLog.taskId || aiLog.type !== AiLogType.Video || aiLog.channel !== AiLogChannel.AicsoVeo) {
- throw new AppException(ResponseCode.InvalidAiTaskId)
- }
-
- if (aiLog.status === AiLogStatus.Generating) {
- const result = await this.aicsoLibService.getVideoStatus(aiLog.taskId)
- return this.callback(result)
- }
-
- return aiLog.response as AicsoVeoVideoCallbackDto
- }
-}
diff --git a/project/aitoearn-backend/apps/aitoearn-ai/src/core/ai/video/aicso-veo/index.ts b/project/aitoearn-backend/apps/aitoearn-ai/src/core/ai/video/aicso-veo/index.ts
deleted file mode 100644
index 16ab3e8d..00000000
--- a/project/aitoearn-backend/apps/aitoearn-ai/src/core/ai/video/aicso-veo/index.ts
+++ /dev/null
@@ -1,2 +0,0 @@
-export * from './aicso-veo.module'
-export * from './aicso-veo.service'
diff --git a/project/aitoearn-backend/apps/aitoearn-ai/src/core/ai/video/video-task-status.scheduler.ts b/project/aitoearn-backend/apps/aitoearn-ai/src/core/ai/video/video-task-status.scheduler.ts
index 7c192fff..e7142cc5 100644
--- a/project/aitoearn-backend/apps/aitoearn-ai/src/core/ai/video/video-task-status.scheduler.ts
+++ b/project/aitoearn-backend/apps/aitoearn-ai/src/core/ai/video/video-task-status.scheduler.ts
@@ -4,13 +4,10 @@ import { WithLoggerContext } from '@yikart/common'
import { AiLog, AiLogChannel, AiLogRepository, AiLogType } from '@yikart/mongodb'
import { Redlock } from '@yikart/redlock'
import { RedlockKey } from '../../../common'
-import { AicsoLibService } from '../libs/aicso'
import { GeminiService } from '../libs/gemini'
import { GrokLibService, GrokVideoTaskStatus } from '../libs/grok'
import { OpenaiService } from '../libs/openai'
import { VolcengineService } from '../libs/volcengine'
-import { AicsoGrokVideoService } from './aicso-grok'
-import { AicsoVeoVideoService } from './aicso-veo'
import { GeminiVideoService } from './gemini'
import { GrokVideoService } from './grok'
import { OpenAIVideoCallbackDto, OpenAIVideoService } from './openai'
@@ -30,9 +27,6 @@ export class VideoTaskStatusScheduler {
private readonly geminiVideoService: GeminiVideoService,
private readonly grokLibService: GrokLibService,
private readonly grokVideoService: GrokVideoService,
- private readonly aicsoVeoVideoService: AicsoVeoVideoService,
- private readonly aicsoLibService: AicsoLibService,
- private readonly aicsoGrokVideoService: AicsoGrokVideoService,
) { }
/**
@@ -100,14 +94,6 @@ export class VideoTaskStatusScheduler {
}
}
}
- else if (channel === AiLogChannel.AicsoVeo) {
- const result = await this.aicsoLibService.getVideoStatus(taskId)
- await this.aicsoVeoVideoService.callback(result)
- }
- else if (channel === AiLogChannel.AicsoGrok) {
- const result = await this.aicsoLibService.getVideoStatus(taskId)
- await this.aicsoGrokVideoService.callback(result)
- }
else {
this.logger.warn(`任务 ${task.id} 未知的 channel: ${channel},跳过检查`)
}
diff --git a/project/aitoearn-backend/apps/aitoearn-ai/src/core/ai/video/video.module.ts b/project/aitoearn-backend/apps/aitoearn-ai/src/core/ai/video/video.module.ts
index 0628cd12..9de34712 100644
--- a/project/aitoearn-backend/apps/aitoearn-ai/src/core/ai/video/video.module.ts
+++ b/project/aitoearn-backend/apps/aitoearn-ai/src/core/ai/video/video.module.ts
@@ -1,7 +1,5 @@
import { Module } from '@nestjs/common'
import { ModelsConfigModule } from '../models-config'
-import { AicsoGrokVideoModule } from './aicso-grok'
-import { AicsoVeoVideoModule } from './aicso-veo'
import { GeminiVideoModule } from './gemini'
import { GrokVideoModule } from './grok'
import { OpenAIVideoModule } from './openai'
@@ -17,11 +15,9 @@ import { VolcengineVideoModule } from './volcengine'
OpenAIVideoModule,
GeminiVideoModule,
GrokVideoModule,
- AicsoVeoVideoModule,
- AicsoGrokVideoModule,
],
controllers: [VideoController],
providers: [VideoService, VideoTaskStatusScheduler],
- exports: [VideoService, VolcengineVideoModule, OpenAIVideoModule, GeminiVideoModule, GrokVideoModule, AicsoVeoVideoModule, AicsoGrokVideoModule],
+ exports: [VideoService, VolcengineVideoModule, OpenAIVideoModule, GeminiVideoModule, GrokVideoModule],
})
export class VideoModule {}
diff --git a/project/aitoearn-backend/apps/aitoearn-ai/src/core/ai/video/video.service.ts b/project/aitoearn-backend/apps/aitoearn-ai/src/core/ai/video/video.service.ts
index 8fab6c3e..4f5aba09 100644
--- a/project/aitoearn-backend/apps/aitoearn-ai/src/core/ai/video/video.service.ts
+++ b/project/aitoearn-backend/apps/aitoearn-ai/src/core/ai/video/video.service.ts
@@ -12,8 +12,6 @@ import {
serializeModelTextCommand,
} from '../libs/volcengine'
import { ModelsConfigService } from '../models-config'
-import { AicsoGrokVideoCallbackDto, AicsoGrokVideoService } from './aicso-grok'
-import { AicsoVeoVideoCallbackDto, AicsoVeoVideoService } from './aicso-veo'
import { GeminiVeoVideoCallbackDto, GeminiVideoService } from './gemini'
import { GrokVideoCallbackDto, GrokVideoService } from './grok'
import { OpenAIVideoCallbackDto, OpenAIVideoService } from './openai'
@@ -38,8 +36,6 @@ export class VideoService {
private readonly volcengineVideoService: VolcengineVideoService,
private readonly openaiVideoService: OpenAIVideoService,
private readonly grokVideoService: GrokVideoService,
- private readonly aicsoVeoVideoService: AicsoVeoVideoService,
- private readonly aicsoGrokVideoService: AicsoGrokVideoService,
private readonly geminiVideoService: GeminiVideoService,
) {}
@@ -126,10 +122,6 @@ export class VideoService {
return this.handleOpenAIGeneration(request, createTaskResponse)
case AiLogChannel.Grok:
return this.handleGrokGeneration(request, createTaskResponse)
- case AiLogChannel.AicsoVeo:
- return this.handleAicsoVeoGeneration(request, createTaskResponse)
- case AiLogChannel.AicsoGrok:
- return this.handleAicsoGrokGeneration(request, createTaskResponse)
default:
throw new AppException(ResponseCode.InvalidModel)
}
@@ -246,80 +238,6 @@ export class VideoService {
return createTaskResponse(result.id, result.points)
}
- /**
- * 处理AicsoVeo渠道的视频生成
- */
- private async handleAicsoVeoGeneration<T>(
- request: UserVideoGenerationRequestDto,
- createTaskResponse: (taskId: string, points: number) => T,
- ) {
- const { userId, userType, model, prompt } = request
-
- const images: string[] = []
- if (request.image) {
- if (Array.isArray(request.image)) {
- const presigned = await this.toPresignedUrls(request.image)
- images.push(...presigned)
- }
- else {
- const presigned = await this.toPresignedUrl(request.image)
- if (presigned) {
- images.push(presigned)
- }
- }
- }
- if (request.image_tail) {
- const presigned = await this.toPresignedUrl(request.image_tail)
- if (presigned) {
- images.push(presigned)
- }
- }
-
- const result = await this.aicsoVeoVideoService.createVideo({
- userId,
- userType,
- model,
- prompt,
- images: images.length > 0 ? images : undefined,
- aspectRatio: request.metadata?.['aspectRatio'] as string,
- })
- return createTaskResponse(result.id, result.points)
- }
-
- private async handleAicsoGrokGeneration<T>(
- request: UserVideoGenerationRequestDto,
- createTaskResponse: (taskId: string, points: number) => T,
- ) {
- const { userId, userType, model, prompt } = request
-
- const images: string[] = []
- if (request.image) {
- if (Array.isArray(request.image)) {
- const presigned = await this.toPresignedUrls(request.image)
- images.push(...presigned)
- }
- else {
- const presigned = await this.toPresignedUrl(request.image)
- if (presigned) {
- images.push(presigned)
- }
- }
- }
-
- const size = (request.size || request.metadata?.['size']) as string | undefined
-
- const result = await this.aicsoGrokVideoService.createVideo({
- userId,
- userType,
- model,
- prompt,
- images: images.length > 0 ? images : undefined,
- aspectRatio: request.metadata?.['aspectRatio'] as string,
- size,
- })
- return createTaskResponse(result.id, result.points)
- }
-
private extractInput(aiLog: AiLog): VideoTaskInput {
const request = (aiLog.request || {}) as Record<string, unknown>
@@ -330,10 +248,6 @@ export class VideoService {
return this.openaiVideoService.extractInput(request)
case AiLogChannel.Grok:
return this.grokVideoService.extractInput(request)
- case AiLogChannel.AicsoVeo:
- return this.aicsoVeoVideoService.extractInput(request)
- case AiLogChannel.AicsoGrok:
- return this.aicsoGrokVideoService.extractInput(request)
case AiLogChannel.Gemini:
return this.geminiVideoService.extractInput(request)
default:
@@ -387,10 +301,6 @@ export class VideoService {
return this.openaiVideoService.getTaskResult(aiLog.response as unknown as OpenAIVideoCallbackDto)
case AiLogChannel.Grok:
return this.grokVideoService.getTaskResult(aiLog.response as unknown as GrokVideoCallbackDto)
- case AiLogChannel.AicsoVeo:
- return this.aicsoVeoVideoService.getTaskResult(aiLog.response as unknown as AicsoVeoVideoCallbackDto)
- case AiLogChannel.AicsoGrok:
- return this.aicsoGrokVideoService.getTaskResult(aiLog.response as unknown as AicsoGrokVideoCallbackDto)
case AiLogChannel.Gemini:
return this.geminiVideoService.getTaskResult(aiLog.response as unknown as GeminiVeoVideoCallbackDto)
default:
diff --git a/project/aitoearn-backend/apps/aitoearn-ai/src/core/draft-generation/draft-generation.service.ts b/project/aitoearn-backend/apps/aitoearn-ai/src/core/draft-generation/draft-generation.service.ts
index a0692155..4885d0fe 100644
--- a/project/aitoearn-backend/apps/aitoearn-ai/src/core/draft-generation/draft-generation.service.ts
+++ b/project/aitoearn-backend/apps/aitoearn-ai/src/core/draft-generation/draft-generation.service.ts
@@ -703,7 +703,7 @@ Return the result as JSON.`
const imageModels = config.ai.draftGeneration.imageModels
const videoModels = config.ai.models.video.generation
- .filter(v => v.channel === AiLogChannel.Grok || v.channel === AiLogChannel.AicsoVeo || v.channel === AiLogChannel.AicsoGrok)
+ .filter(v => v.channel === AiLogChannel.Grok)
return { imageModels, videoModels }
}
diff --git a/project/aitoearn-backend/libs/mongodb/src/enums/ai-log.enum.ts b/project/aitoearn-backend/libs/mongodb/src/enums/ai-log.enum.ts
index cef59be8..73c6fda9 100644
--- a/project/aitoearn-backend/libs/mongodb/src/enums/ai-log.enum.ts
+++ b/project/aitoearn-backend/libs/mongodb/src/enums/ai-log.enum.ts
@@ -39,6 +39,4 @@ export enum AiLogChannel {
/** @deprecated Removed feature, kept for DB backward compatibility */
Jimeng = 'jimeng',
Grok = 'grok',
- AicsoVeo = 'aicso-veo',
- AicsoGrok = 'aicso-grok',
}