Skip to content

Commit f428ec6

Browse files
committed
Track and display API configuration and chatbot URL in chat response history and preview UI
- when working with API requests, [Fragment] should display provider, model and reasoning effort, when possible. - to `apps/editor/src/commands/apply-chat-response-command/utils/preview-handler.ts` add missing api provider/model/reasoning effort handling - rename url/preview_url to chatbot_url - move api provider/model/reasoning effort from header_slot (leave chatbot_url there) to `packages/ui/src/components/editor/panel/ResponsePreview/ResponsePreview.tsx`. In there display it below the list of items. - display them [Fragment] in separate lines - rename .footer to .configuration - place api_provider, api_model, api_reasoning_effort in a configuration object (optoinal). Inside the object, only api_reasoning_effort is optional.
1 parent 59b6d29 commit f428ec6

17 files changed

Lines changed: 105 additions & 29 deletions

File tree

‎apps/editor/package.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "gemini-coder",
33
"displayName": "Code Web Chat",
4-
"description": "The fastest way to code with AI (CWC)",
4+
"description": "Fast and safe way to code with AI (CWC)",
55
"version": "1.869.0",
66
"scripts": {
77
"build": "npx vsce package --no-dependencies",

‎apps/editor/src/commands/apply-chat-response-command/apply-chat-response-command.ts‎

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,8 @@ export const apply_chat_response_command = (params: {
9191
response: chat_response,
9292
raw_instructions: args?.raw_instructions,
9393
created_at: Date.now(),
94-
url: args?.url
94+
chatbot_url: args?.chatbot_url,
95+
api_configuration: args?.api_configuration
9596
}
9697

9798
history.push(new_item)
@@ -303,7 +304,8 @@ export const apply_chat_response_command = (params: {
303304
lines_added: total_lines_added,
304305
lines_removed: total_lines_removed,
305306
files: files_for_history,
306-
url: args?.url
307+
chatbot_url: args?.chatbot_url,
308+
api_configuration: args?.api_configuration
307309
}
308310

309311
history.push(new_item)
@@ -327,7 +329,8 @@ export const apply_chat_response_command = (params: {
327329
original_editor_state: args?.original_editor_state,
328330
raw_instructions: args?.raw_instructions,
329331
created_at: created_at_for_preview,
330-
url: args?.url
332+
chatbot_url: args?.chatbot_url,
333+
api_configuration: args?.api_configuration
331334
})
332335

333336
if (changes_accepted) {

‎apps/editor/src/commands/apply-chat-response-command/response-processor.ts‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import * as vscode from 'vscode'
22
import * as fs from 'fs'
33
import * as path from 'path'
44
import { OriginalFileState } from './types/original-file-state'
5+
import { ApiConfiguration } from '@shared/types/response-history-item'
56
import { handle_restore_preview } from './handlers/restore-preview-handler'
67
import {
78
parse_response,
@@ -45,7 +46,8 @@ export type CommandArgs = {
4546
}
4647
files_with_content?: FileInPreview[]
4748
created_at?: number
48-
url?: string
49+
chatbot_url?: string
50+
api_configuration?: ApiConfiguration
4951
}
5052

5153
export const process_chat_response = async (

‎apps/editor/src/commands/apply-chat-response-command/utils/preview-handler.ts‎

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import * as vscode from 'vscode'
22
import { Logger } from '@shared/utils/logger'
33
import { OriginalFileState } from '../types/original-file-state'
4+
import { ApiConfiguration } from '@shared/types/response-history-item'
45
import { undo_files } from './file-operations'
56
import { preview } from './preview'
67
import { PanelProvider } from '@/views/panel/backend/panel-provider'
@@ -20,7 +21,8 @@ export const preview_handler = async (params: {
2021
}
2122
raw_instructions?: string
2223
created_at?: number
23-
url?: string
24+
chatbot_url?: string
25+
api_configuration?: ApiConfiguration
2426
}): Promise<boolean> => {
2527
let resolve_cleanup_promise: () => void
2628
ongoing_preview_cleanup_promise = new Promise((resolve) => {
@@ -35,7 +37,8 @@ export const preview_handler = async (params: {
3537
chat_response: params.chat_response,
3638
context: params.context,
3739
created_at: params.created_at,
38-
url: params.url
40+
chatbot_url: params.chatbot_url,
41+
api_configuration: params.api_configuration
3942
})
4043

4144
if (preview_result === null || preview_result.accepted_files.length == 0) {

‎apps/editor/src/commands/apply-chat-response-command/utils/preview/preview.ts‎

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import * as vscode from 'vscode'
22
import { dictionary } from '@shared/constants/dictionary'
33
import { PanelProvider } from '@/views/panel/backend/panel-provider'
44
import { OriginalFileState } from '@/commands/apply-chat-response-command/types/original-file-state'
5+
import { ApiConfiguration } from '@shared/types/response-history-item'
56
import { setup_workspace_listeners } from './workspace-listener'
67
import { prepare_files_from_original_states } from './file-preparer'
78
import { parse_response } from '../clipboard-parser/clipboard-parser'
@@ -25,7 +26,8 @@ export const preview = async (params: {
2526
chat_response: string
2627
context: vscode.ExtensionContext
2728
created_at?: number
28-
url?: string
29+
chatbot_url?: string
30+
api_configuration?: ApiConfiguration
2931
}): Promise<{
3032
accepted_files: PreviewableFile[]
3133
rejected_states: OriginalFileState[]
@@ -137,7 +139,8 @@ export const preview = async (params: {
137139
raw_instructions: params.raw_instructions,
138140
created_at: params.created_at,
139141
fix_all_automatically,
140-
url: params.url
142+
chatbot_url: params.chatbot_url,
143+
api_configuration: params.api_configuration
141144
})
142145
}
143146

‎apps/editor/src/commands/checkpoints-command/actions/restore-checkpoint.ts‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -534,7 +534,9 @@ export const restore_checkpoint = async (params: {
534534
response: item_to_preview.response,
535535
raw_instructions: item_to_preview.raw_instructions,
536536
files_with_content: item_to_preview.files,
537-
created_at: item_to_preview.created_at
537+
created_at: item_to_preview.created_at,
538+
chatbot_url: item_to_preview.chatbot_url,
539+
api_configuration: item_to_preview.api_configuration
538540
})
539541
}
540542
}

‎apps/editor/src/services/websocket-manager.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ export class WebSocketManager {
159159
vscode.commands.executeCommand('codeWebChat.applyChatResponse', {
160160
raw_instructions: message.raw_instructions,
161161
edit_format: message.edit_format,
162-
url: message.url
162+
chatbot_url: message.chatbot_url
163163
})
164164
}
165165
} catch (error) {

‎apps/editor/src/views/panel/backend/message-handlers/handle-apply-response-from-history.ts‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ export const handle_apply_response_from_history = async (
99
raw_instructions: message.raw_instructions,
1010
files_with_content: message.files,
1111
created_at: message.created_at,
12-
url: message.url
12+
chatbot_url: message.chatbot_url,
13+
api_configuration: message.api_configuration
1314
})
1415
}

‎apps/editor/src/views/panel/backend/message-handlers/handle-code-at-cursor.ts‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -462,6 +462,11 @@ export const handle_code_at_cursor = async (
462462
line: position.line,
463463
character: position.character
464464
}
465+
},
466+
api_configuration: {
467+
provider: code_completions_config.provider_name,
468+
model: code_completions_config.model,
469+
reasoning_effort: code_completions_config.reasoning_effort
465470
}
466471
}
467472
)

‎apps/editor/src/views/panel/backend/message-handlers/handle-edit-context.ts‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -541,7 +541,12 @@ export const handle_edit_context = async (
541541
vscode.commands.executeCommand('codeWebChat.applyChatResponse', {
542542
response: result.response,
543543
raw_instructions: instructions,
544-
edit_format
544+
edit_format,
545+
api_configuration: {
546+
provider: edit_context_config.provider_name,
547+
model: edit_context_config.model,
548+
reasoning_effort: edit_context_config.reasoning_effort
549+
}
545550
})
546551
return true
547552
}

0 commit comments

Comments
 (0)