✨ feat(vscode): 问 AI 和重写注释各用各的 profile,设置里加重写注释默认模型
This commit is contained in:
1 parent
925f1ed39a
commit
b83c445dd0
25 files changed
+363
-111
No files matched your search
@@ -58,7 +58,7 @@ describe('saveSettings 落盘', () => {
|
||||
}
|
||||
})
|
||||
|
||||
it('文件问答默认模型独立落盘,重启读取且不受旧的上次选择影响', async () => {
|
||||
it('问答默认模型独立落盘,重启读取且不受旧的上次选择影响', async () => {
|
||||
const dir = tempDir()
|
||||
const ctx = fakeCtx(dir, { 'superpowers.codeReader.askProfile': 'sonnet' })
|
||||
expect(getSettings(ctx).defaultAskProfilePath).toBe('')
|
||||
@@ -71,6 +71,16 @@ describe('saveSettings 落盘', () => {
|
||||
expect(getSettings(fakeCtx(dir)).defaultAskProfilePath).toBe('')
|
||||
})
|
||||
|
||||
it('问答、重写注释的默认模型各存各的:没配时都是空(用默认),改一个不动另一个', async () => {
|
||||
const dir = tempDir()
|
||||
const ctx = fakeCtx(dir)
|
||||
expect(getSettings(ctx).defaultRewriteProfilePath).toBe('')
|
||||
await saveSettings(ctx, { defaultAskProfilePath: '/p/sonnet.json', defaultRewriteProfilePath: ' /p/dsflash.json ' })
|
||||
expect(getSettings(fakeCtx(dir))).toMatchObject({ defaultAskProfilePath: '/p/sonnet.json', defaultRewriteProfilePath: '/p/dsflash.json' })
|
||||
await saveSettings(ctx, { defaultRewriteProfilePath: '' })
|
||||
expect(getSettings(fakeCtx(dir))).toMatchObject({ defaultAskProfilePath: '/p/sonnet.json', defaultRewriteProfilePath: '' })
|
||||
})
|
||||
|
||||
it('默认配置保存后通知订阅者,取消订阅后不再通知', async () => {
|
||||
const ctx = fakeCtx(tempDir())
|
||||
const { onDidChangeSettings } = await import('./store.js')
|
||||
|
||||
@@ -211,7 +211,10 @@ export interface Settings {
|
||||
defaultTestProfilePath: string
|
||||
/** 原型会话的默认 Claude profile;工单级「原型配置文件」为空时用它。 */
|
||||
defaultPrototypeProfilePath: string
|
||||
/** 代码阅读里问 AI(块下面、预览顶部、「了解一块代码」)的默认 Claude profile;空串时用插件的默认 profile,它也没有就不带 `--settings`。 */
|
||||
defaultAskProfilePath: string
|
||||
/** 代码阅读里重写注释的默认 Claude profile;空串时用插件的默认 profile,它也没有就不带 `--settings`。 */
|
||||
defaultRewriteProfilePath: string
|
||||
/**
|
||||
* Claude settings profile path for the conflict-resolution cc session
|
||||
* (drag to 完成 when PR merge conflicts). Empty = DEFAULT_PROFILE_PATH.
|
||||
@@ -317,6 +320,7 @@ function defaults(ctx: ExtensionContext): Settings {
|
||||
defaultTestProfilePath: '',
|
||||
defaultPrototypeProfilePath: '',
|
||||
defaultAskProfilePath: '',
|
||||
defaultRewriteProfilePath: '',
|
||||
conflictResolutionProfilePath: '',
|
||||
commitProfilePath: '',
|
||||
prDiffSummaryProfilePath: '',
|
||||
@@ -435,6 +439,9 @@ export function getSettings(ctx: ExtensionContext): Settings {
|
||||
const defaultAskProfilePath = typeof stored.defaultAskProfilePath === 'string'
|
||||
? stored.defaultAskProfilePath.trim()
|
||||
: base.defaultAskProfilePath
|
||||
const defaultRewriteProfilePath = typeof stored.defaultRewriteProfilePath === 'string'
|
||||
? stored.defaultRewriteProfilePath.trim()
|
||||
: base.defaultRewriteProfilePath
|
||||
// conflict-resolution profile: '' is meaningful (= DEFAULT_PROFILE_PATH at
|
||||
// launch time), so don't coerce. Non-string legacy values collapse to ''.
|
||||
const conflictResolutionProfilePath = typeof stored.conflictResolutionProfilePath === 'string'
|
||||
@@ -496,6 +503,7 @@ export function getSettings(ctx: ExtensionContext): Settings {
|
||||
defaultTestProfilePath,
|
||||
defaultPrototypeProfilePath,
|
||||
defaultAskProfilePath,
|
||||
defaultRewriteProfilePath,
|
||||
conflictResolutionProfilePath,
|
||||
commitProfilePath,
|
||||
prDiffSummaryProfilePath,
|
||||
|
||||
Reference in new issue
Block a user