coze-dev / coze-dev/coze-java

chat().createAndPoll()执行完成之后程序不会结束

Open
#121 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
214
Forks
97
PR merge metrics
No merged PRs in 30d

Description

chat().createAndPoll()执行完成之后程序不会结束。程序一直挂在那,貌似有什么线程卡住了。
`
public static void main(String[] args) throws Exception {
String cozeAPIToken = "cozeAPIToken";
String cozeAPIBase = Consts.COZE_CN_BASE_URL;
CozeAPI coze = new CozeAPI.Builder().auth(new TokenAuth(cozeAPIToken)).baseURL(cozeAPIBase).build();

CreateChatReq req =
CreateChatReq.builder()
.botID("botID")
.userID("123")
.messages(Collections.singletonList(Message.buildUserQuestionText("翻译\"你好,世界!\"")))
.build();
ChatPoll chat2 = coze.chat().createAndPoll(req, 3000L);
System.out.println(chat2.getMessages().get(0).getContent());
coze.shutdownExecutor();

}
`

![Image](https://github.com/user-attachments/assets/1b195339-11b3-4cb9-a55d-2c325b6b8197)

Contributor guide

Open the contributing guide

Research direction

Start by running the supplied Java main example with chat().createAndPoll(req, 3000L), then inspect the lifecycle around createAndPoll and coze.shutdownExecutor(). Confirm whether the process remains alive after the response is printed and define done as the program exiting cleanly after polling completes.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
api
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
32/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.