Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 2 additions & 18 deletions packages/amazonq/src/inlineChat/provider/inlineChatProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import { codeWhispererClient } from 'aws-core-vscode/codewhisperer'
import type { InlineChatEvent } from 'aws-core-vscode/codewhisperer'
import { InlineTask } from '../controller/inlineTask'
import { extractAuthFollowUp } from 'aws-core-vscode/amazonq'
import { defaultContextLengths } from 'aws-core-vscode/codewhispererChat'

export class InlineChatProvider {
private readonly editorContextExtractor: EditorContextExtractor
Expand Down Expand Up @@ -71,24 +72,7 @@ export class InlineChatProvider {
additionalContents: [],
documentReferences: [],
useRelevantDocuments: false,
contextLengths: {
additionalContextLengths: {
fileContextLength: 0,
promptContextLength: 0,
ruleContextLength: 0,
},
truncatedAdditionalContextLengths: {
fileContextLength: 0,
promptContextLength: 0,
ruleContextLength: 0,
},
workspaceContextLength: 0,
truncatedWorkspaceContextLength: 0,
userInputContextLength: 0,
truncatedUserInputContextLength: 0,
focusFileContextLength: 0,
truncatedFocusFileContextLength: 0,
},
contextLengths: defaultContextLengths,
},
triggerID
)
Expand Down
2 changes: 2 additions & 0 deletions packages/core/src/codewhispererChat/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,3 +53,5 @@ export const defaultContextLengths: ContextLengths = {
focusFileContextLength: 0,
truncatedFocusFileContextLength: 0,
}

export const defaultStreamingResponseTimeoutInMs = 180_000
1 change: 1 addition & 0 deletions packages/core/src/codewhispererChat/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,4 @@ export { ChatSessionStorage } from './storages/chatSession'
export { TriggerEventsStorage } from './storages/triggerEvents'
export { ReferenceLogController } from './view/messages/referenceLogController'
export { extractLanguageNameFromFile } from './editor/context/file/languages'
export { defaultContextLengths } from './constants'
5 changes: 5 additions & 0 deletions packages/core/src/shared/clients/codewhispererChatClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { ConfiguredRetryStrategy } from '@smithy/util-retry'
import { getCodewhispererConfig } from '../../codewhisperer/client/codewhisperer'
import { AuthUtil } from '../../codewhisperer/util/authUtil'
import { getUserAgent } from '../telemetry/util'
import { defaultStreamingResponseTimeoutInMs } from '../../codewhispererChat/constants'

// Create a client for featureDev streaming based off of aws sdk v3
export async function createCodeWhispererChatStreamingClient(): Promise<CodeWhispererStreaming> {
Expand All @@ -17,6 +18,10 @@ export async function createCodeWhispererChatStreamingClient(): Promise<CodeWhis
endpoint: cwsprConfig.endpoint,
token: { token: bearerToken },
customUserAgent: getUserAgent(),
requestHandler: {
timeoutInMs: defaultStreamingResponseTimeoutInMs,
connectionTimeout: defaultStreamingResponseTimeoutInMs,
},
retryStrategy: new ConfiguredRetryStrategy(1, (attempt: number) => 500 + attempt ** 10),
})
return streamingClient
Expand Down