Skip to content

Fix index used by LocalDocs when tool calling/thinking is active #3451

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Feb 3, 2025

Conversation

cebtenzzre
Copy link
Member

@cebtenzzre cebtenzzre commented Feb 1, 2025

Fixes #3445

When using tool calling or reasoning (e.g. DeepSeek) and LocalDocs, the second response would be an error like this:

Error: item at index 3 is not a prompt

Which is accurate—the item at (global) index 3 is the about-to-be-generated response, not a prompt.

This was caused by using the index in the flattened list instead of the index of the parent ChatItem in its container. The cleanest solution is to just store the index of the original ChatItem parent in the MessageItem, so we don't have to try and look it up later. This simplifies the query prompt lookup, removing the startOffset addition (since the index is now saved before we slice the list for the local server).

I have tested and confirmed that it now uses the expected peer index of 2.

Signed-off-by: Jared Van Bortel <[email protected]>
Signed-off-by: Jared Van Bortel <[email protected]>
@cebtenzzre cebtenzzre marked this pull request as ready for review February 1, 2025 00:17
@cebtenzzre cebtenzzre merged commit 9131f4c into main Feb 3, 2025
4 of 12 checks passed
@cebtenzzre cebtenzzre deleted the fix-localdocs-index branch February 3, 2025 16:22
cgivre pushed a commit to cgivre/gpt4all that referenced this pull request Feb 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

LocalDocs error 'item at index 3 is not a prompt' with all models in the reasoning tab.
3 participants