Tim Luka Horstmann
commited on
Commit
·
1817d6e
1
Parent(s):
f18ae9b
Fix station guide persona in normal chat
Browse files
app.py
CHANGED
|
@@ -344,7 +344,9 @@ async def stream_response_gemini(query, history, game_context=None, mode: Option
|
|
| 344 |
# 1) Build your system prompt once
|
| 345 |
current_date = datetime.now().strftime("%Y-%m-%d")
|
| 346 |
game_context_text = _format_game_context_for_prompt(game_context)
|
| 347 |
-
|
|
|
|
|
|
|
| 348 |
if is_game_mode:
|
| 349 |
system_prompt = (
|
| 350 |
"You are Tim Luka Horstmann as a friendly in-game 'Station Guide'. "
|
|
@@ -432,7 +434,9 @@ async def stream_response_local(query, history, game_context=None, mode: Optiona
|
|
| 432 |
current_date = datetime.now().strftime("%Y-%m-%d")
|
| 433 |
|
| 434 |
game_context_text = _format_game_context_for_prompt(game_context)
|
| 435 |
-
|
|
|
|
|
|
|
| 436 |
if is_game_mode:
|
| 437 |
system_prompt = (
|
| 438 |
"/no_think You are Tim Luka Horstmann as a friendly in-game 'Station Guide'. "
|
|
@@ -531,8 +535,8 @@ async def predict(request: Request, query_request: QueryRequest):
|
|
| 531 |
history = query_request.history
|
| 532 |
game_context = query_request.game_context
|
| 533 |
mode = (query_request.mode or '').lower() or None
|
| 534 |
-
# Attach optional game_memory
|
| 535 |
-
if query_request.game_memory is not None:
|
| 536 |
if isinstance(game_context, dict):
|
| 537 |
game_context = dict(game_context)
|
| 538 |
game_context['__memory'] = query_request.game_memory
|
|
|
|
| 344 |
# 1) Build your system prompt once
|
| 345 |
current_date = datetime.now().strftime("%Y-%m-%d")
|
| 346 |
game_context_text = _format_game_context_for_prompt(game_context)
|
| 347 |
+
# Only enable game persona when explicitly requested via mode=='game'.
|
| 348 |
+
# Do NOT infer game mode from presence of game_context or memory alone.
|
| 349 |
+
is_game_mode = (mode == 'game')
|
| 350 |
if is_game_mode:
|
| 351 |
system_prompt = (
|
| 352 |
"You are Tim Luka Horstmann as a friendly in-game 'Station Guide'. "
|
|
|
|
| 434 |
current_date = datetime.now().strftime("%Y-%m-%d")
|
| 435 |
|
| 436 |
game_context_text = _format_game_context_for_prompt(game_context)
|
| 437 |
+
# Only enable game persona when explicitly requested via mode=='game'.
|
| 438 |
+
# Do NOT infer game mode from presence of game_context or memory alone.
|
| 439 |
+
is_game_mode = (mode == 'game')
|
| 440 |
if is_game_mode:
|
| 441 |
system_prompt = (
|
| 442 |
"/no_think You are Tim Luka Horstmann as a friendly in-game 'Station Guide'. "
|
|
|
|
| 535 |
history = query_request.history
|
| 536 |
game_context = query_request.game_context
|
| 537 |
mode = (query_request.mode or '').lower() or None
|
| 538 |
+
# Attach optional game_memory only when in explicit game mode
|
| 539 |
+
if (mode == 'game') and (query_request.game_memory is not None):
|
| 540 |
if isinstance(game_context, dict):
|
| 541 |
game_context = dict(game_context)
|
| 542 |
game_context['__memory'] = query_request.game_memory
|