Skip to content

Commit 4990c7d

Browse files
committed
Refactor generate commit message command to remove ModelProvidersManager and simplify UI navigation
1 parent 9108178 commit 4990c7d

1 file changed

Lines changed: 3 additions & 28 deletions

File tree

‎apps/editor/src/commands/generate-commit-message-command/generate-commit-message-command.ts‎

Lines changed: 3 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ import { display_token_count } from '../../utils/display-token-count'
88
import { get_commit_message_config } from './utils/get-commit-message-config'
99
import { build_commit_message_prompt } from './utils/build-commit-message-prompt'
1010
import { generate_commit_message_with_api } from './utils/generate-commit-message-with-api'
11-
import { ModelProvidersManager } from '@/services/model-providers-manager'
1211
import { t } from '@/i18n'
1312
import axios from 'axios'
1413
import { PromptsForCommitMessagesUtils } from '../../utils/prompts-for-commit-messages-utils'
@@ -50,7 +49,6 @@ export const generate_commit_message_command = (
5049
}) => {
5150
let files_staged_by_action = false
5251
let is_single_change_flow = false
53-
const api_providers_manager = new ModelProvidersManager(context)
5452
let force_quick_pick = false
5553
const selection_state: { files?: string[] } = {}
5654

@@ -70,10 +68,6 @@ export const generate_commit_message_command = (
7068
was_empty_stage = true
7169
}
7270

73-
const default_config =
74-
await api_providers_manager.get_default_commit_messages_config()
75-
const has_default_config = !!default_config
76-
7771
const show_back_button =
7872
was_empty_stage && !is_single_change_flow && !params.source_control
7973

@@ -153,17 +147,7 @@ export const generate_commit_message_command = (
153147
tooltip: t('command.commit-message.input.accept')
154148
}
155149

156-
if (has_default_config && !files_staged_by_action) {
157-
input_box.buttons = [
158-
accept_button,
159-
{
160-
iconPath: new vscode.ThemeIcon('close'),
161-
tooltip: t('common.close')
162-
}
163-
]
164-
} else {
165-
input_box.buttons = [accept_button, vscode.QuickInputButtons.Back]
166-
}
150+
input_box.buttons = [accept_button, vscode.QuickInputButtons.Back]
167151

168152
let is_resolved = false
169153

@@ -172,10 +156,7 @@ export const generate_commit_message_command = (
172156
is_resolved = true
173157
resolve(input_box.value)
174158
input_box.hide()
175-
} else if (
176-
button === vscode.QuickInputButtons.Back ||
177-
button.tooltip == t('common.close')
178-
) {
159+
} else if (button === vscode.QuickInputButtons.Back) {
179160
is_resolved = true
180161
resolve('back')
181162
input_box.hide()
@@ -200,13 +181,7 @@ export const generate_commit_message_command = (
200181
)
201182

202183
if (edited_message == 'back') {
203-
if (has_default_config) {
204-
if (files_staged_by_action) {
205-
await vscode.commands.executeCommand('git.unstageAll')
206-
} else {
207-
return
208-
}
209-
}
184+
force_quick_pick = true
210185
continue
211186
}
212187

0 commit comments

Comments
 (0)