feat: add historical events seed script (2017-2023)
This commit is contained in:
@@ -0,0 +1,121 @@
|
|||||||
|
import { PrismaClient } from '@prisma/client';
|
||||||
|
|
||||||
|
const prisma = new PrismaClient();
|
||||||
|
|
||||||
|
const historicalEvents = [
|
||||||
|
{
|
||||||
|
title: 'Attention Is All You Need',
|
||||||
|
titleEn: 'Attention Is All You Need',
|
||||||
|
eventDate: new Date('2017-06-12T00:00:00Z'),
|
||||||
|
description: 'Google 团队发表 Transformer 论文,提出自注意力机制,彻底改变 NLP 领域',
|
||||||
|
descriptionEn: 'Google team publishes Transformer paper, proposing self-attention mechanism that revolutionizes NLP',
|
||||||
|
imageUrl: 'https://images.unsplash.com/photo-1677442136019-21780ecad995?w=800',
|
||||||
|
sourceUrl: 'https://arxiv.org/abs/1706.03762',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: 'GPT-1 发布',
|
||||||
|
titleEn: 'GPT-1 Release',
|
||||||
|
eventDate: new Date('2018-06-11T00:00:00Z'),
|
||||||
|
description: 'OpenAI 发布第一代生成式预训练 Transformer 模型,展示无监督学习的潜力',
|
||||||
|
descriptionEn: 'OpenAI releases first Generative Pre-trained Transformer model, demonstrating potential of unsupervised learning',
|
||||||
|
imageUrl: 'https://images.unsplash.com/photo-1677442136019-21780ecad995?w=800',
|
||||||
|
sourceUrl: 'https://s3-us-west-2.amazonaws.com/openai-assets/research-covers/language-unsupervised/language-understanding-paper.pdf',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: 'BERT 发布',
|
||||||
|
titleEn: 'BERT Release',
|
||||||
|
eventDate: new Date('2018-10-11T00:00:00Z'),
|
||||||
|
description: 'Google 发布双向编码器表示 Transformer,在 11 项 NLP 任务中创 SOTA',
|
||||||
|
descriptionEn: 'Google releases Bidirectional Encoder Representations from Transformers, achieving SOTA on 11 NLP tasks',
|
||||||
|
imageUrl: 'https://images.unsplash.com/photo-1677442136019-21780ecad995?w=800',
|
||||||
|
sourceUrl: 'https://arxiv.org/abs/1810.04805',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: 'GPT-2 发布',
|
||||||
|
titleEn: 'GPT-2 Release',
|
||||||
|
eventDate: new Date('2019-02-14T00:00:00Z'),
|
||||||
|
description: 'OpenAI 发布 15 亿参数的 GPT-2,因"太危险"而不敢全部发布',
|
||||||
|
descriptionEn: 'OpenAI releases 1.5B parameter GPT-2, initially withholding full release due to concerns about misuse',
|
||||||
|
imageUrl: 'https://images.unsplash.com/photo-1677442136019-21780ecad995?w=800',
|
||||||
|
sourceUrl: 'https://openai.com/research/better-language-models',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: 'GPT-3 发布',
|
||||||
|
titleEn: 'GPT-3 Release',
|
||||||
|
eventDate: new Date('2020-05-28T00:00:00Z'),
|
||||||
|
description: 'OpenAI 发布 1750 亿参数的 GPT-3,展示 few-shot 学习的强大能力',
|
||||||
|
descriptionEn: 'OpenAI releases 175B parameter GPT-3, demonstrating powerful few-shot learning capabilities',
|
||||||
|
imageUrl: 'https://images.unsplash.com/photo-1677442136019-21780ecad995?w=800',
|
||||||
|
sourceUrl: 'https://arxiv.org/abs/2005.14165',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: 'GitHub Copilot 发布',
|
||||||
|
titleEn: 'GitHub Copilot Release',
|
||||||
|
eventDate: new Date('2021-06-29T00:00:00Z'),
|
||||||
|
description: 'GitHub 和 OpenAI 发布 AI 编程助手,基于 Codex 模型',
|
||||||
|
descriptionEn: 'GitHub and OpenAI launch AI programming assistant powered by Codex model',
|
||||||
|
imageUrl: 'https://images.unsplash.com/photo-1677442136019-21780ecad995?w=800',
|
||||||
|
sourceUrl: 'https://github.blog/news-insights/company-news/github-copilot/',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: 'ChatGPT 发布',
|
||||||
|
titleEn: 'ChatGPT Release',
|
||||||
|
eventDate: new Date('2022-11-30T00:00:00Z'),
|
||||||
|
description: 'OpenAI 发布对话式 AI 助手 ChatGPT,5 天用户突破 100 万',
|
||||||
|
descriptionEn: 'OpenAI launches conversational AI assistant ChatGPT, reaching 1 million users in 5 days',
|
||||||
|
imageUrl: 'https://images.unsplash.com/photo-1677442136019-21780ecad995?w=800',
|
||||||
|
sourceUrl: 'https://openai.com/blog/chatgpt',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: 'GPT-4 发布',
|
||||||
|
titleEn: 'GPT-4 Release',
|
||||||
|
eventDate: new Date('2023-03-14T00:00:00Z'),
|
||||||
|
description: 'OpenAI 发布多模态大语言模型 GPT-4,在各项基准测试中接近人类水平',
|
||||||
|
descriptionEn: 'OpenAI releases multimodal LLM GPT-4, approaching human-level performance on various benchmarks',
|
||||||
|
imageUrl: 'https://images.unsplash.com/photo-1677442136019-21780ecad995?w=800',
|
||||||
|
sourceUrl: 'https://openai.com/research/gpt-4',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: 'Claude 发布',
|
||||||
|
titleEn: 'Claude Release',
|
||||||
|
eventDate: new Date('2023-03-16T00:00:00Z'),
|
||||||
|
description: 'Anthropic 发布 AI 助手 Claude,强调安全性和有用性',
|
||||||
|
descriptionEn: 'Anthropic launches AI assistant Claude, emphasizing safety and helpfulness',
|
||||||
|
imageUrl: 'https://images.unsplash.com/photo-1677442136019-21780ecad995?w=800',
|
||||||
|
sourceUrl: 'https://www.anthropic.com/index/claude-now-open',
|
||||||
|
},
|
||||||
|
];
|
||||||
|
|
||||||
|
async function main() {
|
||||||
|
console.log('开始插入历史事件...');
|
||||||
|
|
||||||
|
let successCount = 0;
|
||||||
|
let skipCount = 0;
|
||||||
|
|
||||||
|
for (const event of historicalEvents) {
|
||||||
|
try {
|
||||||
|
await prisma.aIEvent.create({
|
||||||
|
data: event,
|
||||||
|
});
|
||||||
|
console.log(`✓ ${event.title} (${event.eventDate.getFullYear()})`);
|
||||||
|
successCount++;
|
||||||
|
} catch (error) {
|
||||||
|
const errorMessage = error instanceof Error ? error.message : String(error);
|
||||||
|
if (errorMessage.includes('Unique constraint')) {
|
||||||
|
console.log(`⊘ ${event.title} 已存在,跳过`);
|
||||||
|
skipCount++;
|
||||||
|
} else {
|
||||||
|
console.log(`✗ ${event.title} 插入失败: ${errorMessage}`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
console.log('\n历史事件插入完成!');
|
||||||
|
console.log(`成功: ${successCount} 条`);
|
||||||
|
console.log(`跳过: ${skipCount} 条`);
|
||||||
|
console.log(`总计: ${historicalEvents.length} 条`);
|
||||||
|
}
|
||||||
|
|
||||||
|
main()
|
||||||
|
.catch(console.error)
|
||||||
|
.finally(() => prisma.$disconnect());
|
||||||
Reference in New Issue
Block a user