Skip to content

Commit 55b0881

Browse files
authored
Merge pull request #146 from VSC-NeuroPilot/feat/insert_turtle_here
feat: allow setting user's name for collab scenarios
2 parents 53f6b7d + eaa171a commit 55b0881

13 files changed

Lines changed: 108 additions & 66 deletions

File tree

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,10 @@ Changes between each version before then will not be listed.
1515

1616
## 2.2.2
1717

18+
### New settings
19+
20+
- `neuropilot.connection.userName` - Your name, to be used where Vedal would be used in the extension. This will not be logged, but it will be sent to the connected API server, so do be mindful of what you put there.
21+
1822
### Added features
1923

2024
- If an exception was thrown while executing an action, it will be caught and you will be notified about it.
@@ -27,6 +31,8 @@ Changes between each version before then will not be listed.
2731
- Neuro can now get cookies by herself, if `neuropilot.permission.requestCookies` is set to `Autopilot`.
2832
- Perfect for chill streams, assuming of course that she doesn't abuse it.
2933
- The default for this permission is still set to "Copilot", so you'll still need to set it yourself.
34+
- Your name, according to the `neuropilot.connection.userName` setting, will be used in areas where it used to say Vedal.
35+
- If you want to use your name in the `neuropilot.connection.initialContext` setting, use the `insert_turtle_here` placeholder.
3036
- Neuro will now be told about all schema validation errors at once, as opposed to only being able to see one validation error at a time.
3137

3238
### Fixes

package.json

Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@
196196
"neuropilot.currentlyAsNeuroAPI": {
197197
"type": "string",
198198
"markdownDescription": "Who is currently acting as the Neuro API server?\nThis only changes the name in certain areas (such as Copilot-mode requests or Git commit messages) due to limitations.\n\nYou can add custom characters using `settings.json` if you ignore the lint error from VS Code.\n\n(Most) names mentioned here are not associated with NeuroPilot.",
199-
"default": "Neuro",
199+
"deprecationMessage": "This setting has been moved to neuropilot.connection.nameOfAPI",
200200
"enum": [
201201
"Neuro",
202202
"Evil",
@@ -782,7 +782,7 @@
782782
"neuropilot.connection.initialContext": {
783783
"type": "string",
784784
"default": "You are using an extension in Visual Studio Code that allows you to code together with Vedal.",
785-
"description": "The initial context to sent to Neuro-sama (or whatever is connected to NeuroPilot)",
785+
"markdownDescription": "The initial context to sent to Neuro-sama (or whatever is connected to NeuroPilot)\n\nTo replace with your name (according to [this setting](vscode://settings/neuropilot.connection.userName)), use `insert_turtle_here`.",
786786
"editPresentation": "multilineText"
787787
},
788788
"neuropilot.connection.autoConnect": {
@@ -802,6 +802,32 @@
802802
"minimum": 0,
803803
"markdownDescription": "The amount of retries to connect to the Neuro API if it fails.\n\nThe amount of tries total will be (this setting) + 1.\n\nSet to 0 to disallow retries."
804804
},
805+
"neuropilot.connection.userName": {
806+
"type": "string",
807+
"default": "Vedal",
808+
"description": "Your name (to communicate who is controlling this VS Code instance alongside the API server). This will be used where the name `Vedal` would work for Neuro."
809+
},
810+
"neuropilot.connection.nameOfAPI": {
811+
"type": "string",
812+
"markdownDescription": "Who is currently acting as the Neuro API server?\nThis only changes the name in certain areas (such as Copilot-mode requests or Git commit messages) due to limitations.\n\nYou can add custom characters using `settings.json` if you ignore the lint error from VS Code.\n\n(Most) names mentioned here are not associated with NeuroPilot.",
813+
"default": "Neuro",
814+
"enum": [
815+
"Neuro",
816+
"Evil",
817+
"Randy",
818+
"Jippity",
819+
"Tony",
820+
"Gary"
821+
],
822+
"enumDescriptions": [
823+
"#1 at osu!",
824+
"Evil, but actually nice.",
825+
"Random Dot Range (Alex)",
826+
"A GPT model (EnterpriseScratchDev)",
827+
"The human operator (Pasu4)",
828+
"Literally in your computer walls (Govorunb)"
829+
]
830+
},
805831
"neuropilot.actions.disabledActions": {
806832
"type": "array",
807833
"default": [],

src/chat.ts

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import * as vscode from 'vscode';
22

33
import { NEURO } from '@/constants';
44
import { filterFileContents, logOutput, simpleFileName } from '@/utils';
5-
import { CONFIG } from '@/config';
5+
import { CONFIG, CONNECTION } from '@/config';
66
import assert from 'node:assert';
77

88
interface Participant {
@@ -80,12 +80,12 @@ export function registerChatParticipant() {
8080
token: vscode.CancellationToken,
8181
): Promise<NeuroChatResult> => {
8282
let prefix = '';
83-
const currentAPI = CONFIG.currentlyAsNeuroAPI;
83+
const currentAPI = CONNECTION.nameOfAPI;
8484

8585
if (request.command === 'fix') {
86-
prefix = 'Vedal wants you to fix the following error(s):\n';
86+
prefix = `${CONNECTION.userName} wants you to fix the following error(s):\n`;
8787
} else if (request.command === 'explain') {
88-
prefix = 'Vedal wants you to explain the following:\n';
88+
prefix = `${CONNECTION.userName} wants you to explain the following:\n`;
8989
}
9090

9191
if (!NEURO.connected) {
@@ -99,7 +99,6 @@ export function registerChatParticipant() {
9999
}
100100
if (NEURO.waiting) {
101101
stream.markdown(`Already waiting for a response from ${currentAPI}.`);
102-
103102
stream.button({
104103
command: 'neuropilot.reconnect',
105104
title: 'Reconnect',
@@ -130,7 +129,7 @@ export function registerChatParticipant() {
130129
const text = filterFileContents(document.getText());
131130
references.push({
132131
fileName: simpleFileName(ref.value.fsPath),
133-
text: text,
132+
text,
134133
});
135134
});
136135
} else if (typeof ref.value === 'string') {
@@ -164,11 +163,11 @@ export function registerChatParticipant() {
164163
chatter.onDidReceiveFeedback((feedback: vscode.ChatResultFeedback) => {
165164
if (feedback.kind === vscode.ChatResultFeedbackKind.Helpful) {
166165
logOutput('INFO', 'Answer was deemed helpful');
167-
NEURO.client?.sendContext('Vedal found your answer helpful.');
166+
NEURO.client?.sendContext(`${CONNECTION.userName} found your answer helpful.`);
168167
} else {
169168
logOutput('INFO', 'Answer was deemed unhelpful');
170169
logOutput('DEBUG', JSON.stringify(feedback));
171-
NEURO.client?.sendContext('Vedal found your answer unhelpful.');
170+
NEURO.client?.sendContext(`${CONNECTION.userName} found your answer unhelpful.`);
172171
}
173172
}),
174173
);
@@ -189,7 +188,7 @@ async function requestChatResponse(
189188
{
190189
name: 'chat',
191190
description:
192-
'Provide an answer to Vedal\'s request.' +
191+
`Provide an answer to ${CONNECTION.userName}'s request.` +
193192
' Use markdown to format your response.' +
194193
' You may additionally include code blocks by using triple backticks.' +
195194
' Be sure to use the correct language identifier after the first set of backticks.' +

src/config.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,10 @@ const DEPRECATED_SETTINGS: DeprecatedSetting[] = [
7979
old: 'enableCancelRequests',
8080
new: 'actions.enableCancelRequests',
8181
},
82+
{
83+
old: 'currentlyAsNeuroAPI',
84+
new: 'connection.nameOfAPI',
85+
},
8286
];
8387

8488
function getTargetConfig<T>(config: vscode.WorkspaceConfiguration, key: string, target: vscode.ConfigurationTarget) {
@@ -280,7 +284,7 @@ class Permissions {
280284
get gitConfigs() { return { id: 'gitConfigs', infinitive: 'edit the Git configuration' }; }
281285
get terminalAccess() { return { id: 'terminalAccess', infinitive: 'access the terminal' }; }
282286
get accessLintingAnalysis() { return { id: 'accessLintingAnalysis', infinitive: 'view linting problems' }; }
283-
get getUserSelection() { return { id: 'getUserSelection', infinitive: 'get Vedal\'s cursor' }; }
287+
get getUserSelection() { return { id: 'getUserSelection', infinitive: `get ${CONNECTION.userName}'s cursor` }; }
284288
}
285289

286290
export const PERMISSIONS = new Permissions();
@@ -297,7 +301,6 @@ class Config {
297301
get sendSaveNotifications(): boolean { return getConfig('sendSaveNotifications')!; }
298302
get requestExpiryTimeout(): number { return getConfig('requestExpiryTimeout')!; }
299303
get cursorFollowsNeuro(): boolean { return getConfig('cursorFollowsNeuro')!; }
300-
get currentlyAsNeuroAPI(): string { return getConfig('currentlyAsNeuroAPI')!; }
301304
get docsURL(): string { return getConfig('docsURL')!; }
302305
get defaultOpenDocsWindow(): string { return getConfig('defaultOpenDocsWindow')!; }
303306
get sendContentsOnFileChange(): boolean { return getConfig('sendContentsOnFileChange')!; }
@@ -326,6 +329,8 @@ class Connection {
326329
get autoConnect(): boolean { return getConnection<boolean>('autoConnect')!; }
327330
get retryInterval(): number { return getConnection<number>('retryInterval')!; }
328331
get retryAmount(): number { return getConnection<number>('retryAmount')!; }
332+
get userName(): string { return getConnection<string>('userName')!; }
333+
get nameOfAPI(): string { return getConnection<string>('nameOfAPI')!; }
329334
}
330335

331336
export const CONNECTION = new Connection();

src/context.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import * as vscode from 'vscode';
22

33
import { getFence, logOutput, notifyOnCaughtException, simpleFileName } from '@/utils';
44
import { NEURO } from '@/constants';
5-
import { PERMISSIONS, PermissionLevel, getPermissionLevel, isActionEnabled } from '@/config';
5+
import { CONNECTION, PERMISSIONS, PermissionLevel, getPermissionLevel, isActionEnabled } from '@/config';
66

77
export function sendCurrentFile() {
88
const editor = vscode.window.activeTextEditor;
@@ -24,7 +24,7 @@ export function sendCurrentFile() {
2424

2525
logOutput('INFO', 'Sending current file to Neuro API');
2626
const fence = getFence(text);
27-
NEURO.client?.sendContext(`Vedal sent you the contents of the file ${fileName}.\n\nContent:\n\n${fence}${language}\n${text}\n${fence}`);
27+
NEURO.client?.sendContext(`${CONNECTION.userName} sent you the contents of the file ${fileName}.\n\nContent:\n\n${fence}${language}\n${text}\n${fence}`);
2828
}
2929

3030
export function registerRequestCookieAction() {
@@ -36,7 +36,7 @@ export function registerRequestCookieAction() {
3636
NEURO.client?.registerActions([
3737
{
3838
name: 'request_cookie',
39-
description: "Ask Vedal for a cookie. You can request a specific flavor, but it's up to Vedal to decide.",
39+
description: `Ask ${CONNECTION.userName} for a cookie. You can request a specific flavor, but it's up to ${CONNECTION.userName} to decide.`,
4040
schema: {
4141
type: 'object',
4242
properties: {
@@ -119,11 +119,11 @@ export function giveCookie(isRequested = false, defaultFlavor = 'Chocolate Chip'
119119
if (!flavor) {
120120
logOutput('INFO', 'No flavor given, canceling cookie');
121121
if (isRequested)
122-
NEURO.client?.sendContext("Vedal couldn't decide on a flavor for your cookie.");
122+
NEURO.client?.sendContext(`${CONNECTION.userName} couldn't decide on a flavor for your cookie.`);
123123
return;
124124
}
125125
logOutput('INFO', 'Giving cookie to Neuro');
126-
NEURO.client?.sendContext(`Vedal gave you a ${flavor} cookie!`);
126+
NEURO.client?.sendContext(`${CONNECTION.userName} gave you a ${flavor} cookie!`);
127127
});
128128
}
129129

@@ -136,5 +136,5 @@ export function denyCookie() {
136136
}
137137

138138
logOutput('INFO', 'Denying cookie to Neuro');
139-
NEURO.client?.sendContext('Vedal denied you the cookie.');
139+
NEURO.client?.sendContext(`${CONNECTION.userName} denied you the cookie.`);
140140
}

0 commit comments

Comments
 (0)