Skip to content

Commit 54671c4

Browse files
committed
Consolidate API tool types and default temperatures into a shared constants file
1 parent bc24268 commit 54671c4

5 files changed

Lines changed: 26 additions & 20 deletions

File tree

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
export type SupportedTool =
2+
| 'code-completions'
3+
| 'edit-context'
4+
| 'intelligent-update'
5+
| 'commit-messages'
6+
7+
export const DEFAULT_TEMPERATURE: { [key in SupportedTool]: number } = {
8+
'code-completions': 0.3,
9+
'edit-context': 0.3,
10+
'intelligent-update': 0,
11+
'commit-messages': 0.3
12+
}

packages/ui/src/components/editor/ChatInput/ChatInput.module.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
}
3232

3333
&--disabled {
34-
opacity: 0.2;
34+
opacity: 0.4;
3535
pointer-events: none;
3636
}
3737
}

packages/vscode/src/commands/code-completion-commands.ts

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import { Logger } from '../utils/logger'
88
import he from 'he'
99
import { PROVIDERS } from '@shared/constants/providers'
1010
import { LAST_SELECTED_CODE_COMPLETION_CONFIG_INDEX_STATE_KEY } from '../constants/state-keys'
11+
import { DEFAULT_TEMPERATURE } from '@shared/constants/api-tools'
1112

1213
async function build_completion_payload(params: {
1314
document: vscode.TextDocument
@@ -171,12 +172,18 @@ async function get_code_completion_config(
171172
return {
172173
label: config.model,
173174
description: `${
174-
config.reasoning_effort ? `${config.reasoning_effort}` : ''
175-
}${
176175
config.reasoning_effort
177-
? ` · ${config.provider_name}`
178-
: `${config.provider_name}`
176+
? `Reasoning effort: ${config.reasoning_effort}`
177+
: ''
178+
}${
179+
config.temperature &&
180+
config.temperature != DEFAULT_TEMPERATURE['code-completions']
181+
? config.reasoning_effort
182+
? ` · Temperature: ${config.temperature}`
183+
: `Temperature: ${config.temperature}`
184+
: ''
179185
}`,
186+
detail: config.provider_name,
180187
config,
181188
index,
182189
buttons

packages/vscode/src/commands/open-settings-command/setup-api-tool-multi-config.ts

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,7 @@ import {
1111
import { ModelFetcher } from '@/services/model-fetcher'
1212
import { PROVIDERS } from '@shared/constants/providers'
1313
import { Logger } from '@/utils/logger'
14-
15-
type SupportedTool = 'code-completions' | 'edit-context' | 'intelligent-update'
16-
17-
const DEFAULT_TEMPERATURE: { [key in SupportedTool]: number } = {
18-
'code-completions': 0.3,
19-
'edit-context': 0.3,
20-
'intelligent-update': 0
21-
}
14+
import { DEFAULT_TEMPERATURE, SupportedTool } from '@shared/constants/api-tools'
2215

2316
interface ToolMethods {
2417
get_configs: () => Promise<ToolConfig[]>

packages/vscode/src/commands/open-settings-command/setup-api-tool.ts

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,7 @@ import {
88
import { ModelFetcher } from '@/services/model-fetcher'
99
import { PROVIDERS } from '@shared/constants/providers'
1010
import { COMMIT_MESSAGES_CONFIRMATION_THRESHOLD_STATE_KEY } from '@/constants/state-keys'
11-
12-
type SupportedTool = 'commit-messages' | 'some-other-introduced-later'
13-
14-
const DEFAULT_TEMPERATURE: { [key in SupportedTool]: number } = {
15-
'commit-messages': 0.3,
16-
'some-other-introduced-later': 0.3
17-
}
11+
import { DEFAULT_TEMPERATURE, SupportedTool } from '@shared/constants/api-tools'
1812

1913
const DEFAULT_CONFIRMATION_THRESHOLD = 20000
2014

0 commit comments

Comments
 (0)