More texts for retries
This commit is contained in:
parent
a0d24c9d44
commit
83a83dd421
@ -92,6 +92,8 @@ class GameEngine:
|
|||||||
if attempt < MAX_RETRIES:
|
if attempt < MAX_RETRIES:
|
||||||
feedback = "Your response was empty. Generate a complete turn with narrative and state changes."
|
feedback = "Your response was empty. Generate a complete turn with narrative and state changes."
|
||||||
state.append_llm_log("\n[RETRY] empty response")
|
state.append_llm_log("\n[RETRY] empty response")
|
||||||
|
if on_action:
|
||||||
|
on_action("DM is weaving the tale...")
|
||||||
continue
|
continue
|
||||||
return TurnResult(error="LLM returned empty response after retries")
|
return TurnResult(error="LLM returned empty response after retries")
|
||||||
|
|
||||||
@ -141,6 +143,8 @@ class GameEngine:
|
|||||||
if attempt < MAX_RETRIES:
|
if attempt < MAX_RETRIES:
|
||||||
feedback = "The narrative is nearly identical to the previous turn. Generate something new and different."
|
feedback = "The narrative is nearly identical to the previous turn. Generate something new and different."
|
||||||
state.append_llm_log(f"\n[TURN REGENERATE] (duplicate) attempt {attempt + 2}")
|
state.append_llm_log(f"\n[TURN REGENERATE] (duplicate) attempt {attempt + 2}")
|
||||||
|
if on_action:
|
||||||
|
on_action("DM is weaving the tale...")
|
||||||
continue
|
continue
|
||||||
state.append_llm_log(f"\n[TURN DUPLICATE EXCEEDED] cannot generate unique narrative")
|
state.append_llm_log(f"\n[TURN DUPLICATE EXCEEDED] cannot generate unique narrative")
|
||||||
return TurnResult(
|
return TurnResult(
|
||||||
@ -168,6 +172,8 @@ class GameEngine:
|
|||||||
if attempt < MAX_RETRIES:
|
if attempt < MAX_RETRIES:
|
||||||
feedback = "The validation system could not process the previous turn. Please regenerate."
|
feedback = "The validation system could not process the previous turn. Please regenerate."
|
||||||
state.append_llm_log(f"\n[TURN REGENERATE] (unrecognized) attempt {attempt + 2}")
|
state.append_llm_log(f"\n[TURN REGENERATE] (unrecognized) attempt {attempt + 2}")
|
||||||
|
if on_action:
|
||||||
|
on_action("DM is consulting the fates...")
|
||||||
continue
|
continue
|
||||||
state.append_llm_log(f"\n[TURN UNRECOGNIZED] cannot validate turn")
|
state.append_llm_log(f"\n[TURN UNRECOGNIZED] cannot validate turn")
|
||||||
return TurnResult(
|
return TurnResult(
|
||||||
@ -186,6 +192,8 @@ class GameEngine:
|
|||||||
validator_tool = json.dumps({"tool": "validate", "args": {"valid": False, "reason": reason, "action": "regenerate"}})
|
validator_tool = json.dumps({"tool": "validate", "args": {"valid": False, "reason": reason, "action": "regenerate"}})
|
||||||
feedback = f"The validation tool returned:\n```tool\n{validator_tool}\n```\n\nPlease regenerate the turn addressing the issues above. Keep the same player action but fix the problems described."
|
feedback = f"The validation tool returned:\n```tool\n{validator_tool}\n```\n\nPlease regenerate the turn addressing the issues above. Keep the same player action but fix the problems described."
|
||||||
state.append_llm_log(f"\n[TURN REGENERATE] attempt {attempt + 2}: {reason}")
|
state.append_llm_log(f"\n[TURN REGENERATE] attempt {attempt + 2}: {reason}")
|
||||||
|
if on_action:
|
||||||
|
on_action("DM is searching for inspiration...")
|
||||||
continue
|
continue
|
||||||
else:
|
else:
|
||||||
state.append_llm_log(f"\n[TURN REGENERATE EXCEEDED] accepting despite: {reason}")
|
state.append_llm_log(f"\n[TURN REGENERATE EXCEEDED] accepting despite: {reason}")
|
||||||
|
|||||||
@ -1,6 +1,7 @@
|
|||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
from textual.widgets import Static
|
from textual.widgets import Static
|
||||||
|
from rich.markdown import Markdown as RichMarkdown
|
||||||
|
|
||||||
from run_utils import (
|
from run_utils import (
|
||||||
CHAR_PATH, TODAY, REFRESH_SECS,
|
CHAR_PATH, TODAY, REFRESH_SECS,
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user