Selaa lähdekoodia

feat:修改保留的历史prompt

zhaohaipeng 1 kuukausi sitten
vanhempi
commit
5f0f8293b3
1 muutettua tiedostoa jossa 1 lisäystä ja 1 poistoa
  1. 1 1
      fish_speech/models/text2semantic/inference.py

+ 1 - 1
fish_speech/models/text2semantic/inference.py

@@ -870,7 +870,7 @@ def generate_long(
 
             yield GenerateResponse(action="sample", codes=codes, text=batch_text)
 
-            MAX_HISTORY_TURNS = 1  # 只保留最近 2 轮 user/assistant
+            MAX_HISTORY_TURNS = 2  # 只保留最近 2 轮 user/assistant
             assistant_indices = [i for i, m in enumerate(conversation.messages) if m.role == "assistant"]
             if len(assistant_indices) > MAX_HISTORY_TURNS:
                 drop = assistant_indices[0]