소스 검색

feat:修改保留的历史prompt

zhaohaipeng 1 개월 전
부모
커밋
163085724d
1개의 변경된 파일1개의 추가작업 그리고 1개의 파일을 삭제
  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)
             yield GenerateResponse(action="sample", codes=codes, text=batch_text)
 
 
-            MAX_HISTORY_TURNS = 2  # 只保留最近 2 轮 user/assistant
+            MAX_HISTORY_TURNS = 1  # 只保留最近 2 轮 user/assistant
             assistant_indices = [i for i, m in enumerate(conversation.messages) if m.role == "assistant"]
             assistant_indices = [i for i, m in enumerate(conversation.messages) if m.role == "assistant"]
             if len(assistant_indices) > MAX_HISTORY_TURNS:
             if len(assistant_indices) > MAX_HISTORY_TURNS:
                 drop = assistant_indices[0]
                 drop = assistant_indices[0]