feat(server): attachment embedding (#13348)

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

* **New Features**
* Added support for managing "blobs" in Copilot context, including
adding and removing blobs via new GraphQL mutations and UI fields.
* Introduced tracking and querying of blob embeddings within workspaces,
enabling search and similarity matching for blob content.
* Extended Copilot context and workspace APIs, schema, and UI to display
and manage blobs alongside existing documents and files.

* **Bug Fixes**
* Updated context and embedding status logic to handle blobs, ensuring
accurate status reporting and embedding management.

* **Tests**
* Added and updated test cases and snapshots to cover blob embedding
insertion, matching, and removal scenarios.

* **Documentation**
* Updated GraphQL schema and TypeScript types to reflect new
blob-related fields and mutations.

* **Chores**
* Refactored and cleaned up code to support new blob entity and
embedding logic, including renaming and updating internal methods and
types.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
This commit is contained in:
DarkSky
2025-07-31 06:07:28 +08:00
committed by GitHub
parent b6a5bc052e
commit feb42e34be
24 changed files with 689 additions and 84 deletions
+26 -8
View File
@@ -2,6 +2,11 @@
# THIS FILE WAS AUTOMATICALLY GENERATED (DO NOT MODIFY)
# ------------------------------------------------------
input AddContextBlobInput {
blobId: String!
contextId: String!
}
input AddContextCategoryInput {
categoryId: String!
contextId: String!
@@ -226,6 +231,9 @@ type Copilot {
}
type CopilotContext {
"""list blobs in context"""
blobs: [CopilotContextBlob!]!
"""list collections in context"""
collections: [CopilotContextCategory!]!
@@ -247,16 +255,21 @@ type CopilotContext {
workspaceId: String!
}
type CopilotContextBlob {
createdAt: SafeInt!
id: ID!
status: ContextEmbedStatus
}
type CopilotContextCategory {
createdAt: SafeInt!
docs: [CopilotDocType!]!
docs: [CopilotContextDoc!]!
id: ID!
type: ContextCategories!
}
type CopilotContextDoc {
createdAt: SafeInt!
error: String
id: ID!
status: ContextEmbedStatus
}
@@ -281,12 +294,6 @@ type CopilotDocNotFoundDataType {
docId: String!
}
type CopilotDocType {
createdAt: SafeInt!
id: ID!
status: ContextEmbedStatus
}
type CopilotFailedToAddWorkspaceFileEmbeddingDataType {
message: String!
}
@@ -1163,6 +1170,9 @@ type Mutation {
acceptInviteById(inviteId: String!, sendAcceptMail: Boolean @deprecated(reason: "never used"), workspaceId: String @deprecated(reason: "never used")): Boolean!
activateLicense(license: String!, workspaceId: String!): License!
"""add a blob to context"""
addContextBlob(options: AddContextBlobInput!): CopilotContextBlob!
"""add a category to context"""
addContextCategory(options: AddContextCategoryInput!): CopilotContextCategory!
@@ -1266,6 +1276,9 @@ type Mutation {
"""Remove user avatar"""
removeAvatar: RemoveAvatar!
"""remove a blob from context"""
removeContextBlob(options: RemoveContextBlobInput!): Boolean!
"""remove a category from context"""
removeContextCategory(options: RemoveContextCategoryInput!): Boolean!
@@ -1617,6 +1630,11 @@ type RemoveAvatar {
success: Boolean!
}
input RemoveContextBlobInput {
blobId: String!
contextId: String!
}
input RemoveContextCategoryInput {
categoryId: String!
contextId: String!