-
Notifications
You must be signed in to change notification settings - Fork 2.5k
feat: Add compact prompt mode for local LLMs #7551
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2242,6 +2242,11 @@ export class Task extends EventEmitter<TaskEvents> implements TaskLike { | |
| apiConfiguration, | ||
| } = state ?? {} | ||
|
|
||
| // Check if we should use compact prompt mode for local LLM providers | ||
| const isLocalLLMProvider = | ||
| this.apiConfiguration.apiProvider === "lmstudio" || this.apiConfiguration.apiProvider === "ollama" | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The compact prompt check happens on every You could store the result of this check as a class property when the task is initialized. |
||
| const shouldUseCompactPrompt = isLocalLLMProvider && this.apiConfiguration.compactPromptMode | ||
|
|
||
| return await (async () => { | ||
| const provider = this.providerRef.deref() | ||
|
|
||
|
|
@@ -2276,6 +2281,7 @@ export class Task extends EventEmitter<TaskEvents> implements TaskLike { | |
| }, | ||
| undefined, // todoList | ||
| this.api.getModel().id, | ||
| shouldUseCompactPrompt, | ||
| ) | ||
| })() | ||
| } | ||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,44 @@ | ||||||||||||||
| import React from "react" | ||||||||||||||
| import { useAppTranslation } from "@src/i18n/TranslationContext" | ||||||||||||||
|
|
||||||||||||||
| interface CompactPromptControlProps { | ||||||||||||||
| compactPromptMode?: boolean | ||||||||||||||
| onChange: (value: boolean) => void | ||||||||||||||
| providerName?: string | ||||||||||||||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. For better type safety, consider using a union type for
Suggested change
|
||||||||||||||
| } | ||||||||||||||
|
|
||||||||||||||
| export const CompactPromptControl: React.FC<CompactPromptControlProps> = ({ | ||||||||||||||
| compactPromptMode = false, | ||||||||||||||
| onChange, | ||||||||||||||
| providerName, | ||||||||||||||
| }) => { | ||||||||||||||
| const { t } = useAppTranslation() | ||||||||||||||
|
|
||||||||||||||
| // Determine the correct translation key prefix based on provider | ||||||||||||||
| const translationPrefix = providerName === "LM Studio" ? "providers.lmStudio" : "providers.ollama" | ||||||||||||||
|
|
||||||||||||||
| return ( | ||||||||||||||
| <div className="flex flex-col gap-2"> | ||||||||||||||
| <div className="flex items-center justify-between"> | ||||||||||||||
| <label htmlFor="compact-prompt-mode" className="font-medium"> | ||||||||||||||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Consider adding a tooltip or help icon to explain the trade-offs of enabling compact mode. Users should understand what features are excluded (MCP, browser tools, modes, etc.) when they enable this option. You could add a small info icon next to the label that shows this information on hover. |
||||||||||||||
| {t(`settings:${translationPrefix}.compactPrompt.title`)} | ||||||||||||||
| </label> | ||||||||||||||
| <input | ||||||||||||||
| id="compact-prompt-mode" | ||||||||||||||
| type="checkbox" | ||||||||||||||
| checked={compactPromptMode} | ||||||||||||||
| onChange={(e) => onChange(e.target.checked)} | ||||||||||||||
| className="cursor-pointer" | ||||||||||||||
| /> | ||||||||||||||
| </div> | ||||||||||||||
| <p className="text-sm text-vscode-descriptionForeground"> | ||||||||||||||
| {t(`settings:${translationPrefix}.compactPrompt.description`)} | ||||||||||||||
| </p> | ||||||||||||||
| {providerName && ( | ||||||||||||||
| <p className="text-xs text-vscode-descriptionForeground italic"> | ||||||||||||||
| {t(`settings:${translationPrefix}.compactPrompt.providerNote`, { provider: providerName })} | ||||||||||||||
| </p> | ||||||||||||||
| )} | ||||||||||||||
| </div> | ||||||||||||||
| ) | ||||||||||||||
| } | ||||||||||||||
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.
Consider adding JSDoc comments here to explain when and why to use compact prompt mode: