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

This file was deleted.

This file was deleted.

98 changes: 0 additions & 98 deletions packages/core/src/codewhispererChat/controllers/chat/controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -521,7 +521,6 @@ export class ChatController {
commands: [{ command: commandName, description: commandDescription }],
})
}
// const symbolsCmd: QuickActionCommand = contextCommand[0].commands?.[3]
const promptsCmd: QuickActionCommand = contextCommand[0].commands?.[4]

// Check for user prompts
Expand Down Expand Up @@ -553,47 +552,7 @@ export class ChatController {
icon: 'list-add' as MynahIconsType,
})

// const lspClientReady = await LspClient.instance.waitUntilReady()
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is the old chat code path. We no longer start the indexing library for it. Hence we just remove this code to minimize our change in #7480

// if (lspClientReady) {
// const contextCommandItems = await LspClient.instance.getContextCommandItems()
// const folderCmd: QuickActionCommand = contextCommand[0].commands?.[1]
// const filesCmd: QuickActionCommand = contextCommand[0].commands?.[2]

// for (const contextCommandItem of contextCommandItems) {
// const wsFolderName = path.basename(contextCommandItem.workspaceFolder)
// if (contextCommandItem.type === 'file') {
// filesCmd.children?.[0].commands.push({
// command: path.basename(contextCommandItem.relativePath),
// description: path.join(wsFolderName, contextCommandItem.relativePath),
// route: [contextCommandItem.workspaceFolder, contextCommandItem.relativePath],
// label: 'file' as ContextCommandItemType,
// id: contextCommandItem.id,
// icon: 'file' as MynahIconsType,
// })
// } else if (contextCommandItem.type === 'folder') {
// folderCmd.children?.[0].commands.push({
// command: path.basename(contextCommandItem.relativePath),
// description: path.join(wsFolderName, contextCommandItem.relativePath),
// route: [contextCommandItem.workspaceFolder, contextCommandItem.relativePath],
// label: 'folder' as ContextCommandItemType,
// id: contextCommandItem.id,
// icon: 'folder' as MynahIconsType,
// })
// } else if (contextCommandItem.symbol && symbolsCmd.children) {
// symbolsCmd.children?.[0].commands.push({
// command: contextCommandItem.symbol.name,
// description: `${contextCommandItem.symbol.kind}, ${path.join(wsFolderName, contextCommandItem.relativePath)}, L${contextCommandItem.symbol.range.start.line}-${contextCommandItem.symbol.range.end.line}`,
// route: [contextCommandItem.workspaceFolder, contextCommandItem.relativePath],
// label: 'code' as ContextCommandItemType,
// id: contextCommandItem.id,
// icon: 'code-block' as MynahIconsType,
// })
// }
// }
// }

this.messenger.sendContextCommandData(contextCommand)
// void LspController.instance.updateContextCommandSymbolsOnce()
}

private handlePromptCreate(tabID: string) {
Expand Down Expand Up @@ -1038,45 +997,6 @@ export class ChatController {
return []
}
workspaceFolders.sort()
// const workspaceFolder = workspaceFolders[0]
// for (const contextCommand of contextCommands) {
// session.relativePathToWorkspaceRoot.set(contextCommand.workspaceFolder, contextCommand.workspaceFolder)
// }
// const prompts: any[] = []
// try {
// // prompts = await LspClient.instance.getContextCommandPrompt(contextCommands)
// } catch (e) {
// // todo: handle @workspace used before indexing is ready
// getLogger().verbose(`Could not get context command prompts: ${e}`)
// }

// triggerPayload.contextLengths.additionalContextLengths = this.telemetryHelper.getContextLengths(prompts)
// for (const prompt of prompts.slice(0, 20)) {
// // Add system prompt for user prompts and workspace rules
// const contextType = this.telemetryHelper.getContextType(prompt)
// const description =
// contextType === 'rule' || contextType === 'prompt'
// ? `You must follow the instructions in ${prompt.relativePath}. Below are lines ${prompt.startLine}-${prompt.endLine} of this file:\n`
// : prompt.description

// // Handle user prompts outside the workspace
// const relativePath = prompt.filePath.startsWith(getUserPromptsDirectory())
// ? path.basename(prompt.filePath)
// : path.relative(workspaceFolder, prompt.filePath)

// const entry = {
// name: prompt.name.substring(0, aditionalContentNameLimit),
// description: description.substring(0, aditionalContentNameLimit),
// innerContext: prompt.content.substring(0, additionalContentInnerContextLimit),
// type: contextType,
// relativePath: relativePath,
// startLine: prompt.startLine,
// endLine: prompt.endLine,
// }

// triggerPayload.additionalContents.push(entry)
// }
// getLogger().info(`Retrieved chunks of additional context count: ${triggerPayload.additionalContents.length} `)
}

private async generateResponse(
Expand Down Expand Up @@ -1124,24 +1044,6 @@ export class ChatController {
if (triggerPayload.useRelevantDocuments) {
triggerPayload.message = triggerPayload.message.replace(/@workspace/, '')
if (CodeWhispererSettings.instance.isLocalIndexEnabled()) {
// const start = performance.now()
// const relevantTextDocuments = await LspController.instance.query(triggerPayload.message)
// for (const relevantDocument of relevantTextDocuments) {
// if (relevantDocument.text && relevantDocument.text.length > 0) {
// triggerPayload.contextLengths.workspaceContextLength += relevantDocument.text.length
// if (relevantDocument.text.length > workspaceChunkMaxSize) {
// relevantDocument.text = relevantDocument.text.substring(0, workspaceChunkMaxSize)
// getLogger().debug(`Truncating @workspace chunk: ${relevantDocument.relativeFilePath} `)
// }
// triggerPayload.relevantTextDocuments.push(relevantDocument)
// }
// }
// for (const doc of triggerPayload.relevantTextDocuments) {
// getLogger().info(
// `amazonq: Using workspace files ${doc.relativeFilePath}, content(partial): ${doc.text?.substring(0, 200)}, start line: ${doc.startLine}, end line: ${doc.endLine}`
// )
// }
// triggerPayload.projectContextQueryLatencyMs = performance.now() - start
} else {
this.messenger.sendOpenSettingsMessage(triggerID, tabID)
return
Expand Down
Loading