agentscope-ai / agentscope-ai/agentscope-java

[Bug]: AGUI protocol fails to correctly serialize LLM responses when using OllamaChatModel

未關閉
#708 0 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視
area/ext/integration bug
主要語言
Java
星號
5.6k
分支
1.3k
平均合併
4 天 12 小時
30 天內合併 PR
77

描述

**Describe the bug**
When using the official AGUI example with `OllamaChatModel`, calling the `/agui/run` endpoint returns an error response: `messageId cannot be null`.

Image

**To Reproduce**
For easier debugging and to inspect raw requests/responses, I modified the `stream` parameter in the `streamWithHttpClient` call inside `OllamaChatModel` from `true` to `false`. Specifically, in the `doStream` method:

```java
@Override
protected Flux doStream(
List messages, List tools, GenerateOptions options) {
return streamWithHttpClient(
messages,
tools,
options.getToolChoice(),
OllamaOptions.fromGenerateOptions(options),
false);
}
```

When sending a request as per the example, debugging shows that the raw response from Ollama **does not contain an `id` field**:

Image

As a result, `AguiEvent` fails to extract a `messageId`, causing the client-side to throw an error:

Image

Image

**Expected behavior**
The system should return the LLM’s response content successfully.

Image

**Environment**

- AgentScope-Java Version: 1.0.8
- Java Version: 17
- OS: windows

**Additional context**
When using `OpenAIChatModel` under identical conditions, everything works as expected.

In contrast, when using `JdkHttpTransport` with OpenAI, the actual HTTP response **does include an `id` field**:

Image

Thus, `AguiEvent` correctly obtains the `messageId`, and the client receives the expected response:

Image

Image

貢獻指南

開啟貢獻指南

評估

這個 Issue 還沒有評估資料。

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。