sirochild commited on
Commit
529d749
·
verified ·
1 Parent(s): 1f20e09

Upload app.py

Browse files
Files changed (1) hide show
  1. app.py +21 -2
app.py CHANGED
@@ -125,8 +125,27 @@ def respond(message, chat_history, affection, scene_params, limiter_state):
125
  else:
126
  # シーン検出ロジック (APIを1回消費)
127
  history_text_for_detect = "\n".join([f"ユーザー: {u}\n麻理: {m}" for u, m in internal_history[-3:]])
128
- detect_prompt = f'...' # (省略)
129
- detect_system_prompt = '...' # (省略)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
130
  new_scene_name_json = call_llm(detect_system_prompt, detect_prompt, is_json_output=True)
131
  new_scene_name = None
132
  if new_scene_name_json:
 
125
  else:
126
  # シーン検出ロジック (APIを1回消費)
127
  history_text_for_detect = "\n".join([f"ユーザー: {u}\n麻理: {m}" for u, m in internal_history[-3:]])
128
+ detect_prompt = f"""以下はユーザーとキャラクターの最近の会話です:
129
+
130
+ {history_text_for_detect}
131
+
132
+ この会話において、場所の移動やシーンの変化が含まれているかを判断してください。
133
+ もし変化があれば、新しいシーンのキーワード(例: 'beach_sunset', 'shrine_day')を返してください。
134
+ 変化がなければ "none" を返してください。
135
+
136
+ 出力形式は必ず次のようにしてください:
137
+ {{"scene": "shrine_day"}} または {{"scene": "none"}}""" # (省略)
138
+ detect_system_prompt = f"""あなたは会話の内容から、現在のシーンが変わるかどうかを判定するシステムです。
139
+ 以下の会話履歴に基づいて、ユーザーとキャラクターが移動した「新しいシーン」があれば、その名前をJSON形式で返してください。
140
+ 変化がない場合は、"none" を scene に設定してください。
141
+
142
+ フォーマット:
143
+ {"scene": "beach_sunset"}
144
+
145
+ 制約:
146
+ - JSONオブジェクト以外は絶対に出力しないでください。
147
+ - "true", "false", "yes", "no" など単語だけを出力しないでください。' # (省略)
148
+ """
149
  new_scene_name_json = call_llm(detect_system_prompt, detect_prompt, is_json_output=True)
150
  new_scene_name = None
151
  if new_scene_name_json: