Skip to content

Commit 7c920b1

Browse files
committed
Merge branch 'feature/flare-iam' of github.com:liramon1/aws-toolkit-vscode into feature/flare-iam
2 parents ddf6866 + 8bf21d9 commit 7c920b1

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

packages/amazonq/src/inlineChat/provider/inlineChatProvider.ts

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,10 @@ export class InlineChatProvider {
6969
}
7070

7171
public async processPromptMessageLSP(message: PromptMessage): Promise<InlineChatResult> {
72+
if (!AuthUtil.instance.isSsoSession()) {
73+
throw new ToolkitError('Inline chat is only available with SSO authentication')
74+
}
75+
7276
// TODO: handle partial responses.
7377
getLogger().info('Making inline chat request with message %O', message)
7478
const params = this.getCurrentEditorParams(message.message ?? '')
@@ -83,6 +87,10 @@ export class InlineChatProvider {
8387

8488
// TODO: remove in favor of LSP implementation.
8589
public async processPromptMessage(message: PromptMessage) {
90+
if (!AuthUtil.instance.isSsoSession()) {
91+
throw new ToolkitError('Inline chat is only available with SSO authentication')
92+
}
93+
8694
return this.editorContextExtractor
8795
.extractContextForTrigger('ChatMessage')
8896
.then((context) => {
@@ -186,13 +194,7 @@ export class InlineChatProvider {
186194
response = await session.chatSso(request)
187195
} else {
188196
// Call sendMessage because Q Developer Streaming Client does not have generateAssistantResponse
189-
const { sendMessageResponse, ...rest } = await session.chatIam(request)
190-
// Convert sendMessageCommandOutput to GenerateAssistantResponseCommandOutput
191-
response = {
192-
generateAssistantResponseResponse: sendMessageResponse,
193-
conversationId: session.sessionIdentifier,
194-
...rest
195-
}
197+
throw new ToolkitError('Inline chat is only available with SSO authentication')
196198
}
197199
getLogger().info(
198200
`response to tab: ${tabID} conversationID: ${session.sessionIdentifier} requestID: ${response.$metadata.requestId} metadata: %O`,

0 commit comments

Comments
 (0)