first pass async feedback complete, regressions added
This commit is contained in:
@@ -107,28 +107,32 @@ class DataService:
|
||||
"""Save prompt pool to JSON file."""
|
||||
return await self.save_json(settings.PROMPTS_POOL_FILE, prompts)
|
||||
|
||||
async def load_feedback_words(self) -> List[Dict[str, Any]]:
|
||||
"""Load feedback words from JSON file."""
|
||||
return await self.load_json(
|
||||
settings.FEEDBACK_WORDS_FILE,
|
||||
default=[]
|
||||
)
|
||||
|
||||
async def save_feedback_words(self, feedback_words: List[Dict[str, Any]]) -> bool:
|
||||
"""Save feedback words to JSON file."""
|
||||
return await self.save_json(settings.FEEDBACK_WORDS_FILE, feedback_words)
|
||||
|
||||
async def load_feedback_historic(self) -> List[Dict[str, str]]:
|
||||
async def load_feedback_historic(self) -> List[Dict[str, Any]]:
|
||||
"""Load historic feedback words from JSON file."""
|
||||
return await self.load_json(
|
||||
settings.FEEDBACK_HISTORIC_FILE,
|
||||
default=[]
|
||||
)
|
||||
|
||||
async def save_feedback_historic(self, feedback_words: List[Dict[str, str]]) -> bool:
|
||||
async def save_feedback_historic(self, feedback_words: List[Dict[str, Any]]) -> bool:
|
||||
"""Save historic feedback words to JSON file."""
|
||||
return await self.save_json(settings.FEEDBACK_HISTORIC_FILE, feedback_words)
|
||||
|
||||
async def get_feedback_queued_words(self) -> List[Dict[str, Any]]:
|
||||
"""Get queued feedback words (positions 0-5) for user weighting."""
|
||||
feedback_historic = await self.load_feedback_historic()
|
||||
return feedback_historic[:6] if len(feedback_historic) >= 6 else feedback_historic
|
||||
|
||||
async def get_feedback_active_words(self) -> List[Dict[str, Any]]:
|
||||
"""Get active feedback words (positions 6-11) for prompt generation."""
|
||||
feedback_historic = await self.load_feedback_historic()
|
||||
if len(feedback_historic) >= 12:
|
||||
return feedback_historic[6:12]
|
||||
elif len(feedback_historic) > 6:
|
||||
return feedback_historic[6:]
|
||||
else:
|
||||
return []
|
||||
|
||||
async def load_prompt_template(self) -> str:
|
||||
"""Load prompt template from file."""
|
||||
template_path = Path(settings.PROMPT_TEMPLATE_PATH)
|
||||
|
||||
Reference in New Issue
Block a user