File tree Expand file tree Collapse file tree 2 files changed +7
-6
lines changed
packages/core/src/codewhispererChat/controllers/chat Expand file tree Collapse file tree 2 files changed +7
-6
lines changed Original file line number Diff line number Diff line change @@ -980,12 +980,12 @@ export class ChatController {
980980 if ( Array . isArray ( prompts ) && prompts . length > 0 ) {
981981 triggerPayload . additionalContextLengths = this . telemetryHelper . getContextLengths ( prompts )
982982 for ( const prompt of prompts . slice ( 0 , 20 ) ) {
983- let description = prompt . description
984983 // Add system prompt for user prompts and workspace rules
985984 const contextType = this . telemetryHelper . getContextType ( prompt )
986- if ( contextType === 'rule' || contextType === 'prompt' ) {
987- description = `You must follow the instructions in ${ prompt . relativePath } . Below are lines ${ prompt . startLine } -${ prompt . endLine } of this file:\n`
988- }
985+ const description =
986+ contextType === 'rule' || contextType === 'prompt'
987+ ? `You must follow the instructions in ${ prompt . relativePath } . Below are lines ${ prompt . startLine } -${ prompt . endLine } of this file:\n`
988+ : prompt . description
989989 const entry = {
990990 name : prompt . name . substring ( 0 , aditionalContentNameLimit ) ,
991991 description : description . substring ( 0 , aditionalContentNameLimit ) ,
Original file line number Diff line number Diff line change @@ -43,6 +43,7 @@ import { getSelectedCustomization } from '../../../codewhisperer/util/customizat
4343import { undefinedIfEmpty } from '../../../shared/utilities/textUtilities'
4444import { AdditionalContextPrompt } from '../../../amazonq/lsp/types'
4545import { getUserPromptsDirectory , promptFileExtension } from '../../constants'
46+ import { isInDirectory } from '../../../shared/filesystemUtilities'
4647
4748export function logSendTelemetryEventFailure ( error : any ) {
4849 let requestId : string | undefined
@@ -149,9 +150,9 @@ export class CWCTelemetryHelper {
149150
150151 public getContextType ( prompt : AdditionalContextPrompt ) : string {
151152 if ( prompt . filePath . endsWith ( promptFileExtension ) ) {
152- if ( prompt . relativePath . startsWith ( path . join ( '.amazonq' , 'rules' ) ) ) {
153+ if ( isInDirectory ( path . join ( '.amazonq' , 'rules' ) , prompt . relativePath ) ) {
153154 return 'rule'
154- } else if ( prompt . filePath . startsWith ( getUserPromptsDirectory ( ) ) ) {
155+ } else if ( isInDirectory ( getUserPromptsDirectory ( ) , prompt . filePath ) ) {
155156 return 'prompt'
156157 }
157158 }
You can’t perform that action at this time.
0 commit comments