From 3db91bdc8e8816ff86fbb26326caeaa998940f9c Mon Sep 17 00:00:00 2001 From: darkskygit Date: Fri, 9 May 2025 03:59:03 +0000 Subject: [PATCH] feat(server): expose threshold (#12023) --- .../src/graphql/copilot-context-match-docs.gql | 4 ++-- .../src/graphql/copilot-context-match-files.gql | 4 ++-- packages/common/graphql/src/graphql/index.ts | 13 +++++++++---- packages/common/graphql/src/schema.ts | 3 +++ 4 files changed, 16 insertions(+), 8 deletions(-) diff --git a/packages/common/graphql/src/graphql/copilot-context-match-docs.gql b/packages/common/graphql/src/graphql/copilot-context-match-docs.gql index 464f50517d..83bef6bc6b 100644 --- a/packages/common/graphql/src/graphql/copilot-context-match-docs.gql +++ b/packages/common/graphql/src/graphql/copilot-context-match-docs.gql @@ -1,8 +1,8 @@ -query matchWorkspaceDocs($contextId: String!, $content: String!, $limit: SafeInt) { +query matchWorkspaceDocs($contextId: String!, $content: String!, $limit: SafeInt, $scopedThreshold: Float, $threshold: Float) { currentUser { copilot { contexts(contextId: $contextId) { - matchWorkspaceDocs(content: $content, limit: $limit) { + matchWorkspaceDocs(content: $content, limit: $limit, scopedThreshold: $scopedThreshold, threshold: $threshold) { docId chunk content diff --git a/packages/common/graphql/src/graphql/copilot-context-match-files.gql b/packages/common/graphql/src/graphql/copilot-context-match-files.gql index 9d8cfd7a82..a6e6fb4b07 100644 --- a/packages/common/graphql/src/graphql/copilot-context-match-files.gql +++ b/packages/common/graphql/src/graphql/copilot-context-match-files.gql @@ -1,8 +1,8 @@ -query matchFiles($contextId: String!, $content: String!, $limit: SafeInt) { +query matchFiles($contextId: String!, $content: String!, $limit: SafeInt, $threshold: Float) { currentUser { copilot { contexts(contextId: $contextId) { - matchFiles(content: $content, limit: $limit) { + matchFiles(content: $content, limit: $limit, threshold: $threshold) { fileId chunk content diff --git a/packages/common/graphql/src/graphql/index.ts b/packages/common/graphql/src/graphql/index.ts index c56725cfd9..5524ef6a52 100644 --- a/packages/common/graphql/src/graphql/index.ts +++ b/packages/common/graphql/src/graphql/index.ts @@ -501,11 +501,16 @@ export const matchContextQuery = { export const matchWorkspaceDocsQuery = { id: 'matchWorkspaceDocsQuery' as const, op: 'matchWorkspaceDocs', - query: `query matchWorkspaceDocs($contextId: String!, $content: String!, $limit: SafeInt) { + query: `query matchWorkspaceDocs($contextId: String!, $content: String!, $limit: SafeInt, $scopedThreshold: Float, $threshold: Float) { currentUser { copilot { contexts(contextId: $contextId) { - matchWorkspaceDocs(content: $content, limit: $limit) { + matchWorkspaceDocs( + content: $content + limit: $limit + scopedThreshold: $scopedThreshold + threshold: $threshold + ) { docId chunk content @@ -520,11 +525,11 @@ export const matchWorkspaceDocsQuery = { export const matchFilesQuery = { id: 'matchFilesQuery' as const, op: 'matchFiles', - query: `query matchFiles($contextId: String!, $content: String!, $limit: SafeInt) { + query: `query matchFiles($contextId: String!, $content: String!, $limit: SafeInt, $threshold: Float) { currentUser { copilot { contexts(contextId: $contextId) { - matchFiles(content: $content, limit: $limit) { + matchFiles(content: $content, limit: $limit, threshold: $threshold) { fileId chunk content diff --git a/packages/common/graphql/src/schema.ts b/packages/common/graphql/src/schema.ts index 98bf7ba685..add6ebba79 100644 --- a/packages/common/graphql/src/schema.ts +++ b/packages/common/graphql/src/schema.ts @@ -3017,6 +3017,8 @@ export type MatchWorkspaceDocsQueryVariables = Exact<{ contextId: Scalars['String']['input']; content: Scalars['String']['input']; limit?: InputMaybe; + scopedThreshold?: InputMaybe; + threshold?: InputMaybe; }>; export type MatchWorkspaceDocsQuery = { @@ -3043,6 +3045,7 @@ export type MatchFilesQueryVariables = Exact<{ contextId: Scalars['String']['input']; content: Scalars['String']['input']; limit?: InputMaybe; + threshold?: InputMaybe; }>; export type MatchFilesQuery = {