Commit 51f70bd2 authored by Martin Juhás's avatar Martin Juhás Committed by Richard Glosner
Browse files

feat: add llm pre-load for the email suggestions and free-form assessment

No API changes.

No related issue.
parent 9b2723cd
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -2,6 +2,7 @@ from django.conf import settings

from common_lib.models import PlatformConfig
from common_lib.schema.inputs import PlatformConfigInput
from llm.llm_classes import LLM_CLIENT


class PlatformConfigManager:
@@ -12,6 +13,7 @@ class PlatformConfigManager:
        config = PlatformConfigManager.get_config()
        max_teams = platform_config_input.max_teams
        update_interval = platform_config_input.update_interval
        llm_pre_load = platform_config_input.llm_pre_load

        if max_teams is not None:
            if max_teams < settings.MIN_MAX_TEAMS:
@@ -27,6 +29,13 @@ class PlatformConfigManager:
                )
            config.update_interval = update_interval

        if llm_pre_load is not None:
            if llm_pre_load and LLM_CLIENT is None:
                raise ValueError(
                    "'llm_pre_load' cannot be set to True when LLM client is not configured"
                )
            config.llm_pre_load = llm_pre_load

        config.save()
        return config

+18 −0
Original line number Diff line number Diff line
# Generated by Django 3.2.25 on 2026-01-16 09:22

from django.db import migrations, models


class Migration(migrations.Migration):

    dependencies = [
        ('common_lib', '0002_seed_platform_config'),
    ]

    operations = [
        migrations.AddField(
            model_name='platformconfig',
            name='llm_pre_load',
            field=models.BooleanField(default=False),
        ),
    ]
+2 −1
Original line number Diff line number Diff line
@@ -4,6 +4,7 @@ from django.db import models
class PlatformConfig(models.Model):
    max_teams = models.IntegerField()
    update_interval = models.IntegerField()
    llm_pre_load = models.BooleanField(default=False)

    def __str__(self):
        return f"PlatformConfig(max_teams={self.max_teams}, update_interval={self.update_interval})"
        return f"PlatformConfig(max_teams={self.max_teams}, update_interval={self.update_interval}, llm_pre_load={self.llm_pre_load})"
+1 −0
Original line number Diff line number Diff line
@@ -17,6 +17,7 @@ class TimeIntervalInput(TimeIntervalBase, graphene.InputObjectType):
class PlatformConfigInputBase:
    max_teams = graphene.Int(required=False, default_value=None)
    update_interval = graphene.Int(required=False, default_value=None)
    llm_pre_load = graphene.Boolean(required=False, default_value=None)


class PlatformConfigType(PlatformConfigInputBase, graphene.ObjectType):
+2 −2
Original line number Diff line number Diff line
@@ -539,7 +539,7 @@ class FreeFormQuestionDetailsType(DjangoObjectType):
    def resolve_llm_assessment(self, info):
        user = user_from_context(info.context)
        if user.group == User.AuthGroup.TRAINEE:
            return LLMAssessment.objects.none()
            return None

        return self.llm_assessment

@@ -1184,7 +1184,7 @@ class TEmailAddressType(DjangoObjectType):
    class Meta:
        model = EmailAddress
        interfaces = (EmailAddressInterface,)
        exclude = ["templates"]
        exclude = ["templates", "llm_assessment"]


class IEmailAddressType(DjangoObjectType):
Loading