feat: initial backend codebase — EnCoach v3
Complete Odoo 19 backend with 25 custom addons: - encoach_core: user/entity/role management - encoach_api: REST API + JWT auth - encoach_ai: OpenAI integration, AI settings, generation - encoach_ai_course: AI-powered English & IELTS course generation - encoach_exam_template/session: exam creation, structures, sessions - encoach_scoring: AI auto-grading + manual approval - encoach_vector: pgvector RAG integration - encoach_adaptive: adaptive learning engine - encoach_placement: placement testing - encoach_taxonomy/resources: content taxonomy & resource management - Plus 14 more modules for courses, branding, portal, etc. Includes docs: user guide, generation report, developer workflow. Made-with: Cursor
This commit is contained in:
2
custom_addons/encoach_ai/models/__init__.py
Normal file
2
custom_addons/encoach_ai/models/__init__.py
Normal file
@@ -0,0 +1,2 @@
|
||||
from . import ai_settings
|
||||
from . import ai_log
|
||||
35
custom_addons/encoach_ai/models/ai_log.py
Normal file
35
custom_addons/encoach_ai/models/ai_log.py
Normal file
@@ -0,0 +1,35 @@
|
||||
from odoo import fields, models
|
||||
|
||||
|
||||
class EncoachAILog(models.Model):
|
||||
_name = "encoach.ai.log"
|
||||
_description = "AI Service Call Log"
|
||||
_order = "create_date desc"
|
||||
|
||||
service = fields.Selection(
|
||||
[
|
||||
("openai", "OpenAI"),
|
||||
("whisper", "Whisper"),
|
||||
("polly", "AWS Polly"),
|
||||
("elevenlabs", "ElevenLabs"),
|
||||
("gptzero", "GPTZero"),
|
||||
("elai", "ELAI"),
|
||||
("coach", "AI Coach"),
|
||||
],
|
||||
required=True,
|
||||
index=True,
|
||||
)
|
||||
action = fields.Char(index=True)
|
||||
model_used = fields.Char()
|
||||
prompt_tokens = fields.Integer(default=0)
|
||||
completion_tokens = fields.Integer(default=0)
|
||||
total_tokens = fields.Integer(default=0)
|
||||
latency_ms = fields.Integer()
|
||||
status = fields.Selection(
|
||||
[("success", "Success"), ("error", "Error"), ("timeout", "Timeout")],
|
||||
default="success",
|
||||
)
|
||||
error_message = fields.Text()
|
||||
user_id = fields.Many2one("res.users", default=lambda self: self.env.uid)
|
||||
input_preview = fields.Text()
|
||||
output_preview = fields.Text()
|
||||
79
custom_addons/encoach_ai/models/ai_settings.py
Normal file
79
custom_addons/encoach_ai/models/ai_settings.py
Normal file
@@ -0,0 +1,79 @@
|
||||
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",
|
||||
)
|
||||
Reference in New Issue
Block a user