mirror of
				https://gitee.com/hhyykk/ipms-sjy.git
				synced 2025-10-31 10:18:42 +08:00 
			
		
		
		
	【todo】百度文言一心,解决 todo,删除 doOnComplete、增加 retryTemplate
This commit is contained in:
		| @@ -85,22 +85,20 @@ public class YiYanChatClient implements ChatClient, StreamingChatClient { | |||||||
|     @Override |     @Override | ||||||
|     public Flux<ChatResponse> stream(Prompt prompt) { |     public Flux<ChatResponse> stream(Prompt prompt) { | ||||||
|         YiYanChatCompletionRequest request = this.createRequest(prompt, true); |         YiYanChatCompletionRequest request = this.createRequest(prompt, true); | ||||||
|         // TODO @fan:return this.retryTemplate.execute(ctx -> { |         // TODO done @fan:return this.retryTemplate.execute(ctx -> { | ||||||
|  |         return retryTemplate.execute(ctx -> { | ||||||
|             // 调用 callWithFunctionSupport 发送请求 |             // 调用 callWithFunctionSupport 发送请求 | ||||||
|             Flux<YiYanChatCompletionResponse> response = this.yiYanApi.chatCompletionStream(request); |             Flux<YiYanChatCompletionResponse> response = this.yiYanApi.chatCompletionStream(request); | ||||||
|         // TODO @fan:下面的 doOnComplete 是不是可以删除哈? |  | ||||||
|         response.doOnComplete(new Runnable() { |  | ||||||
|             @Override |  | ||||||
|             public void run() { |  | ||||||
|                 String a = ";"; |  | ||||||
|             } |  | ||||||
|         }); |  | ||||||
|             return response.map(chunk -> { |             return response.map(chunk -> { | ||||||
|  | //                System.err.println("---".concat(chunk.getResult())); | ||||||
|                 // TODO @fan:ChatResponseMetadata chatResponseMetadata |                 // TODO @fan:ChatResponseMetadata chatResponseMetadata | ||||||
|                 return new ChatResponse(List.of(new Generation(chunk.getResult()))); |                 return new ChatResponse(List.of(new Generation(chunk.getResult()))); | ||||||
|             }); |             }); | ||||||
|  |         }); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|     private YiYanChatCompletionRequest createRequest(Prompt prompt, boolean stream) { |     private YiYanChatCompletionRequest createRequest(Prompt prompt, boolean stream) { | ||||||
|         // 参考 https://cloud.baidu.com/doc/WENXINWORKSHOP/s/clntwmv7t 文档,system 是独立字段 |         // 参考 https://cloud.baidu.com/doc/WENXINWORKSHOP/s/clntwmv7t 文档,system 是独立字段 | ||||||
|         // 1.1 获取 user 和 assistant |         // 1.1 获取 user 和 assistant | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 cherishsince
					cherishsince