Skip to content

Commit a5c77d6

Browse files
authored
Merge pull request microsoft#199581 from microsoft/roblou/popular-thrush
Implement addCompleteRequest correctly
2 parents 28560a6 + d309794 commit a5c77d6

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/vs/workbench/contrib/chat/common/chatServiceImpl.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ import { IWorkspaceContextService } from 'vs/platform/workspace/common/workspace
2323
import { IChatAgentCommand, IChatAgentData, IChatAgentRequest, IChatAgentService } from 'vs/workbench/contrib/chat/common/chatAgents';
2424
import { CONTEXT_PROVIDER_EXISTS } from 'vs/workbench/contrib/chat/common/chatContextKeys';
2525
import { ChatModel, ChatModelInitState, ChatRequestModel, ChatWelcomeMessageModel, IChatModel, ISerializableChatData, ISerializableChatsData } from 'vs/workbench/contrib/chat/common/chatModel';
26-
import { ChatRequestAgentPart, ChatRequestAgentSubcommandPart, ChatRequestSlashCommandPart } from 'vs/workbench/contrib/chat/common/chatParserTypes';
26+
import { ChatRequestAgentPart, ChatRequestAgentSubcommandPart, ChatRequestSlashCommandPart, IParsedChatRequest } from 'vs/workbench/contrib/chat/common/chatParserTypes';
2727
import { ChatMessageRole, IChatMessage } from 'vs/workbench/contrib/chat/common/chatProvider';
2828
import { ChatRequestParser } from 'vs/workbench/contrib/chat/common/chatRequestParser';
2929
import { IChat, IChatCompleteResponse, IChatDetail, IChatDynamicRequest, IChatFollowup, IChatProgress, IChatProvider, IChatProviderInfo, IChatResponse, IChatService, IChatTransferredSessionData, IChatUserActionEvent, InteractiveSessionCopyKind, InteractiveSessionVoteDirection } from 'vs/workbench/contrib/chat/common/chatService';
@@ -633,7 +633,7 @@ export class ChatService extends Disposable implements IChatService {
633633
return Array.from(this._providers.keys());
634634
}
635635

636-
async addCompleteRequest(sessionId: string, message: string, response: IChatCompleteResponse): Promise<void> {
636+
async addCompleteRequest(sessionId: string, message: IParsedChatRequest | string, response: IChatCompleteResponse): Promise<void> {
637637
this.trace('addCompleteRequest', `message: ${message}`);
638638

639639
const model = this._sessionModels.get(sessionId);
@@ -642,7 +642,9 @@ export class ChatService extends Disposable implements IChatService {
642642
}
643643

644644
await model.waitForInitialization();
645-
const parsedRequest = await this.instantiationService.createInstance(ChatRequestParser).parseChatRequest(sessionId, message);
645+
const parsedRequest = typeof message === 'string' ?
646+
await this.instantiationService.createInstance(ChatRequestParser).parseChatRequest(sessionId, message) :
647+
message;
646648
const request = model.addRequest(parsedRequest);
647649
if (typeof response.message === 'string') {
648650
model.acceptResponseProgress(request, { content: response.message, kind: 'content' });

0 commit comments

Comments
 (0)