feat: 添加AI试题生成功能

This commit is contained in:
cc 2026-03-25 18:58:12 +08:00
parent f7f54d3a95
commit 18ca189d56
4 changed files with 1354 additions and 0 deletions

View File

@ -47,6 +47,40 @@ export const PROBLEM_API_URL = "https://ark.cn-beijing.volces.com/api/v3/chat/co
export const PROBLEM_MODEL = "doubao-seed-2-0-lite-260215";
export const PROBLEM_API_KEY = "2d46f767-6476-4858-8041-540fcae99808"; // 使用 DOUBAO_KEY
// ── 试题生成接口(使用 Gemini-3.1-pro──
export const QUESTION_API_URL = "https://grsaiapi.com/v1/chat/completions";
export const QUESTION_MODEL = "gemini-3.1-pro";
export const QUESTION_TEMPERATURE = 0.8;
export const QUESTION_MAX_TOKENS = 4096;
// 试题生成 System Prompt
export const QUESTION_GENERATOR_PROMPT = `你是一位专业的英语试题出题专家。请根据用户指定的参数生成高质量的英语试题。
输出格式要求
## 题目 [序号]
**题目类型**[类型]
**难度等级**[难度]
**题目内容**
[题目文本]
**选项**
A. [选项A内容]
B. [选项B内容]
C. [选项C内容]
D. [选项D内容]
**正确答案**[答案A]
**解析**[详细解析]
**知识点**[相关知识点]
重要规则
1. 所有题型都必须提供4个选项ABCD即使是填空题翻译题或阅读理解题
2. 对于填空题选项为不同的填空答案选项
3. 对于翻译题选项为不同的翻译版本
4. 对于阅读理解题选项为对问题的不同回答选项
5. 题目质量要高符合英语教学标准
6. 答案准确无误
7. 解析清晰易懂有助于学生理解
8. 知识点标注准确便于分类学习`;
// ── 文件上传限制 ──
export const IMAGE_MAX_SIZE_MB = 10;
export const IMAGE_ALLOWED_TYPES_ESSAY = ["image/jpeg", "image/jpg", "image/png"];

View File

@ -6,6 +6,7 @@ import EssayCorrection from '../views/EssayCorrection.vue'
import ExamAnalysis from '../views/ExamAnalysis.vue'
import SpellPractice from '../views/SpellPractice.vue'
import ProblemSolving from '../views/ProblemSolving.vue'
import QuestionGenerator from '../views/QuestionGenerator.vue'
const router = createRouter({
history: createWebHistory(import.meta.env.BASE_URL),
@ -45,6 +46,11 @@ const router = createRouter({
name: 'problem-solving',
component: ProblemSolving
},
{
path: '/question-generator',
name: 'question-generator',
component: QuestionGenerator
},
]
})

View File

@ -61,6 +61,14 @@ const features = ref([
icon: "puzzle",
route: "/problem-solving",
},
{
id: 8,
title: "AI试题生成",
desc: "智能生成英语试题,支持选择题、填空题、翻译题和阅读理解,可自定义难度、数量和知识点,快速创建高质量题库。",
class: "card-8",
icon: "document",
route: "/question-generator",
},
]);
// Hover effect for glassmorphism glare
@ -242,6 +250,22 @@ onUnmounted(() => {
d="M12 6v6h4.5m4.5 0a9 9 0 1 1-18 0 9 9 0 0 1 18 0Z"
/>
</svg>
<!-- Document Icon (File/Document) -->
<svg
v-else-if="feature.icon === 'document'"
xmlns="http://www.w3.org/2000/svg"
fill="none"
viewBox="0 0 24 24"
stroke-width="1.5"
stroke="currentColor"
>
<path
stroke-linecap="round"
stroke-linejoin="round"
d="M19.5 14.25v-2.625a3.375 3.375 0 0 0-3.375-3.375h-1.5A1.125 1.125 0 0 1 13.5 7.125v-1.5a3.375 3.375 0 0 0-3.375-3.375H8.25m0 12.75h7.5m-7.5 3H12M10.5 2.25H5.625c-.621 0-1.125.504-1.125 1.125v17.25c0 .621.504 1.125 1.125 1.125h12.75c.621 0 1.125-.504 1.125-1.125V11.25a9 9 0 0 0-9-9Z"
/>
</svg>
</div>
<h2 class="card-title">{{ feature.title }}</h2>
</div>
@ -419,6 +443,11 @@ h1 {
box-shadow: 0 8px 20px -6px rgba(139, 92, 246, 0.5);
}
.card-8 .icon-wrapper {
background: linear-gradient(135deg, #10b981, #059669);
box-shadow: 0 8px 20px -6px rgba(16, 185, 129, 0.5);
}
.card-title {
font-size: 1.5rem;
font-weight: 600;

File diff suppressed because it is too large Load Diff