mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-24 01:42:55 +08:00
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:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user