-
Notifications
You must be signed in to change notification settings - Fork 10
feat: support apply_patch for DeepSeek models #37
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
base: main
Are you sure you want to change the base?
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 |
|---|---|---|
|
|
@@ -178,6 +178,7 @@ function hasErrorCode(error: unknown, code: string): boolean { | |
| return Boolean(error && typeof error === "object" && "code" in error && error.code === code); | ||
| } | ||
|
|
||
| const APPLY_PATCH_MODEL_ID_PREFIXES = ["gpt-", "deepseek-"] as const; | ||
| const GPT_APPLY_PATCH_PROVIDERS = new Set(["openai", "openai-codex", "azure-openai-responses", "github-copilot"]); | ||
| const GPT_APPLY_PATCH_APIS = new Set(["openai-responses", "openai-codex-responses"]); | ||
| export const PATCH_PREVIEW_MAX_LINES = 16; | ||
|
|
@@ -338,10 +339,10 @@ eof_line: "*** End of File" LF | |
| %import common.LF | ||
| `; | ||
|
|
||
| export function isOpenAIGptModel( | ||
| model: (Pick<Model<string>, "provider" | "id"> & Partial<Pick<Model<string>, "api">>) | undefined, | ||
| ): boolean { | ||
| if (!model?.id.startsWith("gpt-")) { | ||
| export type ApplyPatchCandidateModel = Pick<Model<string>, "provider" | "id"> & Partial<Pick<Model<string>, "api">>; | ||
|
|
||
| export function isApplyPatchCapableModel(model: ApplyPatchCandidateModel | undefined): boolean { | ||
| if (!model || !APPLY_PATCH_MODEL_ID_PREFIXES.some((prefix) => model.id.startsWith(prefix))) { | ||
|
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.
When a AGENTS.md reference: AGENTS.md:L24-L24 Useful? React with 👍 / 👎.
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. Fixed in 7d910bc: the |
||
| return false; | ||
| } | ||
|
|
||
|
|
@@ -350,6 +351,11 @@ export function isOpenAIGptModel( | |
| ); | ||
| } | ||
|
|
||
| /** @deprecated Use {@link isApplyPatchCapableModel}. */ | ||
| export function isOpenAIGptModel(model: ApplyPatchCandidateModel | undefined): boolean { | ||
| return isApplyPatchCapableModel(model); | ||
| } | ||
|
|
||
| function normalizePatchText(patchText: string): string { | ||
| return patchText.replace(/\r\n/g, "\n").replace(/\r/g, "\n"); | ||
| } | ||
|
|
@@ -1377,7 +1383,7 @@ function syncToolset( | |
| model: Model<string> | undefined, | ||
| ): void { | ||
| const currentToolNames = pi.getActiveTools(); | ||
| if (isOpenAIGptModel(model)) { | ||
| if (isApplyPatchCapableModel(model)) { | ||
| pi.setActiveTools(replaceEditToolsWithApplyPatch(currentToolNames)); | ||
| return; | ||
| } | ||
|
|
||
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.
For every
deepseek-*model using one of the accepted Responses APIs, this prefix makessyncToolsetremovewriteandeditand activateapply_patch, directly violating the repository constraint that the extension only activates for OpenAI GPT-family models. Keep non-GPT models on the standard editing tools unless that repository-wide constraint is intentionally changed.AGENTS.md reference: AGENTS.md:L21-L25
Useful? React with 👍 / 👎.
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.
Addressed in 1ecf162: the
deepseek-prefix is intentional and the repository constraint is updated accordingly — AGENTS.md now states the extension activates for OpenAI GPT-family models and DeepSeek models (id prefixdeepseek-) exposed throughopenai-responses/openai-codex-responsesAPIs. Non-GPT models on other APIs remain on the standard editing tools.