Generation Page (complete rebuild): - Full production-parity exam generation wizard with 4 IELTS modules - Reading: AI passage gen, 5 exercise types (MCQ, Fill, Write, T/F, Match) - Listening: 4 section types, AI context gen, TTS audio gen (ElevenLabs) - Writing: Task 1/2, AI instruction gen, word limits, marks - Speaking: 3 parts, AI script gen, avatar video gen (7 avatars) - Per-module config: timer, CEFR difficulty, access, approval, rubrics - Exam submission workflow (draft/published) Exam Structures: - New encoach.exam.structure model + CRUD controller - ExamStructuresPage wired to real API AI Module (encoach_ai): - OpenAI service, ElevenLabs TTS, AWS Polly, ELAI avatars - AI settings model with Odoo config parameters - 7 generation endpoints (passage, exercises, instructions, scripts, context) Vector Module (encoach_vector): - pgvector integration for RAG-based content search - Embedding service with sentence-transformers Exam Session Fixes: - Fixed ExamSession.tsx field mapping (question_type→type, exam_title→title) - Fixed submit payload to include attempt_id and answers - Fixed normalizeType to handle null/undefined Tested: 12/12 API tests passed, browser-verified with real OpenAI calls Made-with: Cursor
80 lines
2.4 KiB
Python
80 lines
2.4 KiB
Python
from odoo import api, fields, models
|
|
|
|
|
|
class EncoachAISettings(models.TransientModel):
|
|
_inherit = "res.config.settings"
|
|
|
|
# ── OpenAI ──
|
|
ai_openai_api_key = fields.Char(
|
|
string="OpenAI API Key",
|
|
config_parameter="encoach_ai.openai_api_key",
|
|
)
|
|
ai_openai_model = fields.Selection(
|
|
[("gpt-4o", "GPT-4o"), ("gpt-4o-mini", "GPT-4o Mini"), ("gpt-3.5-turbo", "GPT-3.5 Turbo")],
|
|
string="OpenAI Model",
|
|
default="gpt-4o",
|
|
config_parameter="encoach_ai.openai_model",
|
|
)
|
|
ai_openai_fast_model = fields.Selection(
|
|
[("gpt-4o-mini", "GPT-4o Mini"), ("gpt-3.5-turbo", "GPT-3.5 Turbo")],
|
|
string="OpenAI Fast Model",
|
|
default="gpt-3.5-turbo",
|
|
config_parameter="encoach_ai.openai_fast_model",
|
|
)
|
|
|
|
# ── AWS Polly ──
|
|
ai_aws_access_key = fields.Char(
|
|
string="AWS Access Key ID",
|
|
config_parameter="encoach_ai.aws_access_key",
|
|
)
|
|
ai_aws_secret_key = fields.Char(
|
|
string="AWS Secret Access Key",
|
|
config_parameter="encoach_ai.aws_secret_key",
|
|
)
|
|
ai_aws_region = fields.Char(
|
|
string="AWS Region",
|
|
default="eu-west-1",
|
|
config_parameter="encoach_ai.aws_region",
|
|
)
|
|
|
|
# ── ElevenLabs ──
|
|
ai_elevenlabs_api_key = fields.Char(
|
|
string="ElevenLabs API Key",
|
|
config_parameter="encoach_ai.elevenlabs_api_key",
|
|
)
|
|
ai_elevenlabs_model = fields.Char(
|
|
string="ElevenLabs Model",
|
|
default="eleven_multilingual_v2",
|
|
config_parameter="encoach_ai.elevenlabs_model",
|
|
)
|
|
ai_tts_provider = fields.Selection(
|
|
[("polly", "AWS Polly"), ("elevenlabs", "ElevenLabs")],
|
|
string="TTS Provider",
|
|
default="polly",
|
|
config_parameter="encoach_ai.tts_provider",
|
|
)
|
|
|
|
# ── GPTZero ──
|
|
ai_gptzero_api_key = fields.Char(
|
|
string="GPTZero API Key",
|
|
config_parameter="encoach_ai.gptzero_api_key",
|
|
)
|
|
|
|
# ── ELAI ──
|
|
ai_elai_token = fields.Char(
|
|
string="ELAI Token",
|
|
config_parameter="encoach_ai.elai_token",
|
|
)
|
|
|
|
# ── Operational ──
|
|
ai_max_retries = fields.Integer(
|
|
string="Max Generation Retries",
|
|
default=3,
|
|
config_parameter="encoach_ai.max_retries",
|
|
)
|
|
ai_enabled = fields.Boolean(
|
|
string="AI Services Enabled",
|
|
default=True,
|
|
config_parameter="encoach_ai.enabled",
|
|
)
|