Expose formatter route traces
This commit is contained in:
@@ -6,10 +6,12 @@ from typing import Any, Callable
|
||||
try:
|
||||
from . import formatter_detail as detail_policy
|
||||
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_detail as detail_policy
|
||||
import formatter_input as input_policy
|
||||
import formatter_route_trace as trace_policy
|
||||
import formatter_target as target_policy
|
||||
|
||||
|
||||
@@ -68,6 +70,7 @@ def format_krea2_prompt_result(request: KreaFormatRequest, deps: KreaFormatDepen
|
||||
detail_level = detail_policy.normalize_detail_level(request.detail_level)
|
||||
style_mode = normalize_style_mode(request.style_mode)
|
||||
target = target_policy.normalize_target(request.target)
|
||||
input_hint = input_policy.normalize_input_hint(request.input_hint, text_hint=input_policy.INPUT_HINT_PROMPT)
|
||||
row, method = deps.row_from_inputs(request.source_text, request.metadata_json, request.input_hint)
|
||||
|
||||
if row and input_policy.is_pair_metadata(row):
|
||||
@@ -104,6 +107,16 @@ def format_krea2_prompt_result(request: KreaFormatRequest, deps: KreaFormatDepen
|
||||
),
|
||||
"method": f"{method}:krea2(insta_of_pair)",
|
||||
}
|
||||
output["route_trace_json"] = trace_policy.route_trace_json(
|
||||
formatter="krea2",
|
||||
branch="insta_of_pair",
|
||||
method=output["method"],
|
||||
input_hint=input_hint,
|
||||
target=target,
|
||||
selected_side=pair_target.selected_side,
|
||||
detail_level=detail_level,
|
||||
style_mode=style_mode,
|
||||
)
|
||||
return KreaFormatRoute(
|
||||
output=output,
|
||||
branch="insta_of_pair",
|
||||
@@ -143,6 +156,15 @@ def format_krea2_prompt_result(request: KreaFormatRequest, deps: KreaFormatDepen
|
||||
"hardcore_negative_prompt": "",
|
||||
"method": method,
|
||||
}
|
||||
output["route_trace_json"] = trace_policy.route_trace_json(
|
||||
formatter="krea2",
|
||||
branch=branch,
|
||||
method=method,
|
||||
input_hint=input_hint,
|
||||
target=target,
|
||||
detail_level=detail_level,
|
||||
style_mode=style_mode,
|
||||
)
|
||||
return KreaFormatRoute(
|
||||
output=output,
|
||||
branch=branch,
|
||||
|
||||
Reference in New Issue
Block a user