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:
@@ -339,9 +339,8 @@ async function main() {
|
||||
}
|
||||
console.log(` ✓ ${banners.length} banners`);
|
||||
|
||||
// ===== 6. More Tools (6 more) =====
|
||||
console.log('Seeding additional tools...');
|
||||
await prisma.tool.deleteMany();
|
||||
// ===== 6. Tools (6 flagship, upsert by name) =====
|
||||
console.log('Seeding tools...');
|
||||
const tools = [
|
||||
{ name: 'DeepSeek', description: '深度求索开发的 AI 大模型,中文能力突出,API 价格极低。支持开源模型私有化部署,适合数据敏感场景。', url: 'https://chat.deepseek.com', categoryId: defaultCatIds['ai-tools'], tags: '对话,开源,中文,低成本', isFeatured: true, status: 'PUBLISHED' as const },
|
||||
{ name: 'Midjourney', description: '领先的 AI 图像生成工具,以高质量艺术风格著称。支持文本生成图像、图像变体、风格迁移等。', url: 'https://midjourney.com', categoryId: defaultCatIds['ai-tools'], tags: '图像,创意,设计', isFeatured: true, status: 'PUBLISHED' as const },
|
||||
@@ -351,7 +350,12 @@ async function main() {
|
||||
{ name: 'Runway Gen-4', description: '领先的 AI 视频生成工具,支持文本生成视频、图像生成视频、视频编辑等。好莱坞级视频制作能力。', url: 'https://runwayml.com', categoryId: defaultCatIds['ai-tools'], tags: '视频,创意,生成', status: 'PUBLISHED' as const },
|
||||
];
|
||||
for (const t of tools) {
|
||||
await prisma.tool.create({ data: t });
|
||||
const existing = await prisma.tool.findFirst({ where: { name: t.name } });
|
||||
if (existing) {
|
||||
await prisma.tool.update({ where: { id: existing.id }, data: t });
|
||||
} else {
|
||||
await prisma.tool.create({ data: t });
|
||||
}
|
||||
}
|
||||
console.log(` ✓ ${tools.length} tools`);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user