比较提交
1 提交
main
...
codex/styl
| 作者 | SHA1 | 提交日期 | |
|---|---|---|---|
| 6e2d37b320 |
共有 14 个文件被更改,包括 211 次插入 和 53 次删除
|
|
@ -1,3 +1,7 @@
|
|||
## 1.0.67
|
||||
|
||||
- Introduce Style Profile V2 with region-level invariants, scale adapters, prompt budgeting, and structured consensus payloads for more faithful face, hair, linework, shading, clothing-rendering, and background transfer.
|
||||
|
||||
## 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.
|
||||
|
|
|
|||
|
|
@ -229,6 +229,12 @@ _LITERAL_SHAPE_NEGATIVE_GUARDS: tuple[str, ...] = (
|
|||
# comparable across providers and prevents a visually attractive image from
|
||||
# receiving a high score while missing the actual line, face or shading grammar.
|
||||
STYLE_REVIEW_SCHEMA_VERSION = 3
|
||||
STYLE_PROFILE_V2_SCHEMA_VERSION = 1
|
||||
STYLE_PROFILE_V2_REGION_ORDER = (
|
||||
"face", "eyes", "hair", "linework", "shading", "palette",
|
||||
"clothing_rendering", "background_rendering", "texture", "anatomy",
|
||||
)
|
||||
STYLE_PROFILE_V2_PROMPT_BUDGET = 12
|
||||
STYLE_REVIEW_DIMENSIONS: tuple[str, ...] = (
|
||||
"face_structure",
|
||||
"eye_design",
|
||||
|
|
@ -1735,6 +1741,12 @@ class AdvancedStyleSetService:
|
|||
),
|
||||
"feature_evidence": _list(provider_result.get("feature_evidence")),
|
||||
"color_hierarchy": _normalize_color_hierarchy(provider_result.get("color_hierarchy")),
|
||||
"style_profile_v2": _build_style_profile_v2({
|
||||
**provider_result,
|
||||
**structures,
|
||||
"artist_signature": provider_result.get("artist_signature"),
|
||||
"color_hierarchy": _normalize_color_hierarchy(provider_result.get("color_hierarchy")),
|
||||
}),
|
||||
"prompt_priority_groups": _object(provider_result.get("prompt_priority_groups")),
|
||||
"scale_capsules": _object(provider_result.get("scale_capsules")),
|
||||
"semantic_risk_audit": _list(provider_result.get("semantic_risk_audit")),
|
||||
|
|
@ -2290,6 +2302,7 @@ class AdvancedStyleSetService:
|
|||
"generation_capsules": consensus.result.get("generation_capsules"),
|
||||
"prompt_priority_groups": consensus.result.get("prompt_priority_groups"),
|
||||
"scale_capsules": consensus.result.get("scale_capsules"),
|
||||
"style_profile_v2": consensus.result.get("style_profile_v2"),
|
||||
"semantic_risk_audit": consensus.result.get("semantic_risk_audit"),
|
||||
"validation_content_prompt": case.content_prompt,
|
||||
"actual_generation_prompt": case.final_prompt,
|
||||
|
|
@ -4036,6 +4049,111 @@ def _style_kernel_parts(payload: dict[str, Any]) -> list[str]:
|
|||
return _unique_prompt_parts(result)
|
||||
|
||||
|
||||
def _style_profile_v2_region(value: Any) -> str:
|
||||
text = str(value or "").casefold()
|
||||
markers = {
|
||||
"face": ("face", "facial", "jaw", "chin", "cheek", "nose", "mouth"),
|
||||
"eyes": ("eye", "iris", "pupil", "lash", "eyelid", "catchlight"),
|
||||
"hair": ("hair", "strand", "bang", "fringe", "lock", "curl", "sheen", "highlight"),
|
||||
"linework": ("line", "ink", "outline", "contour", "stroke"),
|
||||
"shading": ("shadow", "shading", "cel", "gradient", "occlusion"),
|
||||
"palette": ("palette", "color", "colour", "chroma", "saturation", "hue", "pink", "lavender"),
|
||||
"clothing_rendering": ("clothing", "garment", "fabric", "frill", "lace", "fold", "accessor", "ornament"),
|
||||
"background_rendering": ("background", "environment", "scene", "bokeh", "architecture", "atmosphere"),
|
||||
"texture": ("texture", "grain", "brush", "surface", "paper", "noise"),
|
||||
"anatomy": ("anatomy", "proportion", "silhouette", "limb", "head-to-body"),
|
||||
}
|
||||
for region in STYLE_PROFILE_V2_REGION_ORDER:
|
||||
if any(marker in text for marker in markers[region]):
|
||||
return region
|
||||
return "texture"
|
||||
|
||||
|
||||
def _style_profile_v2_add(target: dict[str, list[str]], value: Any, *, region: Any = None) -> None:
|
||||
text = _clean_prompt_text(str(value or "").strip())
|
||||
if not text:
|
||||
return
|
||||
selected = str(region or _style_profile_v2_region(text))
|
||||
if selected not in STYLE_PROFILE_V2_REGION_ORDER:
|
||||
selected = _style_profile_v2_region(text)
|
||||
target.setdefault(selected, []).append(text)
|
||||
|
||||
|
||||
def _build_style_profile_v2(payload: Any) -> dict[str, Any]:
|
||||
data = payload if isinstance(payload, dict) else {}
|
||||
evidence = _normalized_feature_evidence(data.get("feature_evidence"))
|
||||
invariant_parts: dict[str, list[str]] = {region: [] for region in STYLE_PROFILE_V2_REGION_ORDER}
|
||||
signatures = _normalize_artist_signature(data.get("artist_signature"), [])
|
||||
for item in signatures:
|
||||
if not isinstance(item, dict):
|
||||
continue
|
||||
phrase = item.get("phrase")
|
||||
if _style_trait_is_supported(phrase, evidence, required=bool(evidence)):
|
||||
_style_profile_v2_add(invariant_parts, phrase, region={
|
||||
"face_structure": "face", "eye_design": "eyes", "hair_rendering": "hair",
|
||||
"linework": "linework", "shading": "shading", "palette": "palette",
|
||||
"highlights": "hair", "texture": "texture", "anatomy": "anatomy",
|
||||
}.get(str(item.get("dimension") or "")))
|
||||
profile = data.get("normalized_asset_profile") if isinstance(data.get("normalized_asset_profile"), dict) else {}
|
||||
for phrase in _prompt_parts(profile.get("must_preserve")):
|
||||
if _style_trait_is_supported(phrase, evidence, required=bool(evidence)):
|
||||
_style_profile_v2_add(invariant_parts, phrase)
|
||||
for phrase in _style_kernel_parts(data):
|
||||
_style_profile_v2_add(invariant_parts, phrase)
|
||||
for key, value in _normalize_color_hierarchy(data.get("color_hierarchy")).items():
|
||||
_style_profile_v2_add(invariant_parts, f"{key.replace('_', ' ')}: {value}", region="palette")
|
||||
attributes = profile.get("attributes") if isinstance(profile.get("attributes"), dict) else {}
|
||||
for key, raw in attributes.items():
|
||||
if not isinstance(raw, dict) or raw.get("transfer_role") != "style_structure":
|
||||
continue
|
||||
value = _optional_text(raw.get("value"))
|
||||
if value:
|
||||
_style_profile_v2_add(invariant_parts, value, region="face" if "facial" in str(key) else "anatomy")
|
||||
invariants: dict[str, list[str]] = {}
|
||||
for region in STYLE_PROFILE_V2_REGION_ORDER:
|
||||
parts = _compact_style_prompt_parts(
|
||||
[_strip_style_background_effects(_normalize_style_prompt_conflicts(item)) for item in invariant_parts[region]],
|
||||
limit=2,
|
||||
)
|
||||
if parts:
|
||||
invariants[region] = parts
|
||||
adapters: dict[str, list[str]] = {}
|
||||
raw_scales = data.get("scale_capsules") if isinstance(data.get("scale_capsules"), dict) else {}
|
||||
for case_key in ("portrait", "fullbody", "novel_scene"):
|
||||
raw = raw_scales.get(case_key)
|
||||
parts = _prompt_parts(raw.get("prompt_parts") or raw.get("positive_additions")) if isinstance(raw, dict) else _prompt_parts(raw)
|
||||
sanitized = []
|
||||
for item in _split_prompt_clauses(parts):
|
||||
safe, _ = _sanitize_minor_age_text(_normalize_style_prompt_conflicts(item))
|
||||
safe = _strip_style_background_effects(safe)
|
||||
if safe:
|
||||
sanitized.append(safe)
|
||||
if sanitized:
|
||||
adapters[case_key] = _compact_style_prompt_parts(sanitized, limit=4)
|
||||
variable = _unique_prompt_parts(
|
||||
_optional_text(item.get("trait") if isinstance(item, dict) else item) or ""
|
||||
for item in _list(data.get("variable_style_features"))
|
||||
)
|
||||
return {
|
||||
"schema_version": STYLE_PROFILE_V2_SCHEMA_VERSION,
|
||||
"invariants": invariants,
|
||||
"adapters": adapters,
|
||||
"variable_features": variable[:8],
|
||||
"evidence_supported_count": sum(1 for item in evidence if item.get("supported")),
|
||||
"region_order": list(STYLE_PROFILE_V2_REGION_ORDER),
|
||||
}
|
||||
|
||||
|
||||
def _style_profile_v2_prompt_parts(payload: dict[str, Any]) -> list[str]:
|
||||
profile = payload.get("style_profile_v2") if isinstance(payload.get("style_profile_v2"), dict) else _build_style_profile_v2(payload)
|
||||
invariants = profile.get("invariants") if isinstance(profile.get("invariants"), dict) else {}
|
||||
parts: list[str] = []
|
||||
for region in STYLE_PROFILE_V2_REGION_ORDER:
|
||||
for item in _prompt_parts(invariants.get(region))[:2]:
|
||||
parts.append(f"{region.replace('_', ' ')}: {item}")
|
||||
return _compact_style_prompt_parts(parts, limit=STYLE_PROFILE_V2_PROMPT_BUDGET)
|
||||
|
||||
|
||||
def _strip_style_background_effects(value: Any) -> str:
|
||||
text = str(value or "").strip()
|
||||
for pattern, replacement in _STYLE_BACKGROUND_EFFECT_PATTERNS:
|
||||
|
|
@ -4084,11 +4202,12 @@ def _detailed_style_prompt(result: Any, fallback: Any) -> str:
|
|||
required=bool(_VARIABLE_CONTENT_PATTERNS.search(item)),
|
||||
)
|
||||
]
|
||||
profile_v2_parts = _style_profile_v2_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.
|
||||
supplemental_parts = [*gated_must_preserve, *capsule_parts, *signature_parts, *color_parts]
|
||||
# Style Profile V2 is region-aware; legacy fields remain fallback evidence for old consensus records.
|
||||
supplemental_parts = [*profile_v2_parts, *gated_must_preserve, *capsule_parts, *signature_parts, *color_parts]
|
||||
# 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.
|
||||
for key, raw in (profile.get("attributes") or {}).items() if isinstance(profile.get("attributes"), dict) else []:
|
||||
|
|
@ -4129,7 +4248,7 @@ def _detailed_style_prompt(result: Any, fallback: Any) -> str:
|
|||
filtered.append(item)
|
||||
rewritten = filtered
|
||||
# Do not inject mature-adult body locks after scrubbing chronological-minor wording.
|
||||
compiled = _compact_style_prompt_parts(rewritten, limit=16)
|
||||
compiled = _compact_style_prompt_parts(rewritten, limit=STYLE_PROFILE_V2_PROMPT_BUDGET)
|
||||
if compiled:
|
||||
return _join_prompt(
|
||||
*compiled,
|
||||
|
|
@ -4170,12 +4289,16 @@ def _detailed_style_negative_prompt(result: Any, fallback: Any) -> str:
|
|||
|
||||
def _scale_specific_style_prompt(result: Any, case_key: str, common_prompt: Any = None) -> str:
|
||||
payload = result if isinstance(result, dict) else {}
|
||||
scales = payload.get("scale_capsules") if isinstance(payload.get("scale_capsules"), dict) else {}
|
||||
raw = scales.get(case_key)
|
||||
if isinstance(raw, dict):
|
||||
parts = _prompt_parts(raw.get("prompt_parts") or raw.get("positive_additions"))
|
||||
else:
|
||||
parts = _prompt_parts(raw)
|
||||
profile_v2 = payload.get("style_profile_v2") if isinstance(payload.get("style_profile_v2"), dict) else _build_style_profile_v2(payload)
|
||||
adapters = profile_v2.get("adapters") if isinstance(profile_v2.get("adapters"), dict) else {}
|
||||
parts = _prompt_parts(adapters.get(case_key))
|
||||
if not parts:
|
||||
scales = payload.get("scale_capsules") if isinstance(payload.get("scale_capsules"), dict) else {}
|
||||
raw = scales.get(case_key)
|
||||
if isinstance(raw, dict):
|
||||
parts = _prompt_parts(raw.get("prompt_parts") or raw.get("positive_additions"))
|
||||
else:
|
||||
parts = _prompt_parts(raw)
|
||||
clauses = []
|
||||
for part in parts:
|
||||
clauses.extend(_split_prompt_clauses(part))
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
plugin:
|
||||
name: astrbot_plugin_imagestudio
|
||||
display_name: ImageStudio
|
||||
version: 1.0.66
|
||||
version: 1.0.67
|
||||
|
||||
features:
|
||||
quick_profile: true
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ from core.runtime_paths import resolve_config_path
|
|||
from database.db_helper import load_config_payload
|
||||
|
||||
|
||||
PLUGIN_VERSION = "1.0.66"
|
||||
PLUGIN_VERSION = "1.0.67"
|
||||
|
||||
|
||||
@dataclass(frozen=True)
|
||||
|
|
|
|||
4
frontend/package-lock.json
自动生成
4
frontend/package-lock.json
自动生成
|
|
@ -1,12 +1,12 @@
|
|||
{
|
||||
"name": "astrbot-plugin-imagestudio-frontend",
|
||||
"version": "1.0.66",
|
||||
"version": "1.0.67",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "astrbot-plugin-imagestudio-frontend",
|
||||
"version": "1.0.66",
|
||||
"version": "1.0.67",
|
||||
"dependencies": {
|
||||
"@vitejs/plugin-vue": "^5.2.0",
|
||||
"pinia": "^2.3.0",
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "astrbot-plugin-imagestudio-frontend",
|
||||
"version": "1.0.66",
|
||||
"version": "1.0.67",
|
||||
"private": true,
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ name: astrbot_plugin_imagestudio
|
|||
display_name: ImageStudio
|
||||
desc: AstrBot >=4.25 ImageStudio role asset and image-generation workspace for Windows, Linux, macOS and Docker.
|
||||
short_desc: AstrBot 鍐呯殑瑙掕壊璧勪骇銆佸伐浣滄祦涓庡浘鐗囩敓鎴愮鐞嗗伐浣滃彴銆?
|
||||
version: 1.0.66
|
||||
version: 1.0.67
|
||||
author: YokiiroBW
|
||||
repo: "http://192.168.31.210:18085/YokiiroBW/astrbot_plugin_imagestudio"
|
||||
astrbot_version: ">=4.25.0,<5"
|
||||
|
|
|
|||
文件差异因一行或多行过长而隐藏
文件差异因一行或多行过长而隐藏
|
|
@ -1,13 +1,13 @@
|
|||
<!doctype html>
|
||||
<html lang="zh-CN">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>AstrBot ImageStudio</title>
|
||||
<script type="module" crossorigin src="./assets/index-BZ25rUbw.js"></script>
|
||||
<link rel="stylesheet" crossorigin href="./assets/index-B8Z-z8zX.css">
|
||||
</head>
|
||||
<body>
|
||||
<div id="app"></div>
|
||||
</body>
|
||||
</html>
|
||||
<!doctype html>
|
||||
<html lang="zh-CN">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>AstrBot ImageStudio</title>
|
||||
<script type="module" crossorigin src="./assets/index-BdfW6FGF.js"></script>
|
||||
<link rel="stylesheet" crossorigin href="./assets/index-iU5Ed_RF.css">
|
||||
</head>
|
||||
<body>
|
||||
<div id="app"></div>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
|||
|
|
@ -24,6 +24,7 @@ from backend.services.advanced_style_set_service import (
|
|||
_normalize_artist_signature,
|
||||
_normalize_style_deltas,
|
||||
_normalize_style_dimension_scores,
|
||||
_build_style_profile_v2,
|
||||
_normalize_rendering_layer_scores,
|
||||
_normalized_feature_evidence,
|
||||
_scale_specific_style_prompt,
|
||||
|
|
@ -1769,5 +1770,35 @@ class AdvancedStyleSetWorkflowTests(unittest.TestCase):
|
|||
self.assertEqual(comparison["recommendation"], "keep_previous_candidate")
|
||||
self.assertIn("fullbody", comparison["scenario_regressions"])
|
||||
|
||||
def test_style_profile_v2_separates_regions_and_scale_adapters(self) -> None:
|
||||
payload = {
|
||||
"normalized_asset_profile": {
|
||||
"must_preserve": [
|
||||
"thin tinted lavender contour lines",
|
||||
"short broad rounded face with a tiny tapered chin",
|
||||
"opaque creamy hair highlight shapes",
|
||||
]
|
||||
},
|
||||
"artist_signature": [
|
||||
{"dimension": "eye_design", "phrase": "layered irises with clustered white catchlights", "support_ratio": 1.0, "confidence": 0.95},
|
||||
{"dimension": "shading", "phrase": "two translucent lavender cel-shadow bands", "support_ratio": 1.0, "confidence": 0.95},
|
||||
],
|
||||
"scale_capsules": {
|
||||
"portrait": {"prompt_parts": ["preserve face width-to-length ratio", "preserve iris construction"]},
|
||||
"fullbody": {"prompt_parts": ["preserve adult-appropriate anatomy and limb length"]},
|
||||
"novel_scene": {"prompt_parts": ["separate character linework from background detail"]},
|
||||
},
|
||||
"feature_evidence": [],
|
||||
}
|
||||
profile = _build_style_profile_v2(payload)
|
||||
self.assertEqual(profile["schema_version"], 1)
|
||||
self.assertIn("eyes", profile["invariants"])
|
||||
self.assertIn("shading", profile["invariants"])
|
||||
self.assertEqual(set(profile["adapters"]), {"portrait", "fullbody", "novel_scene"})
|
||||
prompt = _detailed_style_prompt({**payload, "style_profile_v2": profile}, "fallback")
|
||||
self.assertLessEqual(len(prompt.split(", ")), 14)
|
||||
self.assertIn("layered irises", prompt)
|
||||
self.assertIn("face:", prompt)
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
|
|
|
|||
文件差异因一行或多行过长而隐藏
文件差异因一行或多行过长而隐藏
|
|
@ -1,13 +1,13 @@
|
|||
<!doctype html>
|
||||
<html lang="zh-CN">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>AstrBot ImageStudio</title>
|
||||
<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-Fxlc51Vo.css">
|
||||
</head>
|
||||
<body>
|
||||
<div id="app"></div>
|
||||
</body>
|
||||
</html>
|
||||
<!doctype html>
|
||||
<html lang="zh-CN">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>AstrBot ImageStudio</title>
|
||||
<script type="module" crossorigin src="/api/v1/plugins/extensions/astrbot_plugin_imagestudio/web/assets/index-DLzyriu-.js"></script>
|
||||
<link rel="stylesheet" crossorigin href="/api/v1/plugins/extensions/astrbot_plugin_imagestudio/web/assets/index-C0KIlCkM.css">
|
||||
</head>
|
||||
<body>
|
||||
<div id="app"></div>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
|||
正在加载…
添加表格
在新工单中引用