File size: 3,571 Bytes
cac0037 a07daae cac0037 c6efda1 cac0037 a07daae cac0037 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 | """Typed data surfaces for the NEXUS Visual Weaver dashboard."""
from __future__ import annotations
from dataclasses import asdict, dataclass, field
from datetime import datetime, timezone
from typing import Any
def utc_now() -> str:
return datetime.now(timezone.utc).replace(microsecond=0).isoformat()
@dataclass(frozen=True)
class CreativeRequest:
prompt: str
output_goal: str = "image_to_video"
adult_mode: bool = False
references: list[str] = field(default_factory=list)
creator_controls: dict[str, Any] = field(default_factory=dict)
reference_metadata: list[dict[str, Any]] = field(default_factory=list)
created_at: str = field(default_factory=utc_now)
@dataclass(frozen=True)
class TasteProfile:
version: str
locked_features: dict[str, Any]
must_include: list[str]
should_include: list[str]
forbidden: list[str]
@dataclass(frozen=True)
class TasteRefinedPrompt:
original: str
refined: str
additions: list[str]
score: float
missing_features: list[str]
@dataclass(frozen=True)
class WardrobeSlot:
name: str
description: str
material: str
palette: str
lora_hint: str
locked: bool = False
adult_only: bool = False
locate_region: str = "pending"
edit_priority: int = 3
@dataclass(frozen=True)
class OutfitGraph:
slots: list[WardrobeSlot]
score: float
@property
def locked_count(self) -> int:
return sum(1 for slot in self.slots if slot.locked)
@dataclass(frozen=True)
class ModelCandidate:
repo_id: str
role: str
task: str
params_b: float
runtime: str
license: str
gated: bool = False
adult_only: bool = False
public_demo: bool = True
source_url: str = ""
@dataclass(frozen=True)
class AdapterRecipe:
repo_id: str
adapter_for: str
task: str
weight: float = 0.75
license: str = "unknown"
adult_only: bool = False
compatibility: str = "compatible"
weight_name: str | None = None
trigger_words: list[str] = field(default_factory=list)
compatible_repo_ids: list[str] = field(default_factory=list)
runtime_enabled: bool = True
requires_image: bool = False
@dataclass(frozen=True)
class GroundingTarget:
slot_name: str
query: str
expected_region: str
confidence: float
@dataclass(frozen=True)
class InspectionReport:
status: str
targets: list[GroundingTarget]
drift_flags: list[str]
locate_model: str = "nvidia/LocateAnything-3B"
@dataclass(frozen=True)
class LoreBeatSet:
beats: list[dict[str, str]]
tone: str
@dataclass(frozen=True)
class VideoPlan:
preset: str
source: str
camera_move: str
duration_seconds: float
fps: int
continuity_locks: list[str]
checkpoint_required: bool = True
@dataclass(frozen=True)
class HumanCheckpoint:
checkpoint_id: str
recommendation: str
trust_score: float
required_actions: list[str]
@dataclass(frozen=True)
class GenerationRun:
request: CreativeRequest
refined_prompt: TasteRefinedPrompt
outfit: OutfitGraph
model_stack: list[ModelCandidate]
adapters: list[AdapterRecipe]
inspection: InspectionReport
lore: LoreBeatSet
video: VideoPlan
checkpoint: HumanCheckpoint
created_at: str = field(default_factory=utc_now)
def to_dict(self) -> dict[str, Any]:
return asdict(self)
@dataclass(frozen=True)
class WisdomRecord:
run_id: str
approved: bool
dataset_target: str
lessons: list[str]
created_at: str = field(default_factory=utc_now)
|