first pass async feedback complete, regressions added

This commit is contained in:
2026-01-03 19:02:49 -07:00
parent 01be68c5da
commit 07e952936a
13 changed files with 961 additions and 332 deletions

View File

@@ -211,8 +211,8 @@ class AIService:
self,
feedback_template: str,
historic_prompts: List[Dict[str, str]],
current_feedback_words: Optional[List[Dict[str, Any]]] = None,
historic_feedback_words: Optional[List[Dict[str, str]]] = None
queued_feedback_words: Optional[List[Dict[str, Any]]] = None,
historic_feedback_words: Optional[List[Dict[str, Any]]] = None
) -> List[str]:
"""
Generate theme feedback words using AI.
@@ -220,8 +220,8 @@ class AIService:
Args:
feedback_template: Feedback analysis template
historic_prompts: List of historic prompts for context
current_feedback_words: Current feedback words with weights
historic_feedback_words: Historic feedback words (just words)
queued_feedback_words: Queued feedback words with weights (positions 0-5)
historic_feedback_words: Historic feedback words with weights (all positions)
Returns:
List of 6 theme words
@@ -230,7 +230,7 @@ class AIService:
full_prompt = self._prepare_feedback_prompt(
feedback_template,
historic_prompts,
current_feedback_words,
queued_feedback_words,
historic_feedback_words
)
@@ -275,8 +275,8 @@ class AIService:
self,
template: str,
historic_prompts: List[Dict[str, str]],
current_feedback_words: Optional[List[Dict[str, Any]]],
historic_feedback_words: Optional[List[Dict[str, str]]]
queued_feedback_words: Optional[List[Dict[str, Any]]],
historic_feedback_words: Optional[List[Dict[str, Any]]]
) -> str:
"""Prepare the full feedback prompt."""
if not historic_prompts:
@@ -284,14 +284,29 @@ class AIService:
full_prompt = f"{template}\n\nPrevious prompts:\n{json.dumps(historic_prompts, indent=2)}"
# Add current feedback words if available
if current_feedback_words:
feedback_context = json.dumps(current_feedback_words, indent=2)
full_prompt = f"{full_prompt}\n\nCurrent feedback themes (with weights):\n{feedback_context}"
# Add queued feedback words if available (these have user-adjusted weights)
if queued_feedback_words:
# Extract just the words and weights for clarity
queued_words_with_weights = []
for item in queued_feedback_words:
key = list(item.keys())[0]
word = item[key]
weight = item.get("weight", 3)
queued_words_with_weights.append({"word": word, "weight": weight})
# Add historic feedback words if available
feedback_context = json.dumps(queued_words_with_weights, indent=2)
full_prompt = f"{full_prompt}\n\nQueued feedback themes (with user-adjusted weights):\n{feedback_context}"
# Add historic feedback words if available (these may have weights too)
if historic_feedback_words:
feedback_historic_context = json.dumps(historic_feedback_words, indent=2)
# Extract just the words for historic context
historic_words = []
for item in historic_feedback_words:
key = list(item.keys())[0]
word = item[key]
historic_words.append(word)
feedback_historic_context = json.dumps(historic_words, indent=2)
full_prompt = f"{full_prompt}\n\nHistoric feedback themes (just words):\n{feedback_historic_context}"
return full_prompt