Aias00 opened a new issue, #815:
URL: https://github.com/apache/rocketmq-dashboard/issues/815

   ### Bug Description
   The AI chat API exposes and sends `conversationId`, but the backend 
currently treats each chat request as a single-turn prompt.
   
   Evidence:
   - `web/src/api/ai.ts` defines `AiChatRequest.conversationId`.
   - `web/src/pages/ai/index.tsx` sends `conversationId` when calling 
`/api/ai/chat`.
   - `server/src/main/java/org/apache/rocketmq/studio/ops/ai/ChatDTO.java` 
accepts `conversationId`.
   - `OpenAiCompatibleLlmGateway.streamChat` forwards only 
`request.getMessage()` to `OpenAiCompatibleLlmClient.stream(...)`.
   - `OpenAiCompatibleLlmClient.requestBody(...)` builds a messages array with 
only the current user message.
   
   As a result, users can stay in the same visible conversation, but the LLM 
receives no previous turns, so follow-up questions lose context.
   
   ### Expected Behavior
   Requests with the same `conversationId` should include recent conversation 
history when building the LLM chat completion request. The history should be 
bounded so it does not grow unbounded in memory or token usage.
   
   ### Actual Behavior
   `conversationId` is logged but not used. Every chat request is sent as a 
fresh one-message completion request.
   
   ### Minimal Fix Direction
   Add a small bounded conversation memory for AI chat:
   - keep recent user/assistant turns per `conversationId`;
   - include the retained turns in the OpenAI-compatible `messages` payload;
   - append streamed assistant output after successful completion;
   - fall back to single-turn behavior when `conversationId` is blank.
   
   ### Contest Scope
   Track 3 / AI Native: Console embedded LLM chat should behave like a real 
conversation entry point, not a stateless prompt box.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to