feat(server): add hints for context files (#13444)

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

* **New Features**
* Attachments (files) are now included in the conversation context,
allowing users to reference files during chat sessions.
* Added a new "blobRead" tool enabling secure, permission-checked
reading of attachment content in chat sessions.

* **Improvements**
* Enhanced chat session preparation to always include relevant context
files.
* System messages now clearly display attached files and selected
content only when available, improving context clarity for users.
* Updated tool-calling guidelines to ensure user workspace is searched
even when attachment content suffices.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
This commit is contained in:
DarkSky
2025-08-08 17:32:52 +08:00
committed by GitHub
parent 4005f40b16
commit 3cfb0a43af
9 changed files with 172 additions and 14 deletions

View File

@@ -203,6 +203,19 @@ export class ContextSession implements AsyncDisposable {
return this.config.files.find(f => f.id === fileId);
}
async getFileContent(
fileId: string,
chunk?: number
): Promise<string | undefined> {
const file = this.getFile(fileId);
if (!file) return undefined;
return this.models.copilotContext.getFileContent(
this.contextId,
fileId,
chunk
);
}
async removeFile(fileId: string): Promise<boolean> {
await this.models.copilotContext.deleteFileEmbedding(
this.contextId,