Skip to content

Commit 36680f1

Browse files
committed
Move default system instructions to shared constants module
1 parent 3c643af commit 36680f1

15 files changed

Lines changed: 31 additions & 25 deletions

‎apps/browser/src/content-scripts/send-prompt-content-script/chatbots/ai-studio.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { CHATBOTS } from '@shared/constants/chatbots'
33
import { show_response_ready_notification } from '../utils/show-response-ready-notification'
44
import { add_apply_response_button } from '../utils/add-apply-response-button'
55
import { report_initialization_error } from '../utils/report-initialization-error'
6-
import { default_system_instructions } from '../constants/default-system-instructions'
6+
import { default_system_instructions } from '@shared/constants/default-system-instructions'
77

88
export const ai_studio: Chatbot = {
99
wait_until_ready: async () => {

‎apps/browser/src/content-scripts/send-prompt-content-script/chatbots/open-webui.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1+
import { default_system_instructions } from '@shared/constants/default-system-instructions'
12
import { Chatbot } from '../types/chatbot'
23
import {
34
add_apply_response_button,
45
observe_for_responses
56
} from '../utils/add-apply-response-button'
67
import { report_initialization_error } from '../utils/report-initialization-error'
7-
import { default_system_instructions } from '../constants/default-system-instructions'
88

99
export const open_webui: Chatbot = {
1010
wait_until_ready: async () => {

‎apps/browser/src/content-scripts/send-prompt-content-script/chatbots/openrouter.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1+
import { default_system_instructions } from '@shared/constants/default-system-instructions'
12
import { Chatbot } from '../types/chatbot'
23
import {
34
add_apply_response_button,
45
observe_for_responses
56
} from '../utils/add-apply-response-button'
67
import { report_initialization_error } from '../utils/report-initialization-error'
7-
import { default_system_instructions } from '../constants/default-system-instructions'
88

99
const show_options_modal = async (function_name: string) => {
1010
const options_button = Array.from(

‎apps/editor/package.json‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -705,8 +705,7 @@
705705
},
706706
"codeWebChat.editContextSystemInstructions": {
707707
"type": "string",
708-
"scope": "resource",
709-
"default": "You're a helpful coding assistant. Don't explain changes in inline comments."
708+
"scope": "resource"
710709
},
711710
"codeWebChat.pruneContextInstructionsPrefix": {
712711
"type": "string",

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

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ import {
3737
EDIT_FORMAT_INSTRUCTIONS_BEFORE_AFTER,
3838
EDIT_FORMAT_INSTRUCTIONS_DIFF
3939
} from '@/constants/edit-format-instructions'
40+
import { default_system_instructions } from '@shared/constants/default-system-instructions'
4041

4142
const get_edit_context_config = async (params: {
4243
api_providers_manager: ModelProvidersManager
@@ -458,9 +459,11 @@ export const handle_edit_context = async (
458459
system_instructions_xml ? system_instructions_xml + '\n' : ''
459460
}${processed_instructions}`
460461

461-
const system_instructions = vscode.workspace
462-
.getConfiguration('codeWebChat')
463-
.get<string>('editContextSystemInstructions')
462+
const system_instructions =
463+
vscode.workspace
464+
.getConfiguration('codeWebChat')
465+
.get<string>('editContextSystemInstructions') ||
466+
default_system_instructions
464467

465468
const messages = [
466469
...(system_instructions

‎apps/editor/src/views/settings/backend/message-handlers/handle-get-edit-context-system-instructions.ts‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
11
import * as vscode from 'vscode'
22
import { SettingsProvider } from '@/views/settings/backend/settings-provider'
3+
import { default_system_instructions } from '@shared/constants/default-system-instructions'
34

45
export const handle_get_edit_context_system_instructions = async (
56
provider: SettingsProvider
67
): Promise<void> => {
78
const config = vscode.workspace.getConfiguration('codeWebChat')
8-
const instructions = config.get<string>('editContextSystemInstructions') || ''
9+
const instructions =
10+
config.get<string>('editContextSystemInstructions') ||
11+
default_system_instructions
912
provider.postMessage({
1013
command: 'EDIT_CONTEXT_SYSTEM_INSTRUCTIONS',
1114
instructions

‎apps/editor/src/views/settings/backend/message-handlers/handle-update-checkpoint-lifespan.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ export const handle_update_checkpoint_lifespan = async (
88
.getConfiguration('codeWebChat')
99
.update(
1010
'checkpointLifespan',
11-
message.hours ?? undefined,
11+
message.hours || undefined,
1212
vscode.ConfigurationTarget.Global
1313
)
1414
}
Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,14 @@
11
import * as vscode from 'vscode'
2-
import { SettingsProvider } from '@/views/settings/backend/settings-provider'
32
import { UpdateClearChecksInWorkspaceBehaviorMessage } from '@/views/settings/types/messages'
43

54
export const handle_update_clear_checks_in_workspace_behavior = async (
6-
provider: SettingsProvider,
75
message: UpdateClearChecksInWorkspaceBehaviorMessage
86
): Promise<void> => {
97
await vscode.workspace
108
.getConfiguration('codeWebChat')
119
.update(
1210
'clearChecksInWorkspaceBehavior',
13-
message.value,
11+
message.value == 'ignore-open-editors' ? undefined : message.value,
1412
vscode.ConfigurationTarget.Global
1513
)
1614
}

‎apps/editor/src/views/settings/backend/message-handlers/handle-update-commit-message-auto-accept-after.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ export const handle_update_commit_message_auto_accept_after = async (
88
.getConfiguration('codeWebChat')
99
.update(
1010
'commitMessageAutoAcceptAfter',
11-
message.seconds === null ? 0 : message.seconds,
11+
message.seconds ?? undefined,
1212
vscode.ConfigurationTarget.Global
1313
)
1414
}
Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,14 @@
11
import * as vscode from 'vscode'
2-
import { SettingsProvider } from '@/views/settings/backend/settings-provider'
32
import { UpdateContextSizeWarningThresholdMessage } from '@/views/settings/types/messages'
43

54
export const handle_update_context_size_warning_threshold = async (
6-
provider: SettingsProvider,
75
message: UpdateContextSizeWarningThresholdMessage
86
): Promise<void> => {
97
await vscode.workspace
108
.getConfiguration('codeWebChat')
119
.update(
1210
'contextSizeWarningThreshold',
13-
message.threshold ?? undefined,
11+
message.threshold || undefined,
1412
vscode.ConfigurationTarget.Global
1513
)
1614
}

0 commit comments

Comments
 (0)