-
Notifications
You must be signed in to change notification settings - Fork 302
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
Fetch standard prompts from remote prompts API #6150
Conversation
first?: number | ||
signal?: AbortSignal | ||
}): Promise<Prompt[]> { | ||
const response = await this.fetchSourcegraphAPI<APIResponse<{ prompts: { nodes: Prompt[] } }>>( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we should check the siteVersion
here to make sure the builtinOnly
param is available.
Also why are we calling BuiltinOnly
prompts standard
prompts here? It gets confusion having different names for the same thing at different parts of the code.
Secondly the STANDARD_PROMPTS_QUERY
isn't event accepting the builtinOnly
argument. Its hard coded in the query.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we should check the siteVersion here to make sure the builtinOnly param is available.
I do this version check in mergedPromptsAndLegacyCommands
because this is how I check if we should fetch remote/built-in prompts or if we should use local (prompts-like) commands. So another check here won't be nessesary.
Secondly, the STANDARD_PROMPTS_QUERY isn't even accepting the builtinOnly argument. It's hardcoded in the query.
Yes, I couldn't change the original prompts query because it requires another version check, and we already have two versions of this query. So I created another one only for built-in prompts.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@thenamankumar I fixed naming issues, ready for the second round
first?: number | ||
signal?: AbortSignal | ||
}): Promise<Prompt[]> { | ||
const response = await this.fetchSourcegraphAPI<APIResponse<{ prompts: { nodes: Prompt[] } }>>( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we should check the siteVersion here to make sure the builtinOnly param is available.
I do this version check in mergedPromptsAndLegacyCommands
because this is how I check if we should fetch remote/built-in prompts or if we should use local (prompts-like) commands. So another check here won't be nessesary.
Secondly, the STANDARD_PROMPTS_QUERY isn't even accepting the builtinOnly argument. It's hardcoded in the query.
Yes, I couldn't change the original prompts query because it requires another version check, and we already have two versions of this query. So I created another one only for built-in prompts.
4a40ea8
to
940eaa9
Compare
The backport to
To backport this PR manually, you can either: Via the sg toolUse the sg backport -r v1.46.x -p 6150 Via your terminalTo backport manually, run these commands in your terminal: # Fetch latest updates from GitHub
git fetch
# Create a new working tree
git worktree add .worktrees/backport-v1.46.x v1.46.x
# Navigate to the new working tree
cd .worktrees/backport-v1.46.x
# Create a new branch
git switch --create backport-6150-to-v1.46.x
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick -x --mainline 1 224ef27ccec297988b45fb0f769188ef4fb6ab1b
# Push it to GitHub
git push --set-upstream origin backport-6150-to-v1.46.x
# Go back to the original working tree
cd ../..
# Delete the working tree
git worktree remove .worktrees/backport-v1.46.x If you encouter conflict, first resolve the conflict and stage all files, then run the commands below: git cherry-pick --continue
# Push it to GitHub
git push --set-upstream origin backport-6150-to-v1.46.x
# Go back to the original working tree
cd ../..
# Delete the working tree
git worktree remove .worktrees/backport-v1.46.x
Once the pull request has been created, please ensure the following:
|
The backport to
To backport this PR manually, you can either: Via the sg toolUse the sg backport -r vscode-v1.46.x -p 6150 Via your terminalTo backport manually, run these commands in your terminal: # Fetch latest updates from GitHub
git fetch
# Create a new working tree
git worktree add .worktrees/backport-vscode-v1.46.x vscode-v1.46.x
# Navigate to the new working tree
cd .worktrees/backport-vscode-v1.46.x
# Create a new branch
git switch --create backport-6150-to-vscode-v1.46.x
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick -x --mainline 1 224ef27ccec297988b45fb0f769188ef4fb6ab1b
# Push it to GitHub
git push --set-upstream origin backport-6150-to-vscode-v1.46.x
# Go back to the original working tree
cd ../..
# Delete the working tree
git worktree remove .worktrees/backport-vscode-v1.46.x If you encouter conflict, first resolve the conflict and stage all files, then run the commands below: git cherry-pick --continue
# Push it to GitHub
git push --set-upstream origin backport-6150-to-vscode-v1.46.x
# Go back to the original working tree
cd ../..
# Delete the working tree
git worktree remove .worktrees/backport-vscode-v1.46.x
Once the pull request has been created, please ensure the following:
|
…API (#6166) Part of [SRCH-1181](https://linear.app/sourcegraph/issue/SRCH-1181/pre-load-single-tenant-instances-to-have-ootb-prompts) This PR checks the SG version and tries to fetch built-in prompts from the prompt library rather than using local hardcoded commands. Later prompts query will be unified and all custom/built-in prompts will be fetched with one query ## Test plan - Check after https://linear.app/sourcegraph/issue/SRCH-1316/create-seeder-for-ootm-prompts is done that the VSCode extension renders built-in prompts in the welcome area and prompts tabs <br> Backport 224ef27 from #6150 Co-authored-by: Vova Kulikov <vova@sourcegraph.com>
Part of SRCH-1181
This PR checks the SG version and tries to fetch built-in prompts from the prompt library rather than using local hardcoded commands. Later prompts query will be unified and all custom/built-in prompts will be fetched with one query
Test plan