🐛 fix(vscode): 修复看板缓存并增加问答默认模型
This commit is contained in:
1 parent
c38f1dc468
commit
012daf95b5
25 files changed
+1753
-164
No files matched your search
@@ -21,19 +21,10 @@ import type { ExtensionToWebview, LogEntry, ReleaseCommitGroup } from '../lib/me
|
||||
import type { Issue, IssueColumn } from '../types'
|
||||
import { useCallback, useEffect, useRef, useState } from 'react'
|
||||
import { handoffRequestNotices } from '../../../src/panel/handlers/handoffRequest'
|
||||
import { applyIssueUpdate } from '../../../src/shared/kanbanUpdates'
|
||||
import { compareIssuesInColumn } from '../lib/issueSort'
|
||||
import { onMessage, postMessage } from '../lib/vscode'
|
||||
|
||||
/** postMessage 用 null 清空 optional 字段;合并时 delete 还原 optional,避免残留 null */
|
||||
function applyIssuePatch(issue: Issue, patch: Record<string, unknown>): Issue {
|
||||
const next = { ...issue, ...patch } as Issue & Record<string, unknown>
|
||||
for (const [k, v] of Object.entries(patch)) {
|
||||
if (v === null)
|
||||
delete next[k]
|
||||
}
|
||||
return next as Issue
|
||||
}
|
||||
|
||||
export interface SettingsValues {
|
||||
host: string
|
||||
token: string
|
||||
@@ -61,6 +52,7 @@ export interface SettingsValues {
|
||||
defaultImplementProfilePath: string
|
||||
defaultTestProfilePath: string
|
||||
defaultPrototypeProfilePath: string
|
||||
defaultAskProfilePath: string
|
||||
conflictResolutionProfilePath: string
|
||||
commitProfilePath: string
|
||||
prDiffSummaryProfilePath: string
|
||||
@@ -102,6 +94,7 @@ export interface SettingsOverlayState {
|
||||
defaultImplementProfilePath: string
|
||||
defaultTestProfilePath: string
|
||||
defaultPrototypeProfilePath: string
|
||||
defaultAskProfilePath: string
|
||||
conflictResolutionProfilePath: string
|
||||
commitProfilePath: string
|
||||
prDiffSummaryProfilePath: string
|
||||
@@ -465,6 +458,7 @@ export function useIssues(): UseIssuesResult {
|
||||
defaultImplementProfilePath: values.defaultImplementProfilePath,
|
||||
defaultTestProfilePath: values.defaultTestProfilePath,
|
||||
defaultPrototypeProfilePath: values.defaultPrototypeProfilePath,
|
||||
defaultAskProfilePath: values.defaultAskProfilePath,
|
||||
conflictResolutionProfilePath: values.conflictResolutionProfilePath,
|
||||
commitProfilePath: values.commitProfilePath,
|
||||
prDiffSummaryProfilePath: values.prDiffSummaryProfilePath,
|
||||
@@ -890,9 +884,7 @@ export function useIssues(): UseIssuesResult {
|
||||
return prev
|
||||
return {
|
||||
status: 'ready',
|
||||
issues: prev.issues.map(i =>
|
||||
i.number === msg.issueNumber ? applyIssuePatch(i, msg.patch) : i,
|
||||
),
|
||||
issues: applyIssueUpdate(prev.issues, msg),
|
||||
}
|
||||
})
|
||||
if (msg.patch.prDiffFile)
|
||||
@@ -915,7 +907,7 @@ export function useIssues(): UseIssuesResult {
|
||||
if (prev.status !== 'ready')
|
||||
return prev
|
||||
const removed = prev.issues.find(i => i.number === msg.issueNumber)
|
||||
const remaining = prev.issues.filter(i => i.number !== msg.issueNumber)
|
||||
const remaining = applyIssueUpdate(prev.issues, msg)
|
||||
if (removed) {
|
||||
const sameCol = remaining
|
||||
.filter(i => i.column === removed.column)
|
||||
@@ -931,12 +923,9 @@ export function useIssues(): UseIssuesResult {
|
||||
setState((prev) => {
|
||||
if (prev.status !== 'ready')
|
||||
return prev
|
||||
const exists = prev.issues.some(i => i.number === msg.issue.number)
|
||||
return {
|
||||
status: 'ready',
|
||||
issues: exists
|
||||
? prev.issues.map(i => i.number === msg.issue.number ? msg.issue : i)
|
||||
: [...prev.issues, msg.issue],
|
||||
issues: applyIssueUpdate(prev.issues, msg),
|
||||
}
|
||||
})
|
||||
if (msg.select)
|
||||
@@ -991,6 +980,7 @@ export function useIssues(): UseIssuesResult {
|
||||
defaultImplementProfilePath: msg.defaultImplementProfilePath,
|
||||
defaultTestProfilePath: msg.defaultTestProfilePath,
|
||||
defaultPrototypeProfilePath: msg.defaultPrototypeProfilePath,
|
||||
defaultAskProfilePath: msg.defaultAskProfilePath,
|
||||
conflictResolutionProfilePath: msg.conflictResolutionProfilePath,
|
||||
commitProfilePath: msg.commitProfilePath,
|
||||
prDiffSummaryProfilePath: msg.prDiffSummaryProfilePath,
|
||||
|
||||
Reference in new issue
Block a user