9a0b3ba92c
- Страница /settings: ввод и проверка API ключа DeepSeek - POST /api/llm/generate — генерация вопросов по названию теста - POST /api/llm/improve — улучшение формулировки вопроса + ответов (модал с галочками) - POST /api/llm/distractors — генерация дистракторов - POST /api/llm/review — рецензия теста + кнопка «Предложить вариант» - POST /api/llm/improve_all — улучшение всего теста с постатейным сравнением - Миграция 004: таблица settings (key-value) - Шапка приложения с навигацией на /settings Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
45 lines
1.2 KiB
TypeScript
45 lines
1.2 KiB
TypeScript
import axios from 'axios'
|
|
|
|
export interface LLMQuestion {
|
|
text: string
|
|
answers: { text: string; is_correct: boolean }[]
|
|
}
|
|
|
|
const llmApi = {
|
|
check: () =>
|
|
axios.post<{ ok: boolean; message: string }>('/api/llm/check').then((r) => r.data),
|
|
|
|
generate: (topic: string, count = 7) =>
|
|
axios
|
|
.post<{ questions: LLMQuestion[] }>('/api/llm/generate', { topic, count })
|
|
.then((r) => r.data),
|
|
|
|
improve: (question: string, answers: string[]) =>
|
|
axios
|
|
.post<{ improved_question: string; improved_answers: string[] }>('/api/llm/improve', {
|
|
question,
|
|
answers,
|
|
})
|
|
.then((r) => r.data),
|
|
|
|
distractors: (question: string, answers: string[]) =>
|
|
axios
|
|
.post<{ distractors: string[] }>('/api/llm/distractors', { question, answers })
|
|
.then((r) => r.data),
|
|
|
|
review: (title: string, questions: object[]) =>
|
|
axios
|
|
.post<{ review: string }>('/api/llm/review', { title, questions })
|
|
.then((r) => r.data),
|
|
|
|
improveAll: (title: string, questions: object[]) =>
|
|
axios
|
|
.post<{ questions: { question: string; answers: string[] }[] }>('/api/llm/improve_all', {
|
|
title,
|
|
questions,
|
|
})
|
|
.then((r) => r.data),
|
|
}
|
|
|
|
export default llmApi
|