This commit is contained in:
Oleg Solomko
2025-04-15 17:20:19 -07:00
parent 09ef9f2e4c
commit a4e2777ce1
2 changed files with 12 additions and 9 deletions

View File

@@ -8,6 +8,7 @@ import { IChatWidget } from '../../../../../chat.js';
import { getChatWidgetObject } from './attachInstructions.js';
import { URI } from '../../../../../../../../../base/common/uri.js';
import { extUri } from '../../../../../../../../../base/common/resources.js';
import { assertDefined } from '../../../../../../../../../base/common/types.js';
import { IViewsService } from '../../../../../../../../services/views/common/viewsService.js';
import { ICommandService } from '../../../../../../../../../platform/commands/common/commands.js';
@@ -67,7 +68,7 @@ export const runPromptFile = async (
};
/**
* Check if provided uri is already set as the implicit context
* Check if provided uri is already set as the implicit context.
*/
const isSetInImplicitContext = (
promptUri: URI,
@@ -78,11 +79,6 @@ const isSetInImplicitContext = (
return false;
}
if (implicitContext.value === undefined) {
// the user turned off implicit context in the settings
return false;
}
if (implicitContext.enabled === false) {
// the user disabled the implicit context in the chat view
return false;
@@ -92,6 +88,13 @@ const isSetInImplicitContext = (
return false;
}
// we expect all implicit prompt file attachments
// to have the `value` property to be present
assertDefined(
implicitContext.value,
'Prompt value must always be defined.',
);
const uri = URI.isUri(implicitContext.value)
? implicitContext.value
: implicitContext.value.uri;

View File

@@ -9,11 +9,11 @@ import { ResourceLabels } from '../../../../../browser/labels.js';
import { Disposable } from '../../../../../../base/common/lifecycle.js';
import { ILogService } from '../../../../../../platform/log/common/log.js';
import { InstructionsAttachmentWidget } from './promptInstructionsWidget.js';
import { PROMPT_LANGUAGE_ID } from '../../../common/promptSyntax/constants.js';
import { IModelService } from '../../../../../../editor/common/services/model.js';
import { ILanguageService } from '../../../../../../editor/common/languages/language.js';
import { IInstantiationService } from '../../../../../../platform/instantiation/common/instantiation.js';
import { ChatPromptAttachmentsCollection } from '../../chatAttachmentModel/chatPromptAttachmentsCollection.js';
import { ILanguageService } from '../../../../../../editor/common/languages/language.js';
import { IModelService } from '../../../../../../editor/common/services/model.js';
import { PROMPT_LANGUAGE_ID } from '../../../common/promptSyntax/constants.js';
/**
* Widget for a collection of prompt instructions attachments.