feat: enhance session metrics handling in activity summaries
- Integrated compact JSON payload generation for session metrics in `get_training_sessions_recent_weeks_data`. - Updated the registration of activity session insights to reflect the new compact format for session metrics. - Improved documentation to clarify the structure and semantics of the session metrics in the JSON output. - Added normalization for prompt numbers to ensure consistent formatting in the metrics.
This commit is contained in:
1 parent
7226e04e9c
commit
6756dc60f3
5 files changed
+188
-15
No files matched your search
@@ -48,6 +48,8 @@ from data_layer.health_metrics import (
|
||||
get_vo2_max_data
|
||||
)
|
||||
|
||||
from data_layer.prompt_output_compact import compact_json_payload_for_prompts
|
||||
|
||||
from placeholder_registry import build_ai_placeholder_caption, get_registry
|
||||
|
||||
# {{key|d}} — nur description anhängen; {{key|x}} — nur Erklärung (ai_caption / Registry)
|
||||
@@ -1028,8 +1030,8 @@ def _safe_json(func_name: str, profile_id: str) -> str:
|
||||
# If already string, return it; otherwise convert to JSON
|
||||
if isinstance(result, str):
|
||||
return result
|
||||
else:
|
||||
return json.dumps(result, ensure_ascii=False, default=str)
|
||||
compacted = compact_json_payload_for_prompts(result)
|
||||
return json.dumps(compacted, ensure_ascii=False, default=str)
|
||||
except Exception as e:
|
||||
print(f"[ERROR] _safe_json({func_name}, {profile_id}): {type(e).__name__}: {e}")
|
||||
traceback.print_exc()
|
||||
|
||||
Reference in new issue
Block a user