feat: init commint
This commit is contained in:
@@ -4,9 +4,11 @@ from django.utils import timezone
|
||||
|
||||
from apps.agents.models import AgentDefinition, AgentStepBinding, AgentVersion
|
||||
from apps.modelhub.models import ModelDeployment
|
||||
from apps.modelhub.structured_output import StructuredOutputError, ensure_compatible
|
||||
from apps.skills.models import SkillDefinition, SkillVersion
|
||||
from apps.skills.services import validate_skill_version
|
||||
|
||||
RELEASE_MARKER = "knowledge-distillation-v1"
|
||||
RELEASE_MARKER = "knowledge-distillation-v2-native-schema-subset"
|
||||
|
||||
AGENT_INPUT_SCHEMA = {
|
||||
"type": "object",
|
||||
@@ -125,7 +127,6 @@ OUTPUT_SCHEMA = {
|
||||
"citations": {
|
||||
"type": "array",
|
||||
"items": {"type": "integer", "minimum": 1},
|
||||
"uniqueItems": True,
|
||||
},
|
||||
"knowledge_draft": KNOWLEDGE_DRAFT_SCHEMA,
|
||||
"troubleshooting_plan_draft": PLAN_DRAFT_SCHEMA,
|
||||
@@ -189,6 +190,14 @@ class Command(BaseCommand):
|
||||
)
|
||||
if deployment is None:
|
||||
raise CommandError("请先配置并启用模型渠道和模型配置")
|
||||
try:
|
||||
ensure_compatible(
|
||||
mode=deployment.structured_output_mode,
|
||||
test_status=deployment.structured_output_test_status,
|
||||
enforcement="native_json_schema",
|
||||
)
|
||||
except StructuredOutputError as error:
|
||||
raise CommandError(f"{error.code}: {error}") from error
|
||||
agent, _ = AgentDefinition.objects.get_or_create(
|
||||
code="knowledge-distillation",
|
||||
defaults={
|
||||
@@ -221,6 +230,7 @@ class Command(BaseCommand):
|
||||
prompt_template=PROMPT,
|
||||
input_schema=AGENT_INPUT_SCHEMA,
|
||||
output_schema=OUTPUT_SCHEMA,
|
||||
output_enforcement="native_json_schema",
|
||||
example_input={
|
||||
"ticket": {
|
||||
"ticket_no": "TK-DEMO",
|
||||
@@ -233,6 +243,7 @@ class Command(BaseCommand):
|
||||
},
|
||||
published_at=timezone.now(),
|
||||
)
|
||||
validate_skill_version(skill_version)
|
||||
skill.active_version = skill_version
|
||||
skill.save(update_fields=["active_version", "updated_at"])
|
||||
agent_version = AgentVersion.objects.create(
|
||||
|
||||
Reference in New Issue
Block a user