feat: complete style profile p0-p2 hardening
这个提交存在于:
父节点
8f9c543918
当前提交
26960a98f5
共有 20 个文件被更改,包括 383 次插入 和 153 次删除
|
|
@ -1,3 +1,7 @@
|
||||||
|
## 1.0.66
|
||||||
|
|
||||||
|
- Complete P0-P2 style-profile hardening: decouple age and anatomy evidence, enforce review consistency caps, gate core traits by cross-context evidence, re-audit semantic rewrites, deduplicate scale capsules, use neutral validation scenes, add layered rendering review, improve score trust display, and block automatic adoption of regressed candidates.
|
||||||
|
|
||||||
## 1.0.65
|
## 1.0.65
|
||||||
|
|
||||||
- Improve style transfer with adaptive face and eye proportions, opaque pearlescent hair-highlight constraints, high-frequency representative-image guidance, and representative reference validation enabled by default with safe pure-text fallback.
|
- Improve style transfer with adaptive face and eye proportions, opaque pearlescent hair-highlight constraints, high-frequency representative-image guidance, and representative reference validation enabled by default with safe pure-text fallback.
|
||||||
|
|
|
||||||
|
|
@ -228,7 +228,7 @@ _LITERAL_SHAPE_NEGATIVE_GUARDS: tuple[str, ...] = (
|
||||||
# recomputed on the server from a stable set of dimensions. This keeps scores
|
# recomputed on the server from a stable set of dimensions. This keeps scores
|
||||||
# comparable across providers and prevents a visually attractive image from
|
# comparable across providers and prevents a visually attractive image from
|
||||||
# receiving a high score while missing the actual line, face or shading grammar.
|
# receiving a high score while missing the actual line, face or shading grammar.
|
||||||
STYLE_REVIEW_SCHEMA_VERSION = 2
|
STYLE_REVIEW_SCHEMA_VERSION = 3
|
||||||
STYLE_REVIEW_DIMENSIONS: tuple[str, ...] = (
|
STYLE_REVIEW_DIMENSIONS: tuple[str, ...] = (
|
||||||
"face_structure",
|
"face_structure",
|
||||||
"eye_design",
|
"eye_design",
|
||||||
|
|
@ -277,7 +277,7 @@ DEFAULT_VALIDATION_CASES: tuple[dict[str, Any], ...] = (
|
||||||
{
|
{
|
||||||
"case_key": "portrait",
|
"case_key": "portrait",
|
||||||
"content_prompt": (
|
"content_prompt": (
|
||||||
"a new fictional heroine with short silver hair and teal eyes wearing a simple navy jacket, "
|
"an adult fictional heroine with short silver hair and teal eyes wearing a simple navy jacket, "
|
||||||
"head-and-shoulders portrait against a neutral matte studio background with even diffuse lighting, "
|
"head-and-shoulders portrait against a neutral matte studio background with even diffuse lighting, "
|
||||||
"with a distinct identity and wardrobe; keep subject age band neutral unless the user instruction specifies it"
|
"with a distinct identity and wardrobe; keep subject age band neutral unless the user instruction specifies it"
|
||||||
),
|
),
|
||||||
|
|
@ -295,7 +295,7 @@ DEFAULT_VALIDATION_CASES: tuple[dict[str, Any], ...] = (
|
||||||
{
|
{
|
||||||
"case_key": "novel_scene",
|
"case_key": "novel_scene",
|
||||||
"content_prompt": (
|
"content_prompt": (
|
||||||
"the same new fictional heroine with short silver hair, teal eyes and navy jacket walking through an ordinary town square "
|
"the same adult fictional heroine with short silver hair, teal eyes and navy jacket walking through an ordinary town square "
|
||||||
"during overcast daytime, wide environmental view with diffuse light, clear depth and a scene unrelated to the source samples"
|
"during overcast daytime, wide environmental view with diffuse light, clear depth and a scene unrelated to the source samples"
|
||||||
),
|
),
|
||||||
"aspect_ratio": "16:9",
|
"aspect_ratio": "16:9",
|
||||||
|
|
@ -1734,6 +1734,7 @@ class AdvancedStyleSetService:
|
||||||
structures,
|
structures,
|
||||||
),
|
),
|
||||||
"feature_evidence": _list(provider_result.get("feature_evidence")),
|
"feature_evidence": _list(provider_result.get("feature_evidence")),
|
||||||
|
"color_hierarchy": _normalize_color_hierarchy(provider_result.get("color_hierarchy")),
|
||||||
"prompt_priority_groups": _object(provider_result.get("prompt_priority_groups")),
|
"prompt_priority_groups": _object(provider_result.get("prompt_priority_groups")),
|
||||||
"scale_capsules": _object(provider_result.get("scale_capsules")),
|
"scale_capsules": _object(provider_result.get("scale_capsules")),
|
||||||
"semantic_risk_audit": _list(provider_result.get("semantic_risk_audit")),
|
"semantic_risk_audit": _list(provider_result.get("semantic_risk_audit")),
|
||||||
|
|
@ -2326,6 +2327,7 @@ class AdvancedStyleSetService:
|
||||||
else {}
|
else {}
|
||||||
)
|
)
|
||||||
semantic_risks = _normalize_semantic_risks(payload.get("semantic_risks"))
|
semantic_risks = _normalize_semantic_risks(payload.get("semantic_risks"))
|
||||||
|
layer_scores = _normalize_rendering_layer_scores(payload.get("rendering_layers"))
|
||||||
score, score_meta = _weighted_style_fidelity_score(
|
score, score_meta = _weighted_style_fidelity_score(
|
||||||
case.case_key,
|
case.case_key,
|
||||||
dimension_scores,
|
dimension_scores,
|
||||||
|
|
@ -2349,6 +2351,7 @@ class AdvancedStyleSetService:
|
||||||
"style_deltas": style_deltas,
|
"style_deltas": style_deltas,
|
||||||
"prompt_patch": prompt_patch,
|
"prompt_patch": prompt_patch,
|
||||||
"semantic_risks": semantic_risks,
|
"semantic_risks": semantic_risks,
|
||||||
|
"rendering_layers": layer_scores,
|
||||||
"content_leakage": _string_list(payload.get("content_leakage")),
|
"content_leakage": _string_list(payload.get("content_leakage")),
|
||||||
"correction_prompt": _optional_text(payload.get("correction_prompt")) or recognition.prompt,
|
"correction_prompt": _optional_text(payload.get("correction_prompt")) or recognition.prompt,
|
||||||
"negative_correction_prompt": _optional_text(payload.get("negative_correction_prompt")) or recognition.negative_prompt,
|
"negative_correction_prompt": _optional_text(payload.get("negative_correction_prompt")) or recognition.negative_prompt,
|
||||||
|
|
@ -2478,7 +2481,7 @@ def _consensus_instruction(
|
||||||
"surface/shape/placement descriptions over metaphors or object-like shorthand. consensus_style; "
|
"surface/shape/placement descriptions over metaphors or object-like shorthand. consensus_style; "
|
||||||
"variable_style_features; source_content_features; content_leakage_exclusions; outlier_source_ids; "
|
"variable_style_features; source_content_features; content_leakage_exclusions; outlier_source_ids; "
|
||||||
"representative_source_ids (1-3); artist_signature containing 4-8 high-specificity, source-supported painterly traits that distinguish this artist from generic anime. Balance the signature across available dimensions: face_structure, eye_design, hair_rendering, linework, shading, palette, highlights, texture and anatomy. Each signature item must include dimension, phrase, supporting_source_ids, support_ratio and confidence. Prefer concrete observable shape, edge, color and placement relationships over labels such as anime, beautiful or high quality; do not spend all signature slots on one dimension; consensus_confidence; feature_evidence where each item has trait, "
|
"representative_source_ids (1-3); artist_signature containing 4-8 high-specificity, source-supported painterly traits that distinguish this artist from generic anime. Balance the signature across available dimensions: face_structure, eye_design, hair_rendering, linework, shading, palette, highlights, texture and anatomy. Each signature item must include dimension, phrase, supporting_source_ids, support_ratio and confidence. Prefer concrete observable shape, edge, color and placement relationships over labels such as anime, beautiful or high quality; do not spend all signature slots on one dimension; consensus_confidence; feature_evidence where each item has trait, "
|
||||||
"supporting_source_ids, support_ratio and confidence; and validation_cases with exactly portrait, fullbody and "
|
"supporting_source_ids, support_ratio and confidence; and validation review rendering_layers with character_linework, character_coloring, background_linework, background_color, style_unity and optical_effect_interference; validation_cases with exactly portrait, fullbody and "
|
||||||
"novel_scene. Every validation content_prompt must describe a character, clothing, pose, camera and scene "
|
"novel_scene. Every validation content_prompt must describe a character, clothing, pose, camera and scene "
|
||||||
"semantically different from all source samples but remain in a comparable illustration domain. Use neutral matte studio "
|
"semantically different from all source samples but remain in a comparable illustration domain. Use neutral matte studio "
|
||||||
"lighting for portrait, neutral daylight for fullbody and ordinary overcast daytime for novel_scene; do not introduce dawn, "
|
"lighting for portrait, neutral daylight for fullbody and ordinary overcast daytime for novel_scene; do not introduce dawn, "
|
||||||
|
|
@ -3283,6 +3286,7 @@ def _weighted_style_fidelity_score(
|
||||||
|
|
||||||
mismatch_items = _string_list(mismatches)
|
mismatch_items = _string_list(mismatches)
|
||||||
delta_items = [item for item in _list(deltas) if isinstance(item, dict)]
|
delta_items = [item for item in _list(deltas) if isinstance(item, dict)]
|
||||||
|
reported_scores = dict(scores)
|
||||||
patch = prompt_patch if isinstance(prompt_patch, dict) else {}
|
patch = prompt_patch if isinstance(prompt_patch, dict) else {}
|
||||||
risk_items = [item for item in _list(semantic_risks) if isinstance(item, dict)]
|
risk_items = [item for item in _list(semantic_risks) if isinstance(item, dict)]
|
||||||
patch_count = (
|
patch_count = (
|
||||||
|
|
@ -3295,6 +3299,22 @@ def _weighted_style_fidelity_score(
|
||||||
if isinstance(item, dict)
|
if isinstance(item, dict)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
capped_scores = _cap_inconsistent_dimension_scores(
|
||||||
|
scores,
|
||||||
|
mismatches=mismatch_items,
|
||||||
|
deltas=delta_items,
|
||||||
|
prompt_patch=patch,
|
||||||
|
semantic_risks=risk_items,
|
||||||
|
)
|
||||||
|
dimension_consistency_capped = capped_scores != scores
|
||||||
|
if dimension_consistency_capped:
|
||||||
|
scores = capped_scores
|
||||||
|
available_weight = sum(weights.get(key, 0.0) for key in scores)
|
||||||
|
if available_weight > 0:
|
||||||
|
computed = sum(scores[key] * weights.get(key, 0.0) for key in scores) / available_weight
|
||||||
|
score = computed if provider_score is None or available_weight >= 0.75 else (
|
||||||
|
computed * available_weight + provider_score * (1.0 - available_weight)
|
||||||
|
)
|
||||||
mismatch_penalty = min(0.12, 0.025 * len(mismatch_items))
|
mismatch_penalty = min(0.12, 0.025 * len(mismatch_items))
|
||||||
delta_penalty = min(
|
delta_penalty = min(
|
||||||
0.16,
|
0.16,
|
||||||
|
|
@ -3303,7 +3323,7 @@ def _weighted_style_fidelity_score(
|
||||||
patch_penalty = min(0.10, 0.02 * patch_count)
|
patch_penalty = min(0.10, 0.02 * patch_count)
|
||||||
semantic_risk_penalty = min(0.12, 0.03 * len(risk_items))
|
semantic_risk_penalty = min(0.12, 0.03 * len(risk_items))
|
||||||
has_correction_text = bool(mismatch_items or delta_items or patch_count or risk_items)
|
has_correction_text = bool(mismatch_items or delta_items or patch_count or risk_items)
|
||||||
all_reported_perfect = bool(scores) and all(value >= 0.98 for value in scores.values())
|
all_reported_perfect = bool(reported_scores) and all(value >= 0.98 for value in reported_scores.values())
|
||||||
review_inconsistent = all_reported_perfect and has_correction_text
|
review_inconsistent = all_reported_perfect and has_correction_text
|
||||||
inconsistency_penalty = 0.08 if review_inconsistent else 0.0
|
inconsistency_penalty = 0.08 if review_inconsistent else 0.0
|
||||||
consistency_penalty = (
|
consistency_penalty = (
|
||||||
|
|
@ -3328,6 +3348,7 @@ def _weighted_style_fidelity_score(
|
||||||
"provider_score": provider_score,
|
"provider_score": provider_score,
|
||||||
"missing_dimensions": [key for key in STYLE_REVIEW_DIMENSIONS if key not in scores and weights.get(key, 0.0) > 0],
|
"missing_dimensions": [key for key in STYLE_REVIEW_DIMENSIONS if key not in scores and weights.get(key, 0.0) > 0],
|
||||||
"review_inconsistent": review_inconsistent,
|
"review_inconsistent": review_inconsistent,
|
||||||
|
"dimension_consistency_capped": dimension_consistency_capped,
|
||||||
"consistency_penalty": round(consistency_penalty, 4),
|
"consistency_penalty": round(consistency_penalty, 4),
|
||||||
"penalty_breakdown": {
|
"penalty_breakdown": {
|
||||||
"mismatches": round(mismatch_penalty, 4),
|
"mismatches": round(mismatch_penalty, 4),
|
||||||
|
|
@ -3340,6 +3361,38 @@ def _weighted_style_fidelity_score(
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
def _cap_inconsistent_dimension_scores(
|
||||||
|
scores: dict[str, float],
|
||||||
|
*,
|
||||||
|
mismatches: list[str],
|
||||||
|
deltas: list[dict[str, Any]],
|
||||||
|
prompt_patch: dict[str, Any],
|
||||||
|
semantic_risks: list[dict[str, Any]],
|
||||||
|
) -> dict[str, float]:
|
||||||
|
if not scores:
|
||||||
|
return scores
|
||||||
|
affected: set[str] = set()
|
||||||
|
for item in deltas:
|
||||||
|
dimension = _canonical_style_dimension(item.get("dimension"))
|
||||||
|
if dimension:
|
||||||
|
affected.add(dimension)
|
||||||
|
patch_text = " ".join(
|
||||||
|
[*_prompt_parts(prompt_patch.get("positive_additions")), *_prompt_parts(prompt_patch.get("negative_additions"))]
|
||||||
|
)
|
||||||
|
for dimension in STYLE_REVIEW_DIMENSIONS:
|
||||||
|
if _prompt_traits_overlap(patch_text, dimension.replace("_", " ")):
|
||||||
|
affected.add(dimension)
|
||||||
|
if semantic_risks:
|
||||||
|
affected.update({"hair_rendering", "highlights"})
|
||||||
|
if mismatches and not affected:
|
||||||
|
affected.update(scores)
|
||||||
|
capped = dict(scores)
|
||||||
|
for dimension in affected:
|
||||||
|
if dimension in capped and capped[dimension] >= 0.98:
|
||||||
|
capped[dimension] = 0.95
|
||||||
|
return capped
|
||||||
|
|
||||||
|
|
||||||
def _normalize_style_deltas(value: Any, *, case_key: Any) -> list[dict[str, Any]]:
|
def _normalize_style_deltas(value: Any, *, case_key: Any) -> list[dict[str, Any]]:
|
||||||
if not isinstance(value, list):
|
if not isinstance(value, list):
|
||||||
return []
|
return []
|
||||||
|
|
@ -3414,6 +3467,47 @@ def _normalize_style_prompt_patch(
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
def _normalize_color_hierarchy(value: Any) -> dict[str, str]:
|
||||||
|
if not isinstance(value, dict):
|
||||||
|
return {}
|
||||||
|
aliases = {
|
||||||
|
"global_value_range": ("global_value_range", "value_range", "global_values"),
|
||||||
|
"global_saturation_range": ("global_saturation_range", "saturation_range", "global_saturation"),
|
||||||
|
"local_color_separation": ("local_color_separation", "color_separation", "local_contrast"),
|
||||||
|
"shadow_hue_relationship": ("shadow_hue_relationship", "shadow_hue", "shadow_color_relationship"),
|
||||||
|
"highlight_temperature": ("highlight_temperature", "highlight_hue", "highlight_color_temperature"),
|
||||||
|
"character_background_contrast": ("character_background_contrast", "figure_background_contrast"),
|
||||||
|
}
|
||||||
|
result: dict[str, str] = {}
|
||||||
|
for canonical, names in aliases.items():
|
||||||
|
for name in names:
|
||||||
|
text = _optional_text(value.get(name))
|
||||||
|
if text:
|
||||||
|
result[canonical] = text
|
||||||
|
break
|
||||||
|
return result
|
||||||
|
|
||||||
|
|
||||||
|
def _normalize_rendering_layer_scores(value: Any) -> dict[str, float]:
|
||||||
|
aliases = {
|
||||||
|
"character_linework": ("character_linework", "figure_linework", "person_linework"),
|
||||||
|
"character_coloring": ("character_coloring", "figure_coloring", "person_coloring"),
|
||||||
|
"background_linework": ("background_linework", "environment_linework"),
|
||||||
|
"background_color": ("background_color", "environment_color", "background_palette"),
|
||||||
|
"style_unity": ("style_unity", "figure_background_unity", "style_consistency"),
|
||||||
|
"optical_effect_interference": ("optical_effect_interference", "effect_interference", "light_obscures_style"),
|
||||||
|
}
|
||||||
|
if not isinstance(value, dict):
|
||||||
|
return {}
|
||||||
|
normalized: dict[str, float] = {}
|
||||||
|
for canonical, names in aliases.items():
|
||||||
|
values = [_score(value.get(name)) for name in names if value.get(name) is not None]
|
||||||
|
values = [item for item in values if item is not None]
|
||||||
|
if values:
|
||||||
|
normalized[canonical] = round(sum(values) / len(values), 4)
|
||||||
|
return normalized
|
||||||
|
|
||||||
|
|
||||||
def _normalize_semantic_risks(value: Any) -> list[dict[str, Any]]:
|
def _normalize_semantic_risks(value: Any) -> list[dict[str, Any]]:
|
||||||
if not isinstance(value, list):
|
if not isinstance(value, list):
|
||||||
return []
|
return []
|
||||||
|
|
@ -3424,17 +3518,35 @@ def _normalize_semantic_risks(value: Any) -> list[dict[str, Any]]:
|
||||||
original = _optional_text(item.get("original_phrase"))
|
original = _optional_text(item.get("original_phrase"))
|
||||||
rewrite = _optional_text(item.get("safe_rewrite"))
|
rewrite = _optional_text(item.get("safe_rewrite"))
|
||||||
if original or rewrite:
|
if original or rewrite:
|
||||||
|
safe_rewrite, generated_guard = _sanitize_semantic_rewrite(rewrite)
|
||||||
result.append(
|
result.append(
|
||||||
{
|
{
|
||||||
"original_phrase": original,
|
"original_phrase": original,
|
||||||
"risk": _optional_text(item.get("risk")),
|
"risk": _optional_text(item.get("risk")),
|
||||||
"safe_rewrite": rewrite,
|
"safe_rewrite": safe_rewrite,
|
||||||
"negative_guard": _optional_text(item.get("negative_guard")),
|
"negative_guard": _join_prompt(_optional_text(item.get("negative_guard")), generated_guard),
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
return result
|
return result
|
||||||
|
|
||||||
|
|
||||||
|
def _sanitize_semantic_rewrite(value: Any) -> tuple[str | None, str | None]:
|
||||||
|
text = _clean_prompt_text(str(value or "").strip())
|
||||||
|
if not text:
|
||||||
|
return None, None
|
||||||
|
if _HAIR_HIGHLIGHT_PATTERNS.search(text) and _semantic_phrase_is_object_risky(text):
|
||||||
|
text = _HAIR_HIGHLIGHT_SAFE_REWRITE
|
||||||
|
if _semantic_phrase_is_object_risky(text):
|
||||||
|
text = re.sub(
|
||||||
|
r"\b(ring|halo|band|bar|stripe|crown|orb|ribbon|frame|glow\s+line)\b",
|
||||||
|
"surface-bound painted accent",
|
||||||
|
text,
|
||||||
|
flags=re.IGNORECASE,
|
||||||
|
)
|
||||||
|
guard = ", ".join(_LITERAL_SHAPE_NEGATIVE_GUARDS) if _semantic_phrase_is_object_risky(value) else None
|
||||||
|
return text, guard
|
||||||
|
|
||||||
|
|
||||||
def _aggregate_style_review_feedback(cases: list[Any]) -> dict[str, Any]:
|
def _aggregate_style_review_feedback(cases: list[Any]) -> dict[str, Any]:
|
||||||
reviewed = []
|
reviewed = []
|
||||||
dimension_values: dict[str, list[float]] = {}
|
dimension_values: dict[str, list[float]] = {}
|
||||||
|
|
@ -3479,6 +3591,7 @@ def _aggregate_style_review_feedback(cases: list[Any]) -> dict[str, Any]:
|
||||||
"style_deltas": deltas,
|
"style_deltas": deltas,
|
||||||
"prompt_patches": prompt_patches,
|
"prompt_patches": prompt_patches,
|
||||||
"semantic_risks": semantic_risks,
|
"semantic_risks": semantic_risks,
|
||||||
|
"rendering_layer_averages": _average_layer_scores(cases),
|
||||||
"correction_policy": {
|
"correction_policy": {
|
||||||
"common_style": "apply only findings repeated across at least two scenarios or explicitly marked global",
|
"common_style": "apply only findings repeated across at least two scenarios or explicitly marked global",
|
||||||
"scale_specific": "keep isolated findings inside the matching portrait/fullbody/novel_scene capsule",
|
"scale_specific": "keep isolated findings inside the matching portrait/fullbody/novel_scene capsule",
|
||||||
|
|
@ -3488,6 +3601,15 @@ def _aggregate_style_review_feedback(cases: list[Any]) -> dict[str, Any]:
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
def _average_layer_scores(cases: list[Any]) -> dict[str, float]:
|
||||||
|
values: dict[str, list[float]] = {}
|
||||||
|
for case in cases:
|
||||||
|
review = case.style_review if isinstance(getattr(case, "style_review", None), dict) else {}
|
||||||
|
for key, score in _normalize_rendering_layer_scores(review.get("rendering_layers")).items():
|
||||||
|
values.setdefault(key, []).append(score)
|
||||||
|
return {key: round(sum(items) / len(items), 4) for key, items in values.items() if items}
|
||||||
|
|
||||||
|
|
||||||
def _style_attempt_comparison(
|
def _style_attempt_comparison(
|
||||||
*,
|
*,
|
||||||
current_attempt: Any,
|
current_attempt: Any,
|
||||||
|
|
@ -3498,14 +3620,6 @@ def _style_attempt_comparison(
|
||||||
current_score = _score(getattr(current_attempt, "fidelity_score", None))
|
current_score = _score(getattr(current_attempt, "fidelity_score", None))
|
||||||
previous_score = _score(getattr(previous_attempt, "fidelity_score", None)) if previous_attempt is not None else None
|
previous_score = _score(getattr(previous_attempt, "fidelity_score", None)) if previous_attempt is not None else None
|
||||||
delta = current_score - previous_score if current_score is not None and previous_score is not None else None
|
delta = current_score - previous_score if current_score is not None and previous_score is not None else None
|
||||||
if delta is None:
|
|
||||||
recommendation = "baseline"
|
|
||||||
elif delta >= 0.02:
|
|
||||||
recommendation = "adopt_candidate"
|
|
||||||
elif delta <= -0.02:
|
|
||||||
recommendation = "keep_previous_candidate"
|
|
||||||
else:
|
|
||||||
recommendation = "equivalent_requires_human_review"
|
|
||||||
current_by_key = {str(item.case_key): _score(item.fidelity_score) for item in current_cases}
|
current_by_key = {str(item.case_key): _score(item.fidelity_score) for item in current_cases}
|
||||||
previous_by_key = {str(item.case_key): _score(item.fidelity_score) for item in previous_cases}
|
previous_by_key = {str(item.case_key): _score(item.fidelity_score) for item in previous_cases}
|
||||||
scenario_deltas = {
|
scenario_deltas = {
|
||||||
|
|
@ -3513,6 +3627,21 @@ def _style_attempt_comparison(
|
||||||
for key in current_by_key.keys() & previous_by_key.keys()
|
for key in current_by_key.keys() & previous_by_key.keys()
|
||||||
if current_by_key[key] is not None and previous_by_key[key] is not None
|
if current_by_key[key] is not None and previous_by_key[key] is not None
|
||||||
}
|
}
|
||||||
|
current_feedback = _aggregate_style_review_feedback(current_cases)
|
||||||
|
current_risks = current_feedback.get("semantic_risks") or []
|
||||||
|
scenario_regressions = {key: value for key, value in scenario_deltas.items() if value <= -0.05}
|
||||||
|
if delta is None:
|
||||||
|
recommendation = "baseline"
|
||||||
|
elif current_risks:
|
||||||
|
recommendation = "keep_previous_candidate"
|
||||||
|
elif scenario_regressions:
|
||||||
|
recommendation = "keep_previous_candidate"
|
||||||
|
elif delta >= 0.02:
|
||||||
|
recommendation = "adopt_candidate"
|
||||||
|
elif delta <= -0.02:
|
||||||
|
recommendation = "keep_previous_candidate"
|
||||||
|
else:
|
||||||
|
recommendation = "equivalent_requires_human_review"
|
||||||
return {
|
return {
|
||||||
"schema_version": 1,
|
"schema_version": 1,
|
||||||
"current_attempt_id": str(current_attempt.attempt_id),
|
"current_attempt_id": str(current_attempt.attempt_id),
|
||||||
|
|
@ -3523,6 +3652,10 @@ def _style_attempt_comparison(
|
||||||
"scenario_deltas": scenario_deltas,
|
"scenario_deltas": scenario_deltas,
|
||||||
"recommendation": recommendation,
|
"recommendation": recommendation,
|
||||||
"regression_threshold": 0.02,
|
"regression_threshold": 0.02,
|
||||||
|
"scenario_regression_threshold": 0.05,
|
||||||
|
"scenario_regressions": scenario_regressions,
|
||||||
|
"new_semantic_risk_count": len(current_risks),
|
||||||
|
"automatic_adoption_blocked": recommendation == "keep_previous_candidate" and (bool(current_risks) or bool(scenario_regressions)),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -3540,17 +3673,34 @@ def _normalized_feature_evidence(value: Any) -> list[dict[str, Any]]:
|
||||||
"trait": trait,
|
"trait": trait,
|
||||||
"support_ratio": support,
|
"support_ratio": support,
|
||||||
"confidence": confidence,
|
"confidence": confidence,
|
||||||
|
"cross_context_supported": _evidence_cross_context_support(item),
|
||||||
"supported": bool(
|
"supported": bool(
|
||||||
support is not None
|
support is not None
|
||||||
and confidence is not None
|
and confidence is not None
|
||||||
and support >= STYLE_EVIDENCE_MIN_SUPPORT
|
and support >= STYLE_EVIDENCE_MIN_SUPPORT
|
||||||
and confidence >= STYLE_EVIDENCE_MIN_CONFIDENCE
|
and confidence >= STYLE_EVIDENCE_MIN_CONFIDENCE
|
||||||
|
and _evidence_cross_context_support(item)
|
||||||
),
|
),
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
return result
|
return result
|
||||||
|
|
||||||
|
|
||||||
|
def _evidence_cross_context_support(item: dict[str, Any]) -> bool:
|
||||||
|
checks: list[bool] = []
|
||||||
|
for key in ("cross_role_support", "cross_scene_support", "cross_palette_support", "cross_context_support"):
|
||||||
|
if key in item:
|
||||||
|
checks.append(bool(item.get(key)))
|
||||||
|
for key in ("supporting_roles", "supporting_scenes", "supporting_contexts", "supporting_palette_families"):
|
||||||
|
if key in item:
|
||||||
|
values = item.get(key)
|
||||||
|
checks.append(
|
||||||
|
isinstance(values, list)
|
||||||
|
and len({str(value).strip().casefold() for value in values if str(value).strip()}) >= 2
|
||||||
|
)
|
||||||
|
return all(checks) if checks else True
|
||||||
|
|
||||||
|
|
||||||
def _style_trait_is_supported(
|
def _style_trait_is_supported(
|
||||||
value: Any,
|
value: Any,
|
||||||
evidence: list[dict[str, Any]],
|
evidence: list[dict[str, Any]],
|
||||||
|
|
@ -3564,7 +3714,10 @@ def _style_trait_is_supported(
|
||||||
return False
|
return False
|
||||||
matching = [item for item in evidence if _prompt_traits_overlap(text, item.get("trait"))]
|
matching = [item for item in evidence if _prompt_traits_overlap(text, item.get("trait"))]
|
||||||
if matching:
|
if matching:
|
||||||
return any(bool(item.get("supported")) for item in matching)
|
return any(
|
||||||
|
bool(item.get("supported")) and bool(item.get("cross_context_supported", True))
|
||||||
|
for item in matching
|
||||||
|
)
|
||||||
return not required
|
return not required
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -3900,13 +4053,15 @@ def _detailed_style_prompt(result: Any, fallback: Any) -> str:
|
||||||
profile = payload.get("normalized_asset_profile") if isinstance(payload.get("normalized_asset_profile"), dict) else {}
|
profile = payload.get("normalized_asset_profile") if isinstance(payload.get("normalized_asset_profile"), dict) else {}
|
||||||
must_preserve = _unique_prompt_parts([*must_preserve, *_prompt_parts(profile.get("must_preserve"))])
|
must_preserve = _unique_prompt_parts([*must_preserve, *_prompt_parts(profile.get("must_preserve"))])
|
||||||
priorities = payload.get("prompt_priority_groups") if isinstance(payload.get("prompt_priority_groups"), dict) else {}
|
priorities = payload.get("prompt_priority_groups") if isinstance(payload.get("prompt_priority_groups"), dict) else {}
|
||||||
priority_parts = [
|
|
||||||
*_prompt_parts(priorities.get("core")),
|
|
||||||
*_prompt_parts(priorities.get("structural")),
|
|
||||||
*_prompt_parts(priorities.get("rendering")),
|
|
||||||
]
|
|
||||||
evidence = _normalized_feature_evidence(payload.get("feature_evidence"))
|
evidence = _normalized_feature_evidence(payload.get("feature_evidence"))
|
||||||
strict_evidence = bool(evidence)
|
strict_evidence = bool(evidence)
|
||||||
|
priority_parts = [
|
||||||
|
(item, True) for item in _prompt_parts(priorities.get("core"))
|
||||||
|
] + [
|
||||||
|
(item, False) for item in _prompt_parts(priorities.get("structural"))
|
||||||
|
] + [
|
||||||
|
(item, False) for item in _prompt_parts(priorities.get("rendering"))
|
||||||
|
]
|
||||||
gated_must_preserve = [
|
gated_must_preserve = [
|
||||||
item for item in must_preserve
|
item for item in must_preserve
|
||||||
if _style_trait_is_supported(item, evidence, required=strict_evidence)
|
if _style_trait_is_supported(item, evidence, required=strict_evidence)
|
||||||
|
|
@ -3914,11 +4069,11 @@ def _detailed_style_prompt(result: Any, fallback: Any) -> str:
|
||||||
# Preserve compact provider-derived style priorities, but still gate literal
|
# Preserve compact provider-derived style priorities, but still gate literal
|
||||||
# scene/optical effects that lack cross-image evidence.
|
# scene/optical effects that lack cross-image evidence.
|
||||||
gated_priorities = [
|
gated_priorities = [
|
||||||
item for item in priority_parts
|
item for item, is_core in priority_parts
|
||||||
if _style_trait_is_supported(
|
if _style_trait_is_supported(
|
||||||
item,
|
item,
|
||||||
evidence,
|
evidence,
|
||||||
required=bool(_VARIABLE_CONTENT_PATTERNS.search(item)),
|
required=is_core or bool(_VARIABLE_CONTENT_PATTERNS.search(item)),
|
||||||
)
|
)
|
||||||
]
|
]
|
||||||
capsule_parts = [
|
capsule_parts = [
|
||||||
|
|
@ -3930,8 +4085,10 @@ def _detailed_style_prompt(result: Any, fallback: Any) -> str:
|
||||||
)
|
)
|
||||||
]
|
]
|
||||||
signature_parts = _artist_signature_prompt_parts(payload)
|
signature_parts = _artist_signature_prompt_parts(payload)
|
||||||
|
color_hierarchy = payload.get("color_hierarchy") if isinstance(payload.get("color_hierarchy"), dict) else {}
|
||||||
|
color_parts = [f"{key.replace('_', ' ')}: {value}" for key, value in color_hierarchy.items()]
|
||||||
# Priority groups are the compact style kernel; signatures and capsules are supplementary evidence.
|
# Priority groups are the compact style kernel; signatures and capsules are supplementary evidence.
|
||||||
supplemental_parts = [*gated_must_preserve, *capsule_parts, *signature_parts]
|
supplemental_parts = [*gated_must_preserve, *capsule_parts, *signature_parts, *color_parts]
|
||||||
# Structural age stylization / body-ratio cues are not optional traits; keep them even when
|
# Structural age stylization / body-ratio cues are not optional traits; keep them even when
|
||||||
# feature_evidence only covers linework/eyes. Chronological age attributes stay excluded.
|
# feature_evidence only covers linework/eyes. Chronological age attributes stay excluded.
|
||||||
for key, raw in (profile.get("attributes") or {}).items() if isinstance(profile.get("attributes"), dict) else []:
|
for key, raw in (profile.get("attributes") or {}).items() if isinstance(profile.get("attributes"), dict) else []:
|
||||||
|
|
@ -4022,6 +4179,10 @@ def _scale_specific_style_prompt(result: Any, case_key: str, common_prompt: Any
|
||||||
clauses = []
|
clauses = []
|
||||||
for part in parts:
|
for part in parts:
|
||||||
clauses.extend(_split_prompt_clauses(part))
|
clauses.extend(_split_prompt_clauses(part))
|
||||||
|
if common_prompt is None:
|
||||||
|
capsules = payload.get("generation_capsules") if isinstance(payload.get("generation_capsules"), dict) else {}
|
||||||
|
detailed = capsules.get("detailed") if isinstance(capsules.get("detailed"), dict) else {}
|
||||||
|
common_prompt = _join_prompt(*_prompt_parts(detailed.get("prompt_parts")), *_prompt_parts(detailed.get("must_preserve")))
|
||||||
common_clauses = _split_prompt_clauses(common_prompt)
|
common_clauses = _split_prompt_clauses(common_prompt)
|
||||||
scale_only = [
|
scale_only = [
|
||||||
item for item in clauses
|
item for item in clauses
|
||||||
|
|
@ -4072,9 +4233,8 @@ def _apply_semantic_risk_rewrites(value: str, risks: list[dict[str, Any]]) -> st
|
||||||
rewrite = _optional_text(item.get("safe_rewrite"))
|
rewrite = _optional_text(item.get("safe_rewrite"))
|
||||||
if original and rewrite:
|
if original and rewrite:
|
||||||
result = re.sub(re.escape(original), rewrite, result, flags=re.IGNORECASE)
|
result = re.sub(re.escape(original), rewrite, result, flags=re.IGNORECASE)
|
||||||
if _semantic_phrase_is_object_risky(result) and _HAIR_HIGHLIGHT_PATTERNS.search(result):
|
safe, _guard = _sanitize_semantic_rewrite(result)
|
||||||
return _HAIR_HIGHLIGHT_SAFE_REWRITE
|
return safe or result
|
||||||
return result
|
|
||||||
|
|
||||||
|
|
||||||
def _compact_style_prompt_parts(values: list[str], *, limit: int) -> list[str]:
|
def _compact_style_prompt_parts(values: list[str], *, limit: int) -> list[str]:
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
plugin:
|
plugin:
|
||||||
name: astrbot_plugin_imagestudio
|
name: astrbot_plugin_imagestudio
|
||||||
display_name: ImageStudio
|
display_name: ImageStudio
|
||||||
version: 1.0.65
|
version: 1.0.66
|
||||||
|
|
||||||
features:
|
features:
|
||||||
quick_profile: true
|
quick_profile: true
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@ from core.runtime_paths import resolve_config_path
|
||||||
from database.db_helper import load_config_payload
|
from database.db_helper import load_config_payload
|
||||||
|
|
||||||
|
|
||||||
PLUGIN_VERSION = "1.0.65"
|
PLUGIN_VERSION = "1.0.66"
|
||||||
|
|
||||||
|
|
||||||
@dataclass(frozen=True)
|
@dataclass(frozen=True)
|
||||||
|
|
|
||||||
4
frontend/package-lock.json
自动生成
4
frontend/package-lock.json
自动生成
|
|
@ -1,12 +1,12 @@
|
||||||
{
|
{
|
||||||
"name": "astrbot-plugin-imagestudio-frontend",
|
"name": "astrbot-plugin-imagestudio-frontend",
|
||||||
"version": "1.0.65",
|
"version": "1.0.66",
|
||||||
"lockfileVersion": 3,
|
"lockfileVersion": 3,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "astrbot-plugin-imagestudio-frontend",
|
"name": "astrbot-plugin-imagestudio-frontend",
|
||||||
"version": "1.0.65",
|
"version": "1.0.66",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@vitejs/plugin-vue": "^5.2.0",
|
"@vitejs/plugin-vue": "^5.2.0",
|
||||||
"pinia": "^2.3.0",
|
"pinia": "^2.3.0",
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "astrbot-plugin-imagestudio-frontend",
|
"name": "astrbot-plugin-imagestudio-frontend",
|
||||||
"version": "1.0.65",
|
"version": "1.0.66",
|
||||||
"private": true,
|
"private": true,
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|
|
||||||
|
|
@ -147,6 +147,7 @@ export interface AdvancedStyleValidationCase {
|
||||||
input_image_count?: number
|
input_image_count?: number
|
||||||
style_scores: Record<string, unknown>
|
style_scores: Record<string, unknown>
|
||||||
style_review?: Record<string, unknown>
|
style_review?: Record<string, unknown>
|
||||||
|
rendering_layers?: Record<string, number>
|
||||||
content_novelty: Record<string, unknown>
|
content_novelty: Record<string, unknown>
|
||||||
usage?: Record<string, unknown>
|
usage?: Record<string, unknown>
|
||||||
fidelity_score?: number | null
|
fidelity_score?: number | null
|
||||||
|
|
|
||||||
|
|
@ -1270,6 +1270,21 @@ function styleValidationFidelityPercent(validationCase: AdvancedStyleValidationC
|
||||||
return Number.isFinite(score) ? Math.max(0, Math.min(100, Math.round(score * 100))) : null
|
return Number.isFinite(score) ? Math.max(0, Math.min(100, Math.round(score * 100))) : null
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function styleValidationReviewTrust(validationCase: AdvancedStyleValidationCase) {
|
||||||
|
const review = validationCase.style_review && typeof validationCase.style_review === "object"
|
||||||
|
? validationCase.style_review as Record<string, any>
|
||||||
|
: {}
|
||||||
|
const calibration = review.score_calibration && typeof review.score_calibration === "object"
|
||||||
|
? review.score_calibration as Record<string, any>
|
||||||
|
: {}
|
||||||
|
const coverage = Number(calibration.dimension_coverage)
|
||||||
|
const inconsistent = Boolean(calibration.review_inconsistent || calibration.dimension_consistency_capped)
|
||||||
|
const risks = Array.isArray(review.semantic_risks) && review.semantic_risks.length > 0
|
||||||
|
if (inconsistent || risks) return "????????????????"
|
||||||
|
if (Number.isFinite(coverage)) return `????? ? ???? ${Math.round(coverage * 100)}%`
|
||||||
|
return "?????"
|
||||||
|
}
|
||||||
|
|
||||||
function styleValidationReviewSummary(validationCase: AdvancedStyleValidationCase) {
|
function styleValidationReviewSummary(validationCase: AdvancedStyleValidationCase) {
|
||||||
const review = validationCase.style_review && typeof validationCase.style_review === "object"
|
const review = validationCase.style_review && typeof validationCase.style_review === "object"
|
||||||
? validationCase.style_review
|
? validationCase.style_review
|
||||||
|
|
@ -1594,6 +1609,7 @@ function errorMessage(err: unknown) {
|
||||||
<p>{{ validationCase.content_prompt || "后端将规划与源样本不同、但便于对照的验证角色与场景。" }}</p>
|
<p>{{ validationCase.content_prompt || "后端将规划与源样本不同、但便于对照的验证角色与场景。" }}</p>
|
||||||
<small v-if="validationCase.metadata?.validation_instruction" class="advanced-applied-adjustment">已应用文字调整:{{ validationCase.metadata.validation_instruction }}</small>
|
<small v-if="validationCase.metadata?.validation_instruction" class="advanced-applied-adjustment">已应用文字调整:{{ validationCase.metadata.validation_instruction }}</small>
|
||||||
<small v-if="styleValidationFidelityPercent(validationCase) != null" class="advanced-style-fidelity">自动还原度:{{ styleValidationFidelityPercent(validationCase) }}%</small>
|
<small v-if="styleValidationFidelityPercent(validationCase) != null" class="advanced-style-fidelity">自动还原度:{{ styleValidationFidelityPercent(validationCase) }}%</small>
|
||||||
|
<small v-if="styleValidationFidelityPercent(validationCase) != null" class="advanced-style-review-trust">{{ styleValidationReviewTrust(validationCase) }}</small>
|
||||||
<small v-if="styleValidationReviewSummary(validationCase)" class="advanced-style-review-summary">{{ styleValidationReviewSummary(validationCase) }}</small>
|
<small v-if="styleValidationReviewSummary(validationCase)" class="advanced-style-review-summary">{{ styleValidationReviewSummary(validationCase) }}</small>
|
||||||
<small>{{ Number(validationCase.input_image_count || validationCase.metadata?.input_image_count || 0) > 0 || validationCase.metadata?.reference_image_applied ? "风格参考图验证" : "纯文本验证" }} · {{ Number(validationCase.input_image_count || validationCase.metadata?.input_image_count || 0) }} 张参考图 · 种子 {{ validationCase.seed || "自动" }}</small>
|
<small>{{ Number(validationCase.input_image_count || validationCase.metadata?.input_image_count || 0) > 0 || validationCase.metadata?.reference_image_applied ? "风格参考图验证" : "纯文本验证" }} · {{ Number(validationCase.input_image_count || validationCase.metadata?.input_image_count || 0) }} 张参考图 · 种子 {{ validationCase.seed || "自动" }}</small>
|
||||||
<em v-if="advancedMaterialErrorMessage(validationCase.error)">{{ advancedMaterialErrorMessage(validationCase.error) }}</em>
|
<em v-if="advancedMaterialErrorMessage(validationCase.error)">{{ advancedMaterialErrorMessage(validationCase.error) }}</em>
|
||||||
|
|
@ -1878,6 +1894,7 @@ button:disabled { cursor: not-allowed; opacity: .52; }
|
||||||
.advanced-style-validation-copy small { color: var(--accent-strong); font-size: 10px; }
|
.advanced-style-validation-copy small { color: var(--accent-strong); font-size: 10px; }
|
||||||
.advanced-style-validation-copy .advanced-applied-adjustment { border-left: 2px solid var(--primary); padding-left: 6px; color: var(--primary); line-height: 1.4; }
|
.advanced-style-validation-copy .advanced-applied-adjustment { border-left: 2px solid var(--primary); padding-left: 6px; color: var(--primary); line-height: 1.4; }
|
||||||
.advanced-style-validation-copy .advanced-style-fidelity { color: var(--text); font-weight: 900; }
|
.advanced-style-validation-copy .advanced-style-fidelity { color: var(--text); font-weight: 900; }
|
||||||
|
.advanced-style-validation-copy .advanced-style-review-trust { color: var(--muted-text, var(--text)); }
|
||||||
.advanced-style-validation-copy .advanced-style-review-summary { border-left: 2px solid var(--warning, #d89b30); padding-left: 6px; color: var(--text-soft); line-height: 1.4; }
|
.advanced-style-validation-copy .advanced-style-review-summary { border-left: 2px solid var(--warning, #d89b30); padding-left: 6px; color: var(--text-soft); line-height: 1.4; }
|
||||||
.advanced-style-validation-copy em { color: var(--danger); font-size: 10px; font-style: normal; }
|
.advanced-style-validation-copy em { color: var(--danger); font-size: 10px; font-style: normal; }
|
||||||
.advanced-review-controls { gap: 10px; }
|
.advanced-review-controls { gap: 10px; }
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@ name: astrbot_plugin_imagestudio
|
||||||
display_name: ImageStudio
|
display_name: ImageStudio
|
||||||
desc: AstrBot >=4.25 ImageStudio role asset and image-generation workspace for Windows, Linux, macOS and Docker.
|
desc: AstrBot >=4.25 ImageStudio role asset and image-generation workspace for Windows, Linux, macOS and Docker.
|
||||||
short_desc: AstrBot 鍐呯殑瑙掕壊璧勪骇銆佸伐浣滄祦涓庡浘鐗囩敓鎴愮鐞嗗伐浣滃彴銆?
|
short_desc: AstrBot 鍐呯殑瑙掕壊璧勪骇銆佸伐浣滄祦涓庡浘鐗囩敓鎴愮鐞嗗伐浣滃彴銆?
|
||||||
version: 1.0.65
|
version: 1.0.66
|
||||||
author: YokiiroBW
|
author: YokiiroBW
|
||||||
repo: "http://192.168.31.210:18085/YokiiroBW/astrbot_plugin_imagestudio"
|
repo: "http://192.168.31.210:18085/YokiiroBW/astrbot_plugin_imagestudio"
|
||||||
astrbot_version: ">=4.25.0,<5"
|
astrbot_version: ">=4.25.0,<5"
|
||||||
|
|
|
||||||
文件差异因一行或多行过长而隐藏
文件差异因一行或多行过长而隐藏
文件差异因一行或多行过长而隐藏
文件差异因一行或多行过长而隐藏
|
|
@ -4,8 +4,8 @@
|
||||||
<meta charset="UTF-8" />
|
<meta charset="UTF-8" />
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||||
<title>AstrBot ImageStudio</title>
|
<title>AstrBot ImageStudio</title>
|
||||||
<script type="module" crossorigin src="./assets/index-DeH0Kig6.js"></script>
|
<script type="module" crossorigin src="./assets/index-BZ25rUbw.js"></script>
|
||||||
<link rel="stylesheet" crossorigin href="./assets/index-Bw79A5u9.css">
|
<link rel="stylesheet" crossorigin href="./assets/index-B8Z-z8zX.css">
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div id="app"></div>
|
<div id="app"></div>
|
||||||
|
|
|
||||||
|
|
@ -24,8 +24,11 @@ from backend.services.advanced_style_set_service import (
|
||||||
_normalize_artist_signature,
|
_normalize_artist_signature,
|
||||||
_normalize_style_deltas,
|
_normalize_style_deltas,
|
||||||
_normalize_style_dimension_scores,
|
_normalize_style_dimension_scores,
|
||||||
|
_normalize_rendering_layer_scores,
|
||||||
|
_normalized_feature_evidence,
|
||||||
_scale_specific_style_prompt,
|
_scale_specific_style_prompt,
|
||||||
_scale_transfer_instruction,
|
_scale_transfer_instruction,
|
||||||
|
_style_attempt_comparison,
|
||||||
_sanitize_validation_content,
|
_sanitize_validation_content,
|
||||||
_validation_cases,
|
_validation_cases,
|
||||||
_weighted_style_fidelity_score,
|
_weighted_style_fidelity_score,
|
||||||
|
|
@ -1721,5 +1724,50 @@ class AdvancedStyleSetWorkflowTests(unittest.TestCase):
|
||||||
)
|
)
|
||||||
self.assertEqual([item["dimension"] for item in signature], ["linework"])
|
self.assertEqual([item["dimension"] for item in signature], ["linework"])
|
||||||
|
|
||||||
|
def test_core_evidence_requires_cross_context_support_when_declared(self) -> None:
|
||||||
|
evidence = _normalized_feature_evidence([
|
||||||
|
{
|
||||||
|
"trait": "distinct lavender shadow bands",
|
||||||
|
"support_ratio": 1.0,
|
||||||
|
"confidence": 0.95,
|
||||||
|
"cross_role_support": True,
|
||||||
|
"cross_scene_support": False,
|
||||||
|
"cross_palette_support": True,
|
||||||
|
}
|
||||||
|
])
|
||||||
|
self.assertFalse(evidence[0]["supported"])
|
||||||
|
self.assertFalse(evidence[0]["cross_context_supported"])
|
||||||
|
|
||||||
|
def test_review_layer_scores_are_normalized_separately_from_global_palette(self) -> None:
|
||||||
|
layers = _normalize_rendering_layer_scores({
|
||||||
|
"character_linework": 0.9,
|
||||||
|
"figure_coloring": 0.7,
|
||||||
|
"background_palette": 0.4,
|
||||||
|
"effect_interference": 0.2,
|
||||||
|
})
|
||||||
|
self.assertEqual(layers["character_linework"], 0.9)
|
||||||
|
self.assertEqual(layers["character_coloring"], 0.7)
|
||||||
|
self.assertEqual(layers["background_color"], 0.4)
|
||||||
|
self.assertEqual(layers["optical_effect_interference"], 0.2)
|
||||||
|
|
||||||
|
def test_regressed_case_blocks_automatic_candidate_adoption(self) -> None:
|
||||||
|
def case(key: str, score: float) -> SimpleNamespace:
|
||||||
|
return SimpleNamespace(
|
||||||
|
case_id=key,
|
||||||
|
case_key=key,
|
||||||
|
fidelity_score=score,
|
||||||
|
style_review={"status": "succeeded", "fidelity_score": score, "dimension_scores": {}},
|
||||||
|
)
|
||||||
|
current = SimpleNamespace(attempt_id="new", fidelity_score=0.82)
|
||||||
|
previous = SimpleNamespace(attempt_id="old", fidelity_score=0.80)
|
||||||
|
comparison = _style_attempt_comparison(
|
||||||
|
current_attempt=current,
|
||||||
|
current_cases=[case("portrait", 0.85), case("fullbody", 0.70), case("novel_scene", 0.91)],
|
||||||
|
previous_attempt=previous,
|
||||||
|
previous_cases=[case("portrait", 0.80), case("fullbody", 0.80), case("novel_scene", 0.80)],
|
||||||
|
)
|
||||||
|
self.assertEqual(comparison["recommendation"], "keep_previous_candidate")
|
||||||
|
self.assertIn("fullbody", comparison["scenario_regressions"])
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
unittest.main()
|
unittest.main()
|
||||||
|
|
|
||||||
文件差异因一行或多行过长而隐藏
文件差异因一行或多行过长而隐藏
57
web/assets/index-EHiWqZav.js
普通文件
57
web/assets/index-EHiWqZav.js
普通文件
文件差异因一行或多行过长而隐藏
文件差异因一行或多行过长而隐藏
|
|
@ -4,8 +4,8 @@
|
||||||
<meta charset="UTF-8" />
|
<meta charset="UTF-8" />
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||||
<title>AstrBot ImageStudio</title>
|
<title>AstrBot ImageStudio</title>
|
||||||
<script type="module" crossorigin src="/api/v1/plugins/extensions/astrbot_plugin_imagestudio/web/assets/index-BE0GnfZC.js"></script>
|
<script type="module" crossorigin src="/api/v1/plugins/extensions/astrbot_plugin_imagestudio/web/assets/index-EHiWqZav.js"></script>
|
||||||
<link rel="stylesheet" crossorigin href="/api/v1/plugins/extensions/astrbot_plugin_imagestudio/web/assets/index-BqAqEWbf.css">
|
<link rel="stylesheet" crossorigin href="/api/v1/plugins/extensions/astrbot_plugin_imagestudio/web/assets/index-Fxlc51Vo.css">
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div id="app"></div>
|
<div id="app"></div>
|
||||||
|
|
|
||||||
正在加载…
添加表格
在新工单中引用