You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
44 lines
1.2 KiB
44 lines
1.2 KiB
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
|
|
|