Expose formatter route traces
This commit is contained in:
@@ -5,9 +5,11 @@ from typing import Any, Callable
|
||||
|
||||
try:
|
||||
from . import formatter_input as input_policy
|
||||
from . import formatter_route_trace as trace_policy
|
||||
from . import formatter_target as target_policy
|
||||
except ImportError: # pragma: no cover - plain-script smoke tests
|
||||
import formatter_input as input_policy
|
||||
import formatter_route_trace as trace_policy
|
||||
import formatter_target as target_policy
|
||||
|
||||
|
||||
@@ -64,6 +66,7 @@ def format_sdxl_prompt_result(request: SDXLFormatRequest, deps: SDXLFormatDepend
|
||||
request.quality_preset,
|
||||
)
|
||||
target = target_policy.normalize_target(request.target)
|
||||
input_hint = input_policy.normalize_input_hint(request.input_hint, text_hint=input_policy.INPUT_HINT_PROMPT)
|
||||
nude_weight = max(0.1, min(3.0, float(request.nude_weight)))
|
||||
row, method = deps.row_from_inputs(request.source_text, request.metadata_json, request.input_hint)
|
||||
|
||||
@@ -119,6 +122,17 @@ def format_sdxl_prompt_result(request: SDXLFormatRequest, deps: SDXLFormatDepend
|
||||
),
|
||||
"method": f"{method}:sdxl(insta_of_pair)",
|
||||
}
|
||||
output["route_trace_json"] = trace_policy.route_trace_json(
|
||||
formatter="sdxl",
|
||||
branch="insta_of_pair",
|
||||
method=output["method"],
|
||||
input_hint=input_hint,
|
||||
target=target,
|
||||
selected_side=pair_target.selected_side,
|
||||
style_preset=style_preset,
|
||||
quality_preset=quality_preset,
|
||||
nude_weight=nude_weight,
|
||||
)
|
||||
return SDXLFormatRoute(
|
||||
output=output,
|
||||
branch="insta_of_pair",
|
||||
@@ -163,6 +177,16 @@ def format_sdxl_prompt_result(request: SDXLFormatRequest, deps: SDXLFormatDepend
|
||||
"hardcore_negative_prompt": "",
|
||||
"method": method,
|
||||
}
|
||||
output["route_trace_json"] = trace_policy.route_trace_json(
|
||||
formatter="sdxl",
|
||||
branch=branch,
|
||||
method=method,
|
||||
input_hint=input_hint,
|
||||
target=target,
|
||||
style_preset=style_preset,
|
||||
quality_preset=quality_preset,
|
||||
nude_weight=nude_weight,
|
||||
)
|
||||
return SDXLFormatRoute(
|
||||
output=output,
|
||||
branch=branch,
|
||||
|
||||
Reference in New Issue
Block a user