Doiiars
Committed by BaiFu

修复流式传输重试问题

@@ -83,7 +83,6 @@ class LLMClient: @@ -83,7 +83,6 @@ class LLMClient:
83 return self.validate_response(response.choices[0].message.content) 83 return self.validate_response(response.choices[0].message.content)
84 return "" 84 return ""
85 85
86 - @with_retry(LLM_RETRY_CONFIG)  
87 def stream_invoke(self, system_prompt: str, user_prompt: str, **kwargs) -> Generator[str, None, None]: 86 def stream_invoke(self, system_prompt: str, user_prompt: str, **kwargs) -> Generator[str, None, None]:
88 """ 87 """
89 流式调用LLM,逐步返回响应内容 88 流式调用LLM,逐步返回响应内容
@@ -131,6 +130,7 @@ class LLMClient: @@ -131,6 +130,7 @@ class LLMClient:
131 logger.error(f"流式请求失败: {str(e)}") 130 logger.error(f"流式请求失败: {str(e)}")
132 raise e 131 raise e
133 132
  133 + @with_retry(LLM_RETRY_CONFIG)
134 def stream_invoke_to_string(self, system_prompt: str, user_prompt: str, **kwargs) -> str: 134 def stream_invoke_to_string(self, system_prompt: str, user_prompt: str, **kwargs) -> str:
135 """ 135 """
136 流式调用LLM并安全地拼接为完整字符串(避免UTF-8多字节字符截断) 136 流式调用LLM并安全地拼接为完整字符串(避免UTF-8多字节字符截断)
@@ -86,7 +86,6 @@ class LLMClient: @@ -86,7 +86,6 @@ class LLMClient:
86 return self.validate_response(response.choices[0].message.content) 86 return self.validate_response(response.choices[0].message.content)
87 return "" 87 return ""
88 88
89 - @with_retry(LLM_RETRY_CONFIG)  
90 def stream_invoke(self, system_prompt: str, user_prompt: str, **kwargs) -> Generator[str, None, None]: 89 def stream_invoke(self, system_prompt: str, user_prompt: str, **kwargs) -> Generator[str, None, None]:
91 """ 90 """
92 流式调用LLM,逐步返回响应内容 91 流式调用LLM,逐步返回响应内容
@@ -134,6 +133,7 @@ class LLMClient: @@ -134,6 +133,7 @@ class LLMClient:
134 logger.error(f"流式请求失败: {str(e)}") 133 logger.error(f"流式请求失败: {str(e)}")
135 raise e 134 raise e
136 135
  136 + @with_retry(LLM_RETRY_CONFIG)
137 def stream_invoke_to_string(self, system_prompt: str, user_prompt: str, **kwargs) -> str: 137 def stream_invoke_to_string(self, system_prompt: str, user_prompt: str, **kwargs) -> str:
138 """ 138 """
139 流式调用LLM并安全地拼接为完整字符串(避免UTF-8多字节字符截断) 139 流式调用LLM并安全地拼接为完整字符串(避免UTF-8多字节字符截断)
@@ -83,7 +83,6 @@ class LLMClient: @@ -83,7 +83,6 @@ class LLMClient:
83 return self.validate_response(response.choices[0].message.content) 83 return self.validate_response(response.choices[0].message.content)
84 return "" 84 return ""
85 85
86 - @with_retry(LLM_RETRY_CONFIG)  
87 def stream_invoke(self, system_prompt: str, user_prompt: str, **kwargs) -> Generator[str, None, None]: 86 def stream_invoke(self, system_prompt: str, user_prompt: str, **kwargs) -> Generator[str, None, None]:
88 """ 87 """
89 流式调用LLM,逐步返回响应内容 88 流式调用LLM,逐步返回响应内容
@@ -131,6 +130,7 @@ class LLMClient: @@ -131,6 +130,7 @@ class LLMClient:
131 logger.error(f"流式请求失败: {str(e)}") 130 logger.error(f"流式请求失败: {str(e)}")
132 raise e 131 raise e
133 132
  133 + @with_retry(LLM_RETRY_CONFIG)
134 def stream_invoke_to_string(self, system_prompt: str, user_prompt: str, **kwargs) -> str: 134 def stream_invoke_to_string(self, system_prompt: str, user_prompt: str, **kwargs) -> str:
135 """ 135 """
136 流式调用LLM并安全地拼接为完整字符串(避免UTF-8多字节字符截断) 136 流式调用LLM并安全地拼接为完整字符串(避免UTF-8多字节字符截断)
@@ -76,7 +76,6 @@ class LLMClient: @@ -76,7 +76,6 @@ class LLMClient:
76 return self.validate_response(response.choices[0].message.content) 76 return self.validate_response(response.choices[0].message.content)
77 return "" 77 return ""
78 78
79 - @with_retry(LLM_RETRY_CONFIG)  
80 def stream_invoke(self, system_prompt: str, user_prompt: str, **kwargs) -> Generator[str, None, None]: 79 def stream_invoke(self, system_prompt: str, user_prompt: str, **kwargs) -> Generator[str, None, None]:
81 """ 80 """
82 流式调用LLM,逐步返回响应内容 81 流式调用LLM,逐步返回响应内容
@@ -118,6 +117,7 @@ class LLMClient: @@ -118,6 +117,7 @@ class LLMClient:
118 logger.error(f"流式请求失败: {str(e)}") 117 logger.error(f"流式请求失败: {str(e)}")
119 raise e 118 raise e
120 119
  120 + @with_retry(LLM_RETRY_CONFIG)
121 def stream_invoke_to_string(self, system_prompt: str, user_prompt: str, **kwargs) -> str: 121 def stream_invoke_to_string(self, system_prompt: str, user_prompt: str, **kwargs) -> str:
122 """ 122 """
123 流式调用LLM并安全地拼接为完整字符串(避免UTF-8多字节字符截断) 123 流式调用LLM并安全地拼接为完整字符串(避免UTF-8多字节字符截断)