Skip to content

Commit 1fa0415

Browse files
committed
fix: circular dependencies
1 parent e978cfd commit 1fa0415

File tree

3 files changed

+30
-16
lines changed

3 files changed

+30
-16
lines changed
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
/*!
2+
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3+
* SPDX-License-Identifier: Apache-2.0
4+
*/
5+
import * as path from 'path'
6+
import fs from '../shared/fs/fs'
7+
8+
export const promptFileExtension = '.md'
9+
10+
export const additionalContentInnerContextLimit = 8192
11+
12+
export const aditionalContentNameLimit = 1024
13+
14+
// temporary limit for @workspace and @file combined context length
15+
export const contextMaxLength = 40_000
16+
17+
export const getUserPromptsDirectory = () => {
18+
return path.join(fs.getUserHomeDir(), '.aws', 'amazonq', 'prompts')
19+
}
20+
21+
export const createSavedPromptCommandId = 'create-saved-prompt'

packages/core/src/codewhispererChat/controllers/chat/controller.ts

Lines changed: 8 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,14 @@ import { workspaceCommand } from '../../../amazonq/webview/ui/tabs/constants'
7171
import fs from '../../../shared/fs/fs'
7272
import { FeatureConfigProvider, Features } from '../../../shared/featureConfig'
7373
import { i18n } from '../../../shared/i18n-helper'
74+
import {
75+
getUserPromptsDirectory,
76+
promptFileExtension,
77+
createSavedPromptCommandId,
78+
aditionalContentNameLimit,
79+
additionalContentInnerContextLimit,
80+
contextMaxLength,
81+
} from '../../constants'
7482

7583
export interface ChatControllerMessagePublishers {
7684
readonly processPromptChatMessage: MessagePublisher<PromptMessage>
@@ -122,21 +130,6 @@ export interface ChatControllerMessageListeners {
122130
readonly processFileClick: MessageListener<FileClick>
123131
}
124132

125-
const promptFileExtension = '.md'
126-
127-
const additionalContentInnerContextLimit = 8192
128-
129-
const aditionalContentNameLimit = 1024
130-
131-
// temporary limit for @workspace and @file combined context length
132-
const contextMaxLength = 40_000
133-
134-
export const getUserPromptsDirectory = () => {
135-
return path.join(fs.getUserHomeDir(), '.aws', 'amazonq', 'prompts')
136-
}
137-
138-
const createSavedPromptCommandId = 'create-saved-prompt'
139-
140133
export class ChatController {
141134
private readonly sessionStorage: ChatSessionStorage
142135
private readonly triggerEventsStorage: TriggerEventsStorage

packages/core/src/codewhispererChat/controllers/chat/telemetryHelper.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ import { AuthUtil } from '../../../codewhisperer/util/authUtil'
4040
import { getSelectedCustomization } from '../../../codewhisperer/util/customizationUtil'
4141
import { undefinedIfEmpty } from '../../../shared/utilities/textUtilities'
4242
import { AdditionalContextPrompt } from '../../../amazonq/lsp/types'
43-
import { getUserPromptsDirectory } from './controller'
43+
import { getUserPromptsDirectory } from '../../constants'
4444

4545
export function logSendTelemetryEventFailure(error: any) {
4646
let requestId: string | undefined

0 commit comments

Comments
 (0)