feat: 数据层更新 — 新增国内工具种子脚本 + schema 优化

- schema.prisma: Prompt.content 改为 @db.Text 支持长文本
- seed-enrich.ts: deleteMany()→upsert by name 防止重跑时清除数据
- seed-expand.ts: 扩展 prompts 至 35 条 + 课程章节扩充
- seed-tools-affiliate.ts: 新增 8 个国内 AI 工具(豆包/通义千问/文心一言/
  WPS AI/Canva/腾讯元宝/讯飞星火/剪映),5 个带返佣链接

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
This commit is contained in:
TradeMate Dev
2026-06-23 21:23:53 +08:00
parent 15ff424f11
commit 5ddd7e3a82
4 changed files with 251 additions and 5 deletions
+111
View File
@@ -0,0 +1,111 @@
import { PrismaClient } from '@prisma/client';
const prisma = new PrismaClient();
async function main() {
console.log('Seeding domestic AI tools with affiliate links...\n');
const toolsCat = await prisma.category.findUnique({ where: { slug: 'ai-tools' } });
if (!toolsCat) {
console.error('Category "ai-tools" not found — run seed-enrich first.');
process.exit(1);
}
const categoryId = toolsCat.id;
const tools = [
{
name: '豆包',
description: '字节跳动推出的 AI 对话助手,国内用户量最大的 AI 应用之一。支持文本生成、图像理解、语音对话等多种交互方式,深度整合抖音生态。',
url: 'https://www.doubao.com',
tags: '对话,中文,字节,免费',
affiliateLink: null, // 豆包暂无公开联盟计划,用普通链接
isFeatured: true,
},
{
name: '通义千问',
description: '阿里云推出的 AI 大模型,中文理解和生成能力领先。深度整合阿里云生态(钉钉、淘宝、阿里云控制台),提供企业级 API 服务。',
url: 'https://tongyi.aliyun.com',
tags: '中文,阿里云,企业级,API',
affiliateLink: 'https://www.aliyun.com/minisite/goods?userCode=yuzhiran', // 阿里云云大使
isFeatured: true,
},
{
name: '文心一言',
description: '百度最新版文心大模型,深度整合百度搜索和知识图谱。在中文知识问答和内容生成方面有独特优势,支持插件生态。',
url: 'https://yiyan.baidu.com',
tags: '中文,百度,搜索,知识',
affiliateLink: 'https://cloud.baidu.com/?from=yuzhiran', // 百度智能云推广大使
isFeatured: true,
},
{
name: 'WPS AI',
description: '金山办公推出的 AI 办公助手,深度集成在 WPS Office 中。支持 AI 写文档、做 PPT、分析表格、生成会议纪要等办公场景。',
url: 'https://ai.wps.cn',
tags: '办公,文档,PPT,效率',
affiliateLink: null, // WPS 会员推广计划
isFeatured: true,
},
{
name: 'Canva',
description: '全球领先的在线设计平台,AI 驱动的设计工具。支持 AI 生成图片、设计模板、品牌套件等,适合非设计师快速创建专业视觉内容。',
url: 'https://www.canva.cn',
tags: '设计,模板,AI 生成,可视化',
affiliateLink: 'https://www.canva.cn/join/yuzhiran', // Canvassador 计划
isFeatured: true,
},
{
name: '腾讯元宝',
description: '腾讯推出的 AI 助手应用,整合腾讯生态(微信、QQ、腾讯文档)。支持多轮对话、内容创作、代码辅助等功能。',
url: 'https://yuanbao.tencent.com',
tags: '对话,腾讯,生态,免费',
affiliateLink: 'https://cloud.tencent.com/act/cps?from=yuzhiran', // 腾讯云推广大使
isFeatured: true,
},
{
name: '讯飞星火',
description: '科大讯飞推出的 AI 认知大模型,在语音识别和自然语言处理方面有深厚积累。支持多模态交互,适合教育、办公场景。',
url: 'https://xinghuo.xfyun.cn',
tags: '语音,教育,办公,讯飞',
affiliateLink: 'https://www.xfyun.cn/?from=yuzhiran',
isFeatured: true,
},
{
name: '剪映专业版',
description: '字节跳动推出的视频剪辑工具,集成 AI 视频生成、智能抠图、自动字幕等 AI 功能。国内最流行的视频创作平台。',
url: 'https://www.capcut.cn',
tags: '视频,剪辑,AI,创作',
affiliateLink: null,
isFeatured: false,
},
];
for (const t of tools) {
const existing = await prisma.tool.findFirst({ where: { name: t.name } });
if (existing) {
await prisma.tool.update({
where: { id: existing.id },
data: {
...t,
categoryId,
status: 'PUBLISHED',
},
});
console.log(` ✓ Updated: ${t.name}`);
} else {
await prisma.tool.create({
data: {
...t,
categoryId,
status: 'PUBLISHED',
},
});
console.log(` + Created: ${t.name}`);
}
}
console.log(`\n✓ ${tools.length} domestic AI tools seeded successfully!`);
}
main()
.catch((e) => { console.error(e); process.exit(1); })
.finally(async () => { await prisma.$disconnect(); });