Skip to content
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

feat(chat): automatically pick the collection if there exists only one in the database VSCODE-610 #863

Open
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

gagik
Copy link

@gagik gagik commented Nov 1, 2024

In interest of keeping PRs for VSCODE-610 easier to review since it mentions 3-4 new behaviors, I am splitting them into different parts. This handles the case where there is only 1 collection in the database, so we'd want to pick that instead of prompting the user.

Description

Checklist

Motivation and Context

  • Bugfix
  • New feature
  • Dependency update
  • Misc

Open Questions

Dependents

Types of changes

  • Backport Needed
  • Patch (non-breaking change which fixes an issue)
  • Minor (non-breaking change which adds functionality)
  • Major (fix or feature that would cause existing functionality to change)

@gagik gagik changed the title WIP: one or no collection handling feat(participant): automatically pick the collection if there exists only one in the database. Nov 1, 2024
@gagik gagik changed the title feat(participant): automatically pick the collection if there exists only one in the database. feat(participant): automatically pick the collection if there exists only one in the database VSCODE-610 Nov 1, 2024
@gagik gagik changed the title feat(participant): automatically pick the collection if there exists only one in the database VSCODE-610 feat(chat): automatically pick the collection if there exists only one in the database VSCODE-610 Nov 1, 2024
@gagik gagik marked this pull request as ready for review November 1, 2024 14:29
log.error('Unable to fetch collections:', error);

// Users can always do this manually when asked to provide a collection name.
return;
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not sure what "this" is referring to here so I am not sure if there's something more to this but the behavior should be largely same with _getCollections, I just didn't transfer the comment over as I didn't understand it.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The comment here was alluding to if we can't fetch the collection names then a user can still input it by typing. It could definitely have been a bit more descriptive. I think that's why we're silently returning here instead of throwing an error.

const chatId = ChatMetadataStore.getChatIdFromHistoryOrNewChatId(
context.history
);
this._chatMetadataStore.setChatMetadata(chatId, {
Copy link
Author

@gagik gagik Nov 1, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this make sense to do? If I understand right this means this will effectively cache it but I haven't tested it yet, will soon.

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.

2 participants