Skip to content

Commit 5fddb68

Browse files
committed
Standardize API edit format state retrieval, defaulting to 'whole', and simplify the format selector tooltip text
1 parent 0c22ee5 commit 5fddb68

2 files changed

Lines changed: 11 additions & 6 deletions

File tree

‎packages/ui/src/components/editor/panel/ChatInput/ChatInput.tsx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -303,7 +303,7 @@ export const ChatInput: React.FC<ChatInputProps> = (props) => {
303303
]]: props.edit_format == format
304304
}
305305
)}
306-
title={`Attached edit format instructions: ${props.edit_format_instructions?.[format]}`}
306+
title={`"${props.edit_format_instructions?.[format]}"`}
307307
onClick={() => props.on_edit_format_change?.(format)}
308308
data-text={format}
309309
>

‎packages/vscode/src/views/panel/backend/message-handlers/handle-edit-context.ts‎

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,10 @@ import { make_api_request } from '@/utils/make-api-request'
99
import axios from 'axios'
1010
import { PROVIDERS } from '@shared/constants/providers'
1111
import { DEFAULT_TEMPERATURE } from '@shared/constants/api-tools'
12-
import { LAST_SELECTED_EDIT_CONTEXT_CONFIG_ID_STATE_KEY } from '@/constants/state-keys'
12+
import {
13+
API_EDIT_FORMAT_STATE_KEY,
14+
LAST_SELECTED_EDIT_CONTEXT_CONFIG_ID_STATE_KEY
15+
} from '@/constants/state-keys'
1316
import { EditFormat } from '@shared/types/edit-format'
1417
import { ToolConfig } from '@/services/model-providers-manager'
1518
import { replace_changes_placeholder } from '@/views/panel/backend/utils/replace-changes-placeholder'
@@ -326,10 +329,12 @@ const perform_context_editing = async (params: {
326329

327330
const files = `<files>${collected_files}\n</files>`
328331

329-
const edit_format = params.context.workspaceState.get<EditFormat>(
330-
'api-edit-format',
331-
'diff'
332-
)
332+
const edit_format =
333+
params.context.workspaceState.get<EditFormat>(
334+
API_EDIT_FORMAT_STATE_KEY
335+
) ??
336+
params.context.globalState.get<EditFormat>(API_EDIT_FORMAT_STATE_KEY) ??
337+
'whole'
333338
const all_instructions = vscode.workspace
334339
.getConfiguration('codeWebChat')
335340
.get<{ [key in EditFormat]: string }>('editFormatInstructions')

0 commit comments

Comments
 (0)