AI Chat - Content gets thrown away after response streaming finishes #2717
Glenn D. opened 3 months ago

Hey everyone,

I just started experimenting with the AI Chat feature. I connected OneDev with OpenWebUI (with Ollama in the background) using the model ministral-3:14b.

I can ask my AI-user-buddy about my code, and it will provide me with an extensive answer with examples and everything, which is really great. However, I can see it streaming a really long response, and then when it's done, the chat window seems to refresh, and only a subset of information is left in the chat window.

This is a screenshot from when it was still streaming a response (watch the scrollbar):

image.png

Then after it's done streaming, the chat refreshes, and I'm left with this (again, watch the scrollbar and the content of the "final" section):

image_2.png

I'm not quite sure why I'm losing so much information or why the final content isn't the same as the streamed content.

Any ideas on why this might be happening?

  • Robin Shen commented 3 months ago

    It is normal that the final response generated by AI is different. It might be a summary over previous ongoing thoughts.

  • Robin Shen commented 3 months ago

    The final response is created by forcing AI to call a taskComplete tool, as otherwise AI bots may give up prematurely generating incomplete response.

  • Glenn D. commented 3 months ago

    @robin

    Thanks for the feedback. Is there a way to prevent the deletion of the previous feedback? I may be able to determine if it is "thinking" that is being generated at first, but I doubt it to be honest. There is a lot of useful information in the response that now disapears.

  • Glenn D. commented 3 months ago

    When I specifically instruct the AI user to not call taskComplete everything stays put

  • Robin Shen commented 3 months ago

    Maybe I can compare response length to determine which response should be used. But I doubt this also creates issues for other situations...

  • Glenn D. commented 3 months ago

    Maybe just being able to prevent the call to "taskComplete" might already be enough?

  • Robin Shen commented 3 months ago

    Without this, many models will just give up too early with empty or partial response. This is the reason why taskComplete tool call is added in the first place.

  • Robin Shen changed fields 3 months ago
    Name Previous Value Current Value
    Type
    Bug
    Question
  • Glenn D. commented 3 months ago

    I understand that. I was thinking along the lines of a checkbox in the AI settings that enables/disables the "taskComplete" method.

    But it doesn't really matter. If I explicitly disallow the taskComplete call it works fine, so I have a workaround.

  • Robin Shen changed fields 2 months ago
    Name Previous Value Current Value
    Type
    Question
    Improvement
  • Robin Shen changed fields 2 months ago
    Name Previous Value Current Value
    Type
    Improvement
    Bug
  • jbauer commented 2 months ago

    @robin Looking at the code in OneDev and imagining the final prompt the model receives it could actually think that the taskComplete() tool should be called with a summary of what has been generated before (= "provide your final answer using taskComplete tool"). I am also using Mistral and I regularly see the good content being thrown away and only a summary of that content is shown as final answer. In my experience smaller models need very explicit prompts otherwise they "guess" wrong.

    Also in PRs when adding AI with mistral as reviewer an "empty response" message is added as comment which indicates the model has called taskComplete() but didn't provide data. Maybe the streaming result before did had that data but only the taskComplete() tool call got an empty string.

  • Robin Shen commented 2 months ago

    LLM does tend to summarize previous responses when calling taskComplete tool. Will remove this tool and use the response instead. When getting empty response, telling LLM to retry seems able to solve most of the issues.

  • OneDev commented 2 months ago

    State changed as build OD-7256 (15.0.0) is successful

  • OneDev changed state to 'Closed' 2 months ago
    Previous Value Current Value
    Open
    Closed
1/1
Type
Bug
Priority
Normal
Assignee
Affected Versions
14.1.7
Labels
No labels
Issue Votes (0)
Watchers (4)
Reference
OD-2717
Please wait...
Connection lost or session expired, reload to recover
Page is in error, reload to recover