agentscope-ai / agentscope-ai/agentscope-java
[Bug]: AGUI protocol fails to correctly serialize LLM responses when using OllamaChatModel
- 主要言語
- Java
- スター
- 5.6k
- フォーク
- 1.3k
- 平均マージ
- 4日 12時間
- マージ済み PR(30日)
- 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`.
**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**:
As a result, `AguiEvent` fails to extract a `messageId`, causing the client-side to throw an error:
**Expected behavior**
The system should return the LLM’s response content successfully.
**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**:
Thus, `AguiEvent` correctly obtains the `messageId`, and the client receives the expected response:
コントリビューションガイド
評価
この issue はまだ評価されていません。