Enhance Planning Catalog Context and Prompt Slot Management
Deploy Development / deploy (push) Successful in 43s
Test Suite / pytest-backend (push) Failing after 2s
Test Suite / lint-backend (push) Successful in 0s
Test Suite / build-frontend (push) Successful in 13s
Test Suite / k6 /health Baseline (push) Successful in 34s
Test Suite / playwright-tests (push) Successful in 1m20s
Deploy Development / deploy (push) Successful in 43s
Test Suite / pytest-backend (push) Failing after 2s
Test Suite / lint-backend (push) Successful in 0s
Test Suite / build-frontend (push) Successful in 13s
Test Suite / k6 /health Baseline (push) Successful in 34s
Test Suite / playwright-tests (push) Successful in 1m20s
- Introduced new catalog context handling in planning prompt functions, allowing for improved integration of planning variables. - Added optional catalog context parameters in various functions to streamline the merging of planning prompt variables. - Updated frontend components to include CatalogPromptSlotsEditor for managing prompt slots across different catalog types. - Enhanced API utilities to support fetching and updating catalog prompt slots, improving backend functionality for catalog management. - Incremented version numbers and updated changelog to reflect the new features and improvements.
This commit is contained in:
1 parent
9cee862c32
commit
53f2b027cc
20 files changed
+1922
-204
No files matched your search
@@ -12,6 +12,7 @@ from pydantic import BaseModel, Field
|
||||
|
||||
from planning_exercise_semantics import brief_to_summary_dict, build_semantic_brief
|
||||
from planning_intent_context import build_planning_intent_context
|
||||
from planning_prompt_variables import merge_planning_prompt_variables
|
||||
|
||||
PLANNING_PROMPT_SLUGS = frozenset(
|
||||
{
|
||||
@@ -36,6 +37,7 @@ class PlanningPromptPreviewInput(BaseModel):
|
||||
user_notes: str = Field(default="Fokus Breitensport, ohne Wettkampfdruck.", max_length=2000)
|
||||
max_steps: int = Field(default=5, ge=2, le=10)
|
||||
search_query: Optional[str] = Field(default=None, max_length=2000)
|
||||
planning_catalog_context: Optional[Dict[str, Any]] = Field(default=None)
|
||||
|
||||
|
||||
def is_planning_prompt_slug(slug: str) -> bool:
|
||||
@@ -160,6 +162,24 @@ def _load_catalog_variables(cur) -> Dict[str, str]:
|
||||
}
|
||||
|
||||
|
||||
def _preview_catalog_context(body: PlanningPromptPreviewInput):
|
||||
from planning_catalog_context import catalog_context_from_mapping
|
||||
|
||||
raw = body.planning_catalog_context
|
||||
if raw:
|
||||
return catalog_context_from_mapping(raw)
|
||||
return None
|
||||
|
||||
|
||||
def _merge_catalog_preview(cur, slug: str, base: Dict[str, str], body: PlanningPromptPreviewInput) -> Dict[str, str]:
|
||||
return merge_planning_prompt_variables(
|
||||
cur,
|
||||
base,
|
||||
catalog=_preview_catalog_context(body),
|
||||
slug=slug,
|
||||
)
|
||||
|
||||
|
||||
def resolve_planning_prompt_preview_variables(
|
||||
cur,
|
||||
slug: str,
|
||||
@@ -189,34 +209,54 @@ def resolve_planning_prompt_preview_variables(
|
||||
catalogs = _load_catalog_variables(cur)
|
||||
|
||||
if s == "planning_progression_start_target":
|
||||
return {
|
||||
"goal_query": goal_query,
|
||||
"semantic_brief_json": brief_json,
|
||||
"user_notes": (body.user_notes or "").strip(),
|
||||
}
|
||||
return _merge_catalog_preview(
|
||||
cur,
|
||||
s,
|
||||
{
|
||||
"goal_query": goal_query,
|
||||
"semantic_brief_json": brief_json,
|
||||
"user_notes": (body.user_notes or "").strip(),
|
||||
},
|
||||
body,
|
||||
)
|
||||
|
||||
if s == "planning_progression_goal_analysis":
|
||||
return {
|
||||
"goal_query": goal_query,
|
||||
"semantic_brief_json": brief_json,
|
||||
}
|
||||
return _merge_catalog_preview(
|
||||
cur,
|
||||
s,
|
||||
{
|
||||
"goal_query": goal_query,
|
||||
"semantic_brief_json": brief_json,
|
||||
},
|
||||
body,
|
||||
)
|
||||
|
||||
if s == "planning_progression_roadmap":
|
||||
return {
|
||||
"goal_query": goal_query,
|
||||
"goal_analysis_json": _compact_json(goal_analysis),
|
||||
"semantic_brief_json": brief_json,
|
||||
"max_steps": str(max_steps),
|
||||
}
|
||||
return _merge_catalog_preview(
|
||||
cur,
|
||||
s,
|
||||
{
|
||||
"goal_query": goal_query,
|
||||
"goal_analysis_json": _compact_json(goal_analysis),
|
||||
"semantic_brief_json": brief_json,
|
||||
"max_steps": str(max_steps),
|
||||
},
|
||||
body,
|
||||
)
|
||||
|
||||
if s == "planning_progression_stage_spec":
|
||||
return {
|
||||
"goal_query": goal_query,
|
||||
"goal_analysis_json": _compact_json(goal_analysis),
|
||||
"major_steps_json": _compact_json(major_steps),
|
||||
"intent_context_json": intent_ctx_json,
|
||||
"semantic_brief_json": brief_json,
|
||||
}
|
||||
return _merge_catalog_preview(
|
||||
cur,
|
||||
s,
|
||||
{
|
||||
"goal_query": goal_query,
|
||||
"goal_analysis_json": _compact_json(goal_analysis),
|
||||
"major_steps_json": _compact_json(major_steps),
|
||||
"intent_context_json": intent_ctx_json,
|
||||
"semantic_brief_json": brief_json,
|
||||
},
|
||||
body,
|
||||
)
|
||||
|
||||
if s == "planning_exercise_query_semantics":
|
||||
return {
|
||||
@@ -225,13 +265,18 @@ def resolve_planning_prompt_preview_variables(
|
||||
}
|
||||
|
||||
if s == "planning_exercise_path_qa":
|
||||
return {
|
||||
"goal_query": goal_query,
|
||||
"semantic_brief_json": brief_json,
|
||||
"steps_json": _compact_json(_sample_path_steps()),
|
||||
"gaps_json": _compact_json([]),
|
||||
"bridge_inserts_json": _compact_json([]),
|
||||
}
|
||||
return _merge_catalog_preview(
|
||||
cur,
|
||||
s,
|
||||
{
|
||||
"goal_query": goal_query,
|
||||
"semantic_brief_json": brief_json,
|
||||
"steps_json": _compact_json(_sample_path_steps()),
|
||||
"gaps_json": _compact_json([]),
|
||||
"bridge_inserts_json": _compact_json([]),
|
||||
},
|
||||
body,
|
||||
)
|
||||
|
||||
if s == "planning_exercise_search_intent":
|
||||
return {
|
||||
|
||||
Reference in new issue
Block a user