Skip to content

Commit

Permalink
WIP.
Browse files Browse the repository at this point in the history
  • Loading branch information
efritz committed Aug 14, 2023
1 parent 9c6ff10 commit f5d220b
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 31 deletions.
Binary file not shown.
22 changes: 11 additions & 11 deletions lib/shared/src/codebase-context/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -221,24 +221,24 @@ export class CodebaseContext {

const contextMessages: ContextMessage[] = []
for (const preciseContext of await this.graph.getContext()) {
const fence = '```'
const symbolName = `${preciseContext.symbol.scipName} (${preciseContext.symbol.scipDescriptorSuffix})`
// TODO - check comparison value
const repo =
preciseContext.repositoryName !== this.getCodebase()
? ` in repository ${preciseContext.repositoryName}`
: ''
const text = `The symbol ${symbolName} is defined in the file ${preciseContext.filepath}${repo} as:\n\n${fence}${preciseContext.definitionSnippet}${fence}`
console.log({ text }) // DEBUGGING

contextMessages.push({
speaker: 'human',
file: {
repoName: preciseContext.repositoryName,
fileName: preciseContext.filepath,
},
preciseContext,
text: `
As my coding assistant, use this context to help me answer the question asked:
Here is the precise snippet of code that is relevant to the current active file: ${preciseContext.definitionSnippet}
## Instruction
- Do not enclose your answer with tags.
- Do not remove code that might be being used by the other part of the code that was not shared.
- Your answers and suggestions should based on the provided context only.
- Make references to other part of the shared code.
- Do not suggest code that are not related to any of the shared context.
- Do not suggest anything that would break the working code.
`,
text,
})
contextMessages.push({ speaker: 'assistant', text: 'okay' })
}
Expand Down
2 changes: 1 addition & 1 deletion lib/ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
},
"dependencies": {
"@mdi/js": "^7.2.96",
"@sourcegraph/cody-shared": "https://github.com/sourcegraph/cody/releases/download/codyintel5/sourcegraph-cody-shared-0.0.0-codyintel.experimental.10.tgz",
"@sourcegraph/cody-shared": "workspace:*",
"classnames": "^2.3.2"
}
}
Binary file not shown.
21 changes: 2 additions & 19 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit f5d220b

Please sign in to comment.