Kaynağa Gözat

feat:修改保留的历史prompt

zhaohaipeng 1 ay önce
ebeveyn
işleme
5f0f8293b3
1 değiştirilmiş dosya ile 1 ekleme ve 1 silme
  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]