我想在openai-java的github仓库中提交一个issue,请帮我将以下内容润色后翻译成英文: 标题:尝试关闭服务时出现“executorService must be…
- User
我想在openai-java的github仓库中提交一个issue,请帮我将以下内容润色后翻译成英文: 标题:尝试关闭服务时出现“executorService must be set in order to shut down”错误 内容: 我参考了openai-java项目的example代码中关于stream部分的内容,尝试对openai-java进行二次封装,想要实现一个简单的stream式chat。以下是我的代码:
SimpleGPTClient.java:
【此处不需要翻译】程序运行时,GPT的响应内容会逐一打印出来。但是在响应结束后,会产生错误信息:
【此处不需要翻译】问题出在
openAiService.shutdownExecutor();上。如果去掉这句代码,程序会正确结束,但是要等60秒,这不是我想要的。 - Assistant
Title: "executorService must be set in order to shut down" error when attempting to close the service
Content: I have been referencing the stream section of the openai-java example code and attempting to perform secondary wrapping on the project. I want to implement a simple stream-style chat. Below is my code:
SimpleGPTClient.java:
[No translation needed]When the program runs, the response from GPT will be printed out one by one. However, after the response is complete, an error message will be generated:
[No translation needed]The issue is with the
openAiService.shutdownExecutor()code. If I remove this line of code, the program will end correctly, but it takes 60 seconds, which is not what I want.
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.