mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-08-07 12:29:50 +08:00
feat(server): converge legacy compatibility (#15426)
#### PR Dependency Tree * **PR #15426** 👈 This tree was auto-generated by [Charcoal](https://github.com/danerwilliams/charcoal) <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Added workspace BYOK profiles with provider/model catalogs, capability validation, connection probing, credential rotation, reordering, and secure local leases. * Added Copilot route options, selectable targets, managed tiers, explicit profile/model overrides, and improved streaming with tool callbacks and abort support. * Added Copilot availability controls to prevent access when the feature is disabled. * **Changes** * Simplified Copilot configuration and removed legacy provider-specific settings. * Removed obsolete model, token-cost, transcript strategy, and provider metadata fields from public responses. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
This commit is contained in:
@@ -1,17 +0,0 @@
|
||||
query getPromptModels($promptName: String!) {
|
||||
currentUser {
|
||||
copilot {
|
||||
models(promptName: $promptName) {
|
||||
defaultModel
|
||||
optionalModels {
|
||||
id
|
||||
name
|
||||
}
|
||||
proModels {
|
||||
id
|
||||
name
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
query getCopilotRouteOptions($promptName: String!) {
|
||||
currentUser {
|
||||
copilot {
|
||||
routeOptions(promptName: $promptName) {
|
||||
routeId
|
||||
defaultTargetId
|
||||
choices {
|
||||
id
|
||||
displayName
|
||||
minimumTier
|
||||
available
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -4,12 +4,9 @@ fragment CopilotChatHistory on CopilotHistories {
|
||||
docId
|
||||
parentSessionId
|
||||
promptName
|
||||
model
|
||||
optionalModels
|
||||
action
|
||||
pinned
|
||||
title
|
||||
tokens
|
||||
messages {
|
||||
id
|
||||
role
|
||||
|
||||
@@ -12,12 +12,9 @@ export const copilotChatHistoryFragment = `fragment CopilotChatHistory on Copilo
|
||||
docId
|
||||
parentSessionId
|
||||
promptName
|
||||
model
|
||||
optionalModels
|
||||
action
|
||||
pinned
|
||||
title
|
||||
tokens
|
||||
messages {
|
||||
id
|
||||
role
|
||||
@@ -1432,28 +1429,6 @@ export const createCopilotMessageMutation = {
|
||||
file: true,
|
||||
};
|
||||
|
||||
export const getPromptModelsQuery = {
|
||||
id: 'getPromptModelsQuery' as const,
|
||||
op: 'getPromptModels',
|
||||
query: `query getPromptModels($promptName: String!) {
|
||||
currentUser {
|
||||
copilot {
|
||||
models(promptName: $promptName) {
|
||||
defaultModel
|
||||
optionalModels {
|
||||
id
|
||||
name
|
||||
}
|
||||
proModels {
|
||||
id
|
||||
name
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}`,
|
||||
};
|
||||
|
||||
export const copilotQuotaQuery = {
|
||||
id: 'copilotQuotaQuery' as const,
|
||||
op: 'copilotQuota',
|
||||
@@ -1469,6 +1444,27 @@ export const copilotQuotaQuery = {
|
||||
}`,
|
||||
};
|
||||
|
||||
export const getCopilotRouteOptionsQuery = {
|
||||
id: 'getCopilotRouteOptionsQuery' as const,
|
||||
op: 'getCopilotRouteOptions',
|
||||
query: `query getCopilotRouteOptions($promptName: String!) {
|
||||
currentUser {
|
||||
copilot {
|
||||
routeOptions(promptName: $promptName) {
|
||||
routeId
|
||||
defaultTargetId
|
||||
choices {
|
||||
id
|
||||
displayName
|
||||
minimumTier
|
||||
available
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}`,
|
||||
};
|
||||
|
||||
export const cleanupCopilotSessionMutation = {
|
||||
id: 'cleanupCopilotSessionMutation' as const,
|
||||
op: 'cleanupCopilotSession',
|
||||
@@ -2985,51 +2981,94 @@ export const workspaceBlobQuotaQuery = {
|
||||
}`,
|
||||
};
|
||||
|
||||
export const clearWorkspaceByokConfigsMutation = {
|
||||
id: 'clearWorkspaceByokConfigsMutation' as const,
|
||||
op: 'clearWorkspaceByokConfigs',
|
||||
query: `mutation clearWorkspaceByokConfigs($workspaceId: String!) {
|
||||
clearWorkspaceByokConfigs(workspaceId: $workspaceId)
|
||||
export const deleteWorkspaceByokProfileMutation = {
|
||||
id: 'deleteWorkspaceByokProfileMutation' as const,
|
||||
op: 'deleteWorkspaceByokProfile',
|
||||
query: `mutation deleteWorkspaceByokProfile($workspaceId: String!, $profileId: ID!) {
|
||||
deleteWorkspaceByokProfile(workspaceId: $workspaceId, profileId: $profileId)
|
||||
}`,
|
||||
};
|
||||
|
||||
export const deleteWorkspaceByokConfigMutation = {
|
||||
id: 'deleteWorkspaceByokConfigMutation' as const,
|
||||
op: 'deleteWorkspaceByokConfig',
|
||||
query: `mutation deleteWorkspaceByokConfig($workspaceId: String!, $id: ID!) {
|
||||
deleteWorkspaceByokConfig(workspaceId: $workspaceId, id: $id)
|
||||
}`,
|
||||
};
|
||||
|
||||
export const reorderWorkspaceByokConfigsMutation = {
|
||||
id: 'reorderWorkspaceByokConfigsMutation' as const,
|
||||
op: 'reorderWorkspaceByokConfigs',
|
||||
query: `mutation reorderWorkspaceByokConfigs($input: ReorderWorkspaceByokConfigsInput!) {
|
||||
reorderWorkspaceByokConfigs(input: $input) {
|
||||
id
|
||||
sortOrder
|
||||
export const probeWorkspaceByokProfileMutation = {
|
||||
id: 'probeWorkspaceByokProfileMutation' as const,
|
||||
op: 'probeWorkspaceByokProfile',
|
||||
query: `mutation probeWorkspaceByokProfile($input: ProbeWorkspaceByokProfileInput!) {
|
||||
probeWorkspaceByokProfile(input: $input) {
|
||||
definitionFingerprint
|
||||
stale
|
||||
connection {
|
||||
kind
|
||||
testedAt
|
||||
errorKind
|
||||
}
|
||||
models {
|
||||
modelId
|
||||
checks {
|
||||
operation
|
||||
status {
|
||||
kind
|
||||
testedAt
|
||||
errorKind
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}`,
|
||||
};
|
||||
|
||||
export const testWorkspaceByokConfigMutation = {
|
||||
id: 'testWorkspaceByokConfigMutation' as const,
|
||||
op: 'testWorkspaceByokConfig',
|
||||
query: `mutation testWorkspaceByokConfig($input: TestWorkspaceByokConfigInput!) {
|
||||
testWorkspaceByokConfig(input: $input) {
|
||||
ok
|
||||
status
|
||||
message
|
||||
export const probeWorkspaceByokDraftMutation = {
|
||||
id: 'probeWorkspaceByokDraftMutation' as const,
|
||||
op: 'probeWorkspaceByokDraft',
|
||||
query: `mutation probeWorkspaceByokDraft($input: ProbeWorkspaceByokDraftInput!) {
|
||||
probeWorkspaceByokDraft(input: $input) {
|
||||
definitionFingerprint
|
||||
stale
|
||||
connection {
|
||||
kind
|
||||
testedAt
|
||||
errorKind
|
||||
}
|
||||
models {
|
||||
modelId
|
||||
checks {
|
||||
operation
|
||||
status {
|
||||
kind
|
||||
testedAt
|
||||
errorKind
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}`,
|
||||
};
|
||||
|
||||
export const upsertWorkspaceByokConfigMutation = {
|
||||
id: 'upsertWorkspaceByokConfigMutation' as const,
|
||||
op: 'upsertWorkspaceByokConfig',
|
||||
query: `mutation upsertWorkspaceByokConfig($input: UpsertWorkspaceByokConfigInput!) {
|
||||
upsertWorkspaceByokConfig(input: $input) {
|
||||
id
|
||||
export const createWorkspaceByokProfileMutation = {
|
||||
id: 'createWorkspaceByokProfileMutation' as const,
|
||||
op: 'createWorkspaceByokProfile',
|
||||
query: `mutation createWorkspaceByokProfile($input: CreateWorkspaceByokProfileInput!) {
|
||||
createWorkspaceByokProfile(input: $input) {
|
||||
profileId
|
||||
}
|
||||
}`,
|
||||
};
|
||||
|
||||
export const replaceWorkspaceByokProfileMutation = {
|
||||
id: 'replaceWorkspaceByokProfileMutation' as const,
|
||||
op: 'replaceWorkspaceByokProfile',
|
||||
query: `mutation replaceWorkspaceByokProfile($input: ReplaceWorkspaceByokProfileInput!) {
|
||||
replaceWorkspaceByokProfile(input: $input) {
|
||||
profileId
|
||||
}
|
||||
}`,
|
||||
};
|
||||
|
||||
export const rotateWorkspaceByokCredentialMutation = {
|
||||
id: 'rotateWorkspaceByokCredentialMutation' as const,
|
||||
op: 'rotateWorkspaceByokCredential',
|
||||
query: `mutation rotateWorkspaceByokCredential($input: RotateWorkspaceByokCredentialInput!) {
|
||||
rotateWorkspaceByokCredential(input: $input) {
|
||||
profileId
|
||||
}
|
||||
}`,
|
||||
};
|
||||
@@ -3045,6 +3084,18 @@ export const createWorkspaceByokLocalLeaseMutation = {
|
||||
}`,
|
||||
};
|
||||
|
||||
export const reorderWorkspaceByokProfilesMutation = {
|
||||
id: 'reorderWorkspaceByokProfilesMutation' as const,
|
||||
op: 'reorderWorkspaceByokProfiles',
|
||||
query: `mutation reorderWorkspaceByokProfiles($input: ReorderWorkspaceByokProfilesInput!) {
|
||||
reorderWorkspaceByokProfiles(input: $input) {
|
||||
profileId
|
||||
sortOrder
|
||||
revision
|
||||
}
|
||||
}`,
|
||||
};
|
||||
|
||||
export const workspaceByokSettingsQuery = {
|
||||
id: 'workspaceByokSettingsQuery' as const,
|
||||
op: 'workspaceByokSettings',
|
||||
@@ -3056,36 +3107,73 @@ export const workspaceByokSettingsQuery = {
|
||||
entitled
|
||||
serverEntitled
|
||||
localEntitled
|
||||
entitlementRequired
|
||||
allowedProviders
|
||||
localStorageSupported
|
||||
customEndpointSupported
|
||||
privateEndpointSupported
|
||||
hasAiPlan
|
||||
keys {
|
||||
id
|
||||
catalog {
|
||||
version
|
||||
providers {
|
||||
provider
|
||||
models {
|
||||
modelId
|
||||
displayName
|
||||
recommended
|
||||
capabilities {
|
||||
input
|
||||
output
|
||||
features
|
||||
attachmentKinds
|
||||
attachmentSources
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
profiles {
|
||||
profileId
|
||||
provider
|
||||
name
|
||||
description
|
||||
storage
|
||||
configured
|
||||
enabled
|
||||
endpoint
|
||||
endpointEditable
|
||||
sortOrder
|
||||
capabilities
|
||||
testStatus
|
||||
disabledReason
|
||||
lastTestedAt
|
||||
lastTestError
|
||||
lastUsedAt
|
||||
lastErrorAt
|
||||
lastError
|
||||
}
|
||||
warnings {
|
||||
featureKind
|
||||
reason
|
||||
requiredProviders
|
||||
revision
|
||||
definition {
|
||||
version
|
||||
endpoint {
|
||||
kind
|
||||
url
|
||||
}
|
||||
models {
|
||||
modelId
|
||||
enabled
|
||||
capabilities {
|
||||
input
|
||||
output
|
||||
features
|
||||
attachmentKinds
|
||||
attachmentSources
|
||||
}
|
||||
}
|
||||
}
|
||||
validation {
|
||||
definitionFingerprint
|
||||
credentialGeneration
|
||||
connection {
|
||||
kind
|
||||
testedAt
|
||||
errorKind
|
||||
}
|
||||
models {
|
||||
modelId
|
||||
checks {
|
||||
operation
|
||||
status {
|
||||
kind
|
||||
testedAt
|
||||
errorKind
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
byokUsage(from: $from, to: $to) {
|
||||
|
||||
@@ -1,3 +0,0 @@
|
||||
mutation clearWorkspaceByokConfigs($workspaceId: String!) {
|
||||
clearWorkspaceByokConfigs(workspaceId: $workspaceId)
|
||||
}
|
||||
@@ -1,3 +1,3 @@
|
||||
mutation deleteWorkspaceByokConfig($workspaceId: String!, $id: ID!) {
|
||||
deleteWorkspaceByokConfig(workspaceId: $workspaceId, id: $id)
|
||||
mutation deleteWorkspaceByokProfile($workspaceId: String!, $profileId: ID!) {
|
||||
deleteWorkspaceByokProfile(workspaceId: $workspaceId, profileId: $profileId)
|
||||
}
|
||||
|
||||
@@ -1,8 +0,0 @@
|
||||
mutation reorderWorkspaceByokConfigs(
|
||||
$input: ReorderWorkspaceByokConfigsInput!
|
||||
) {
|
||||
reorderWorkspaceByokConfigs(input: $input) {
|
||||
id
|
||||
sortOrder
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,23 @@
|
||||
mutation testWorkspaceByokConfig($input: TestWorkspaceByokConfigInput!) {
|
||||
testWorkspaceByokConfig(input: $input) {
|
||||
ok
|
||||
status
|
||||
message
|
||||
mutation probeWorkspaceByokProfile($input: ProbeWorkspaceByokProfileInput!) {
|
||||
probeWorkspaceByokProfile(input: $input) {
|
||||
definitionFingerprint
|
||||
stale
|
||||
connection { kind testedAt errorKind }
|
||||
models {
|
||||
modelId
|
||||
checks { operation status { kind testedAt errorKind } }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
mutation probeWorkspaceByokDraft($input: ProbeWorkspaceByokDraftInput!) {
|
||||
probeWorkspaceByokDraft(input: $input) {
|
||||
definitionFingerprint
|
||||
stale
|
||||
connection { kind testedAt errorKind }
|
||||
models {
|
||||
modelId
|
||||
checks { operation status { kind testedAt errorKind } }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,11 @@
|
||||
mutation upsertWorkspaceByokConfig($input: UpsertWorkspaceByokConfigInput!) {
|
||||
upsertWorkspaceByokConfig(input: $input) {
|
||||
id
|
||||
}
|
||||
mutation createWorkspaceByokProfile($input: CreateWorkspaceByokProfileInput!) {
|
||||
createWorkspaceByokProfile(input: $input) { profileId }
|
||||
}
|
||||
|
||||
mutation replaceWorkspaceByokProfile($input: ReplaceWorkspaceByokProfileInput!) {
|
||||
replaceWorkspaceByokProfile(input: $input) { profileId }
|
||||
}
|
||||
|
||||
mutation rotateWorkspaceByokCredential($input: RotateWorkspaceByokCredentialInput!) {
|
||||
rotateWorkspaceByokCredential(input: $input) { profileId }
|
||||
}
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
mutation reorderWorkspaceByokProfiles($input: ReorderWorkspaceByokProfilesInput!) {
|
||||
reorderWorkspaceByokProfiles(input: $input) {
|
||||
profileId
|
||||
sortOrder
|
||||
revision
|
||||
}
|
||||
}
|
||||
@@ -6,36 +6,59 @@ query workspaceByokSettings($id: String!, $from: DateTime!, $to: DateTime!) {
|
||||
entitled
|
||||
serverEntitled
|
||||
localEntitled
|
||||
entitlementRequired
|
||||
allowedProviders
|
||||
localStorageSupported
|
||||
customEndpointSupported
|
||||
privateEndpointSupported
|
||||
hasAiPlan
|
||||
keys {
|
||||
id
|
||||
catalog {
|
||||
version
|
||||
providers {
|
||||
provider
|
||||
models {
|
||||
modelId
|
||||
displayName
|
||||
recommended
|
||||
capabilities {
|
||||
input
|
||||
output
|
||||
features
|
||||
attachmentKinds
|
||||
attachmentSources
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
profiles {
|
||||
profileId
|
||||
provider
|
||||
name
|
||||
description
|
||||
storage
|
||||
configured
|
||||
enabled
|
||||
endpoint
|
||||
endpointEditable
|
||||
sortOrder
|
||||
capabilities
|
||||
testStatus
|
||||
disabledReason
|
||||
lastTestedAt
|
||||
lastTestError
|
||||
lastUsedAt
|
||||
lastErrorAt
|
||||
lastError
|
||||
}
|
||||
warnings {
|
||||
featureKind
|
||||
reason
|
||||
requiredProviders
|
||||
revision
|
||||
definition {
|
||||
version
|
||||
endpoint { kind url }
|
||||
models {
|
||||
modelId
|
||||
enabled
|
||||
capabilities {
|
||||
input
|
||||
output
|
||||
features
|
||||
attachmentKinds
|
||||
attachmentSources
|
||||
}
|
||||
}
|
||||
}
|
||||
validation {
|
||||
definitionFingerprint
|
||||
credentialGeneration
|
||||
connection { kind testedAt errorKind }
|
||||
models {
|
||||
modelId
|
||||
checks { operation status { kind testedAt errorKind } }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
byokUsage(from: $from, to: $to) {
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user