Compare commits

...

2 Commits

Author SHA1 Message Date
Lakr
561ba414da Clean Up 2025-06-13 15:04:22 +08:00
Lakr
7d90fdd47b Update CodeGen Apollo 2025-06-13 13:39:48 +08:00
175 changed files with 2342 additions and 7971 deletions

View File

@@ -326,9 +326,13 @@
);
inputFileListPaths = (
);
inputPaths = (
);
name = "[CP] Embed Pods Frameworks";
outputFileListPaths = (
);
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-AFFiNE/Pods-AFFiNE-frameworks.sh\"\n";
@@ -521,7 +525,7 @@
"DEVELOPMENT_TEAM[sdk=iphoneos*]" = 73YMMDVT2M;
INFOPLIST_FILE = App/Info.plist;
INFOPLIST_KEY_LSApplicationCategoryType = "public.app-category.productivity";
IPHONEOS_DEPLOYMENT_TARGET = 16.4;
IPHONEOS_DEPLOYMENT_TARGET = 17.0;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
@@ -559,7 +563,7 @@
"DEVELOPMENT_TEAM[sdk=iphoneos*]" = 73YMMDVT2M;
INFOPLIST_FILE = App/Info.plist;
INFOPLIST_KEY_LSApplicationCategoryType = "public.app-category.productivity";
IPHONEOS_DEPLOYMENT_TARGET = 16.4;
IPHONEOS_DEPLOYMENT_TARGET = 17.0;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",

View File

@@ -5,35 +5,17 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/apollographql/apollo-ios",
"state" : {
"revision" : "39fea7617346c0731be25f61afd537e7032fb562",
"version" : "1.22.0"
"revision" : "9aa748d6f0526a744d49d59a2383dc7fdf9d645b",
"version" : "1.18.0"
}
},
{
"identity" : "chidorimenu",
"identity" : "sqlite.swift",
"kind" : "remoteSourceControl",
"location" : "https://github.com/Lakr233/ChidoriMenu",
"location" : "https://github.com/stephencelis/SQLite.swift.git",
"state" : {
"revision" : "3bb4323fe0f7f8f435d15656c3eeffcbb7c9c605",
"version" : "3.0.0"
}
},
{
"identity" : "splash",
"kind" : "remoteSourceControl",
"location" : "https://github.com/JohnSundell/Splash",
"state" : {
"revision" : "7f4df436eb78fe64fe2c32c58006e9949fa28ad8",
"version" : "0.16.0"
}
},
{
"identity" : "swift-cmark",
"kind" : "remoteSourceControl",
"location" : "https://github.com/swiftlang/swift-cmark",
"state" : {
"revision" : "b022b08312decdc46585e0b3440d97f6f22ef703",
"version" : "0.6.0"
"revision" : "a95fc6df17d108bd99210db5e8a9bac90fe984b8",
"version" : "0.15.3"
}
},
{

View File

@@ -5,35 +5,17 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/apollographql/apollo-ios.git",
"state" : {
"revision" : "39fea7617346c0731be25f61afd537e7032fb562",
"version" : "1.22.0"
"revision" : "9aa748d6f0526a744d49d59a2383dc7fdf9d645b",
"version" : "1.18.0"
}
},
{
"identity" : "chidorimenu",
"identity" : "sqlite.swift",
"kind" : "remoteSourceControl",
"location" : "https://github.com/Lakr233/ChidoriMenu",
"location" : "https://github.com/stephencelis/SQLite.swift.git",
"state" : {
"revision" : "3bb4323fe0f7f8f435d15656c3eeffcbb7c9c605",
"version" : "3.0.0"
}
},
{
"identity" : "splash",
"kind" : "remoteSourceControl",
"location" : "https://github.com/JohnSundell/Splash",
"state" : {
"revision" : "7f4df436eb78fe64fe2c32c58006e9949fa28ad8",
"version" : "0.16.0"
}
},
{
"identity" : "swift-cmark",
"kind" : "remoteSourceControl",
"location" : "https://github.com/swiftlang/swift-cmark",
"state" : {
"revision" : "b022b08312decdc46585e0b3440d97f6f22ef703",
"version" : "0.6.0"
"revision" : "a95fc6df17d108bd99210db5e8a9bac90fe984b8",
"version" : "0.15.3"
}
},
{

View File

@@ -14,7 +14,7 @@ let package = Package(
.library(name: "AffineGraphQL", targets: ["AffineGraphQL"]),
],
dependencies: [
.package(url: "https://github.com/apollographql/apollo-ios", exact: "1.22.0"),
.package(url: "https://github.com/apollographql/apollo-ios", exact: "1.18.0"),
],
targets: [
.target(

View File

@@ -0,0 +1,31 @@
// @generated
// This file was automatically generated and should not be edited.
@_exported import ApolloAPI
public struct License: AffineGraphQL.SelectionSet, Fragment {
public static var fragmentDefinition: StaticString {
#"fragment license on License { __typename expiredAt installedAt quantity recurring validatedAt variant }"#
}
public let __data: DataDict
public init(_dataDict: DataDict) { __data = _dataDict }
public static var __parentType: any ApolloAPI.ParentType { AffineGraphQL.Objects.License }
public static var __selections: [ApolloAPI.Selection] { [
.field("__typename", String.self),
.field("expiredAt", AffineGraphQL.DateTime?.self),
.field("installedAt", AffineGraphQL.DateTime.self),
.field("quantity", Int.self),
.field("recurring", GraphQLEnum<AffineGraphQL.SubscriptionRecurring>.self),
.field("validatedAt", AffineGraphQL.DateTime.self),
.field("variant", GraphQLEnum<AffineGraphQL.SubscriptionVariant>?.self),
] }
public var expiredAt: AffineGraphQL.DateTime? { __data["expiredAt"] }
public var installedAt: AffineGraphQL.DateTime { __data["installedAt"] }
public var quantity: Int { __data["quantity"] }
public var recurring: GraphQLEnum<AffineGraphQL.SubscriptionRecurring> { __data["recurring"] }
public var validatedAt: AffineGraphQL.DateTime { __data["validatedAt"] }
public var variant: GraphQLEnum<AffineGraphQL.SubscriptionVariant>? { __data["variant"] }
}

View File

@@ -7,27 +7,23 @@ public class AcceptInviteByInviteIdMutation: GraphQLMutation {
public static let operationName: String = "acceptInviteByInviteId"
public static let operationDocument: ApolloAPI.OperationDocument = .init(
definition: .init(
#"mutation acceptInviteByInviteId($workspaceId: String!, $inviteId: String!, $sendAcceptMail: Boolean) { acceptInviteById( workspaceId: $workspaceId inviteId: $inviteId sendAcceptMail: $sendAcceptMail ) }"#
#"mutation acceptInviteByInviteId($workspaceId: String!, $inviteId: String!) { acceptInviteById(workspaceId: $workspaceId, inviteId: $inviteId) }"#
))
public var workspaceId: String
public var inviteId: String
public var sendAcceptMail: GraphQLNullable<Bool>
public init(
workspaceId: String,
inviteId: String,
sendAcceptMail: GraphQLNullable<Bool>
inviteId: String
) {
self.workspaceId = workspaceId
self.inviteId = inviteId
self.sendAcceptMail = sendAcceptMail
}
public var __variables: Variables? { [
"workspaceId": workspaceId,
"inviteId": inviteId,
"sendAcceptMail": sendAcceptMail
"inviteId": inviteId
] }
public struct Data: AffineGraphQL.SelectionSet {
@@ -35,12 +31,11 @@ public class AcceptInviteByInviteIdMutation: GraphQLMutation {
public init(_dataDict: DataDict) { __data = _dataDict }
public static var __parentType: any ApolloAPI.ParentType { AffineGraphQL.Objects.Mutation }
#warning("Argument 'sendAcceptMail' of field 'acceptInviteById' is deprecated. Reason: 'never used'")
#warning("Argument 'workspaceId' of field 'acceptInviteById' is deprecated. Reason: 'never used'")
public static var __selections: [ApolloAPI.Selection] { [
.field("acceptInviteById", Bool.self, arguments: [
"workspaceId": .variable("workspaceId"),
"inviteId": .variable("inviteId"),
"sendAcceptMail": .variable("sendAcceptMail")
"inviteId": .variable("inviteId")
]),
] }

View File

@@ -7,7 +7,8 @@ public class ActivateLicenseMutation: GraphQLMutation {
public static let operationName: String = "activateLicense"
public static let operationDocument: ApolloAPI.OperationDocument = .init(
definition: .init(
#"mutation activateLicense($workspaceId: String!, $license: String!) { activateLicense(workspaceId: $workspaceId, license: $license) { __typename installedAt validatedAt } }"#
#"mutation activateLicense($workspaceId: String!, $license: String!) { activateLicense(workspaceId: $workspaceId, license: $license) { __typename ...license } }"#,
fragments: [License.self]
))
public var workspaceId: String
@@ -50,12 +51,22 @@ public class ActivateLicenseMutation: GraphQLMutation {
public static var __parentType: any ApolloAPI.ParentType { AffineGraphQL.Objects.License }
public static var __selections: [ApolloAPI.Selection] { [
.field("__typename", String.self),
.field("installedAt", AffineGraphQL.DateTime.self),
.field("validatedAt", AffineGraphQL.DateTime.self),
.fragment(License.self),
] }
public var expiredAt: AffineGraphQL.DateTime? { __data["expiredAt"] }
public var installedAt: AffineGraphQL.DateTime { __data["installedAt"] }
public var quantity: Int { __data["quantity"] }
public var recurring: GraphQLEnum<AffineGraphQL.SubscriptionRecurring> { __data["recurring"] }
public var validatedAt: AffineGraphQL.DateTime { __data["validatedAt"] }
public var variant: GraphQLEnum<AffineGraphQL.SubscriptionVariant>? { __data["variant"] }
public struct Fragments: FragmentContainer {
public let __data: DataDict
public init(_dataDict: DataDict) { __data = _dataDict }
public var license: License { _toFragment() }
}
}
}
}

View File

@@ -7,7 +7,7 @@ public class AddContextFileMutation: GraphQLMutation {
public static let operationName: String = "addContextFile"
public static let operationDocument: ApolloAPI.OperationDocument = .init(
definition: .init(
#"mutation addContextFile($content: Upload!, $options: AddContextFileInput!) { addContextFile(content: $content, options: $options) { __typename id createdAt name chunkSize error status blobId } }"#
#"mutation addContextFile($content: Upload!, $options: AddContextFileInput!) { addContextFile(content: $content, options: $options) { __typename id createdAt name mimeType chunkSize error status blobId } }"#
))
public var content: Upload
@@ -54,6 +54,7 @@ public class AddContextFileMutation: GraphQLMutation {
.field("id", AffineGraphQL.ID.self),
.field("createdAt", AffineGraphQL.SafeInt.self),
.field("name", String.self),
.field("mimeType", String.self),
.field("chunkSize", AffineGraphQL.SafeInt.self),
.field("error", String?.self),
.field("status", GraphQLEnum<AffineGraphQL.ContextEmbedStatus>.self),
@@ -63,6 +64,7 @@ public class AddContextFileMutation: GraphQLMutation {
public var id: AffineGraphQL.ID { __data["id"] }
public var createdAt: AffineGraphQL.SafeInt { __data["createdAt"] }
public var name: String { __data["name"] }
public var mimeType: String { __data["mimeType"] }
public var chunkSize: AffineGraphQL.SafeInt { __data["chunkSize"] }
public var error: String? { __data["error"] }
public var status: GraphQLEnum<AffineGraphQL.ContextEmbedStatus> { __data["status"] }

View File

@@ -0,0 +1,70 @@
// @generated
// This file was automatically generated and should not be edited.
@_exported import ApolloAPI
public class AddWorkspaceEmbeddingFilesMutation: GraphQLMutation {
public static let operationName: String = "addWorkspaceEmbeddingFiles"
public static let operationDocument: ApolloAPI.OperationDocument = .init(
definition: .init(
#"mutation addWorkspaceEmbeddingFiles($workspaceId: String!, $blob: Upload!) { addWorkspaceEmbeddingFiles(workspaceId: $workspaceId, blob: $blob) { __typename fileId fileName blobId mimeType size createdAt } }"#
))
public var workspaceId: String
public var blob: Upload
public init(
workspaceId: String,
blob: Upload
) {
self.workspaceId = workspaceId
self.blob = blob
}
public var __variables: Variables? { [
"workspaceId": workspaceId,
"blob": blob
] }
public struct Data: AffineGraphQL.SelectionSet {
public let __data: DataDict
public init(_dataDict: DataDict) { __data = _dataDict }
public static var __parentType: any ApolloAPI.ParentType { AffineGraphQL.Objects.Mutation }
public static var __selections: [ApolloAPI.Selection] { [
.field("addWorkspaceEmbeddingFiles", AddWorkspaceEmbeddingFiles.self, arguments: [
"workspaceId": .variable("workspaceId"),
"blob": .variable("blob")
]),
] }
/// Update workspace embedding files
public var addWorkspaceEmbeddingFiles: AddWorkspaceEmbeddingFiles { __data["addWorkspaceEmbeddingFiles"] }
/// AddWorkspaceEmbeddingFiles
///
/// Parent Type: `CopilotWorkspaceFile`
public struct AddWorkspaceEmbeddingFiles: AffineGraphQL.SelectionSet {
public let __data: DataDict
public init(_dataDict: DataDict) { __data = _dataDict }
public static var __parentType: any ApolloAPI.ParentType { AffineGraphQL.Objects.CopilotWorkspaceFile }
public static var __selections: [ApolloAPI.Selection] { [
.field("__typename", String.self),
.field("fileId", String.self),
.field("fileName", String.self),
.field("blobId", String.self),
.field("mimeType", String.self),
.field("size", AffineGraphQL.SafeInt.self),
.field("createdAt", AffineGraphQL.DateTime.self),
] }
public var fileId: String { __data["fileId"] }
public var fileName: String { __data["fileName"] }
public var blobId: String { __data["blobId"] }
public var mimeType: String { __data["mimeType"] }
public var size: AffineGraphQL.SafeInt { __data["size"] }
public var createdAt: AffineGraphQL.DateTime { __data["createdAt"] }
}
}
}

View File

@@ -0,0 +1,44 @@
// @generated
// This file was automatically generated and should not be edited.
@_exported import ApolloAPI
public class AddWorkspaceEmbeddingIgnoredDocsMutation: GraphQLMutation {
public static let operationName: String = "addWorkspaceEmbeddingIgnoredDocs"
public static let operationDocument: ApolloAPI.OperationDocument = .init(
definition: .init(
#"mutation addWorkspaceEmbeddingIgnoredDocs($workspaceId: String!, $add: [String!]!) { updateWorkspaceEmbeddingIgnoredDocs(workspaceId: $workspaceId, add: $add) }"#
))
public var workspaceId: String
public var add: [String]
public init(
workspaceId: String,
add: [String]
) {
self.workspaceId = workspaceId
self.add = add
}
public var __variables: Variables? { [
"workspaceId": workspaceId,
"add": add
] }
public struct Data: AffineGraphQL.SelectionSet {
public let __data: DataDict
public init(_dataDict: DataDict) { __data = _dataDict }
public static var __parentType: any ApolloAPI.ParentType { AffineGraphQL.Objects.Mutation }
public static var __selections: [ApolloAPI.Selection] { [
.field("updateWorkspaceEmbeddingIgnoredDocs", Int.self, arguments: [
"workspaceId": .variable("workspaceId"),
"add": .variable("add")
]),
] }
/// Update ignored docs
public var updateWorkspaceEmbeddingIgnoredDocs: Int { __data["updateWorkspaceEmbeddingIgnoredDocs"] }
}
}

View File

@@ -7,7 +7,7 @@ public class ClaimAudioTranscriptionMutation: GraphQLMutation {
public static let operationName: String = "claimAudioTranscription"
public static let operationDocument: ApolloAPI.OperationDocument = .init(
definition: .init(
#"mutation claimAudioTranscription($jobId: String!) { claimAudioTranscription(jobId: $jobId) { __typename id status title summary transcription { __typename speaker start end transcription } } }"#
#"mutation claimAudioTranscription($jobId: String!) { claimAudioTranscription(jobId: $jobId) { __typename id status title summary actions transcription { __typename speaker start end transcription } } }"#
))
public var jobId: String
@@ -43,6 +43,7 @@ public class ClaimAudioTranscriptionMutation: GraphQLMutation {
.field("status", GraphQLEnum<AffineGraphQL.AiJobStatus>.self),
.field("title", String?.self),
.field("summary", String?.self),
.field("actions", String?.self),
.field("transcription", [Transcription]?.self),
] }
@@ -50,6 +51,7 @@ public class ClaimAudioTranscriptionMutation: GraphQLMutation {
public var status: GraphQLEnum<AffineGraphQL.AiJobStatus> { __data["status"] }
public var title: String? { __data["title"] }
public var summary: String? { __data["summary"] }
public var actions: String? { __data["actions"] }
public var transcription: [Transcription]? { __data["transcription"] }
/// ClaimAudioTranscription.Transcription

View File

@@ -0,0 +1,72 @@
// @generated
// This file was automatically generated and should not be edited.
@_exported import ApolloAPI
public class InstallLicenseMutation: GraphQLMutation {
public static let operationName: String = "installLicense"
public static let operationDocument: ApolloAPI.OperationDocument = .init(
definition: .init(
#"mutation installLicense($workspaceId: String!, $license: Upload!) { installLicense(workspaceId: $workspaceId, license: $license) { __typename ...license } }"#,
fragments: [License.self]
))
public var workspaceId: String
public var license: Upload
public init(
workspaceId: String,
license: Upload
) {
self.workspaceId = workspaceId
self.license = license
}
public var __variables: Variables? { [
"workspaceId": workspaceId,
"license": license
] }
public struct Data: AffineGraphQL.SelectionSet {
public let __data: DataDict
public init(_dataDict: DataDict) { __data = _dataDict }
public static var __parentType: any ApolloAPI.ParentType { AffineGraphQL.Objects.Mutation }
public static var __selections: [ApolloAPI.Selection] { [
.field("installLicense", InstallLicense.self, arguments: [
"workspaceId": .variable("workspaceId"),
"license": .variable("license")
]),
] }
public var installLicense: InstallLicense { __data["installLicense"] }
/// InstallLicense
///
/// Parent Type: `License`
public struct InstallLicense: AffineGraphQL.SelectionSet {
public let __data: DataDict
public init(_dataDict: DataDict) { __data = _dataDict }
public static var __parentType: any ApolloAPI.ParentType { AffineGraphQL.Objects.License }
public static var __selections: [ApolloAPI.Selection] { [
.field("__typename", String.self),
.fragment(License.self),
] }
public var expiredAt: AffineGraphQL.DateTime? { __data["expiredAt"] }
public var installedAt: AffineGraphQL.DateTime { __data["installedAt"] }
public var quantity: Int { __data["quantity"] }
public var recurring: GraphQLEnum<AffineGraphQL.SubscriptionRecurring> { __data["recurring"] }
public var validatedAt: AffineGraphQL.DateTime { __data["validatedAt"] }
public var variant: GraphQLEnum<AffineGraphQL.SubscriptionVariant>? { __data["variant"] }
public struct Fragments: FragmentContainer {
public let __data: DataDict
public init(_dataDict: DataDict) { __data = _dataDict }
public var license: License { _toFragment() }
}
}
}
}

View File

@@ -7,27 +7,23 @@ public class InviteByEmailsMutation: GraphQLMutation {
public static let operationName: String = "inviteByEmails"
public static let operationDocument: ApolloAPI.OperationDocument = .init(
definition: .init(
#"mutation inviteByEmails($workspaceId: String!, $emails: [String!]!, $sendInviteMail: Boolean) { inviteBatch( workspaceId: $workspaceId emails: $emails sendInviteMail: $sendInviteMail ) { __typename email inviteId sentSuccess } }"#
#"mutation inviteByEmails($workspaceId: String!, $emails: [String!]!) { inviteMembers(workspaceId: $workspaceId, emails: $emails) { __typename email inviteId sentSuccess } }"#
))
public var workspaceId: String
public var emails: [String]
public var sendInviteMail: GraphQLNullable<Bool>
public init(
workspaceId: String,
emails: [String],
sendInviteMail: GraphQLNullable<Bool>
emails: [String]
) {
self.workspaceId = workspaceId
self.emails = emails
self.sendInviteMail = sendInviteMail
}
public var __variables: Variables? { [
"workspaceId": workspaceId,
"emails": emails,
"sendInviteMail": sendInviteMail
"emails": emails
] }
public struct Data: AffineGraphQL.SelectionSet {
@@ -35,21 +31,19 @@ public class InviteByEmailsMutation: GraphQLMutation {
public init(_dataDict: DataDict) { __data = _dataDict }
public static var __parentType: any ApolloAPI.ParentType { AffineGraphQL.Objects.Mutation }
#warning("Argument 'sendInviteMail' of field 'inviteBatch' is deprecated. Reason: 'never used'")
public static var __selections: [ApolloAPI.Selection] { [
.field("inviteBatch", [InviteBatch].self, arguments: [
.field("inviteMembers", [InviteMember].self, arguments: [
"workspaceId": .variable("workspaceId"),
"emails": .variable("emails"),
"sendInviteMail": .variable("sendInviteMail")
"emails": .variable("emails")
]),
] }
public var inviteBatch: [InviteBatch] { __data["inviteBatch"] }
public var inviteMembers: [InviteMember] { __data["inviteMembers"] }
/// InviteBatch
/// InviteMember
///
/// Parent Type: `InviteResult`
public struct InviteBatch: AffineGraphQL.SelectionSet {
public struct InviteMember: AffineGraphQL.SelectionSet {
public let __data: DataDict
public init(_dataDict: DataDict) { __data = _dataDict }
@@ -65,6 +59,7 @@ public class InviteByEmailsMutation: GraphQLMutation {
/// Invite id, null if invite record create failed
public var inviteId: String? { __data["inviteId"] }
/// Invite email sent success
@available(*, deprecated, message: "Notification will be sent asynchronously")
public var sentSuccess: Bool { __data["sentSuccess"] }
}
}

View File

@@ -31,6 +31,7 @@ public class LeaveWorkspaceMutation: GraphQLMutation {
public init(_dataDict: DataDict) { __data = _dataDict }
public static var __parentType: any ApolloAPI.ParentType { AffineGraphQL.Objects.Mutation }
#warning("Argument 'sendLeaveMail' of field 'leaveWorkspace' is deprecated. Reason: 'no used anymore'")
public static var __selections: [ApolloAPI.Selection] { [
.field("leaveWorkspace", Bool.self, arguments: [
"workspaceId": .variable("workspaceId"),

View File

@@ -0,0 +1,44 @@
// @generated
// This file was automatically generated and should not be edited.
@_exported import ApolloAPI
public class RemoveWorkspaceEmbeddingFilesMutation: GraphQLMutation {
public static let operationName: String = "removeWorkspaceEmbeddingFiles"
public static let operationDocument: ApolloAPI.OperationDocument = .init(
definition: .init(
#"mutation removeWorkspaceEmbeddingFiles($workspaceId: String!, $fileId: String!) { removeWorkspaceEmbeddingFiles(workspaceId: $workspaceId, fileId: $fileId) }"#
))
public var workspaceId: String
public var fileId: String
public init(
workspaceId: String,
fileId: String
) {
self.workspaceId = workspaceId
self.fileId = fileId
}
public var __variables: Variables? { [
"workspaceId": workspaceId,
"fileId": fileId
] }
public struct Data: AffineGraphQL.SelectionSet {
public let __data: DataDict
public init(_dataDict: DataDict) { __data = _dataDict }
public static var __parentType: any ApolloAPI.ParentType { AffineGraphQL.Objects.Mutation }
public static var __selections: [ApolloAPI.Selection] { [
.field("removeWorkspaceEmbeddingFiles", Bool.self, arguments: [
"workspaceId": .variable("workspaceId"),
"fileId": .variable("fileId")
]),
] }
/// Remove workspace embedding files
public var removeWorkspaceEmbeddingFiles: Bool { __data["removeWorkspaceEmbeddingFiles"] }
}
}

View File

@@ -0,0 +1,44 @@
// @generated
// This file was automatically generated and should not be edited.
@_exported import ApolloAPI
public class RemoveWorkspaceEmbeddingIgnoredDocsMutation: GraphQLMutation {
public static let operationName: String = "removeWorkspaceEmbeddingIgnoredDocs"
public static let operationDocument: ApolloAPI.OperationDocument = .init(
definition: .init(
#"mutation removeWorkspaceEmbeddingIgnoredDocs($workspaceId: String!, $remove: [String!]!) { updateWorkspaceEmbeddingIgnoredDocs(workspaceId: $workspaceId, remove: $remove) }"#
))
public var workspaceId: String
public var remove: [String]
public init(
workspaceId: String,
remove: [String]
) {
self.workspaceId = workspaceId
self.remove = remove
}
public var __variables: Variables? { [
"workspaceId": workspaceId,
"remove": remove
] }
public struct Data: AffineGraphQL.SelectionSet {
public let __data: DataDict
public init(_dataDict: DataDict) { __data = _dataDict }
public static var __parentType: any ApolloAPI.ParentType { AffineGraphQL.Objects.Mutation }
public static var __selections: [ApolloAPI.Selection] { [
.field("updateWorkspaceEmbeddingIgnoredDocs", Int.self, arguments: [
"workspaceId": .variable("workspaceId"),
"remove": .variable("remove")
]),
] }
/// Update ignored docs
public var updateWorkspaceEmbeddingIgnoredDocs: Int { __data["updateWorkspaceEmbeddingIgnoredDocs"] }
}
}

View File

@@ -0,0 +1,61 @@
// @generated
// This file was automatically generated and should not be edited.
@_exported import ApolloAPI
public class RetryAudioTranscriptionMutation: GraphQLMutation {
public static let operationName: String = "retryAudioTranscription"
public static let operationDocument: ApolloAPI.OperationDocument = .init(
definition: .init(
#"mutation retryAudioTranscription($workspaceId: String!, $jobId: String!) { retryAudioTranscription(workspaceId: $workspaceId, jobId: $jobId) { __typename id status } }"#
))
public var workspaceId: String
public var jobId: String
public init(
workspaceId: String,
jobId: String
) {
self.workspaceId = workspaceId
self.jobId = jobId
}
public var __variables: Variables? { [
"workspaceId": workspaceId,
"jobId": jobId
] }
public struct Data: AffineGraphQL.SelectionSet {
public let __data: DataDict
public init(_dataDict: DataDict) { __data = _dataDict }
public static var __parentType: any ApolloAPI.ParentType { AffineGraphQL.Objects.Mutation }
public static var __selections: [ApolloAPI.Selection] { [
.field("retryAudioTranscription", RetryAudioTranscription?.self, arguments: [
"workspaceId": .variable("workspaceId"),
"jobId": .variable("jobId")
]),
] }
public var retryAudioTranscription: RetryAudioTranscription? { __data["retryAudioTranscription"] }
/// RetryAudioTranscription
///
/// Parent Type: `TranscriptionResultType`
public struct RetryAudioTranscription: AffineGraphQL.SelectionSet {
public let __data: DataDict
public init(_dataDict: DataDict) { __data = _dataDict }
public static var __parentType: any ApolloAPI.ParentType { AffineGraphQL.Objects.TranscriptionResultType }
public static var __selections: [ApolloAPI.Selection] { [
.field("__typename", String.self),
.field("id", AffineGraphQL.ID.self),
.field("status", GraphQLEnum<AffineGraphQL.AiJobStatus>.self),
] }
public var id: AffineGraphQL.ID { __data["id"] }
public var status: GraphQLEnum<AffineGraphQL.AiJobStatus> { __data["status"] }
}
}
}

View File

@@ -7,7 +7,7 @@ public class RevokeMemberPermissionMutation: GraphQLMutation {
public static let operationName: String = "revokeMemberPermission"
public static let operationDocument: ApolloAPI.OperationDocument = .init(
definition: .init(
#"mutation revokeMemberPermission($workspaceId: String!, $userId: String!) { revoke(workspaceId: $workspaceId, userId: $userId) }"#
#"mutation revokeMemberPermission($workspaceId: String!, $userId: String!) { revokeMember(workspaceId: $workspaceId, userId: $userId) }"#
))
public var workspaceId: String
@@ -32,12 +32,12 @@ public class RevokeMemberPermissionMutation: GraphQLMutation {
public static var __parentType: any ApolloAPI.ParentType { AffineGraphQL.Objects.Mutation }
public static var __selections: [ApolloAPI.Selection] { [
.field("revoke", Bool.self, arguments: [
.field("revokeMember", Bool.self, arguments: [
"workspaceId": .variable("workspaceId"),
"userId": .variable("userId")
]),
] }
public var revoke: Bool { __data["revoke"] }
public var revokeMember: Bool { __data["revokeMember"] }
}
}

View File

@@ -0,0 +1,63 @@
// @generated
// This file was automatically generated and should not be edited.
@_exported import ApolloAPI
public class SendTestEmailMutation: GraphQLMutation {
public static let operationName: String = "sendTestEmail"
public static let operationDocument: ApolloAPI.OperationDocument = .init(
definition: .init(
#"mutation sendTestEmail($host: String!, $port: Int!, $sender: String!, $username: String!, $password: String!, $ignoreTLS: Boolean!) { sendTestEmail( config: { host: $host port: $port sender: $sender username: $username password: $password ignoreTLS: $ignoreTLS } ) }"#
))
public var host: String
public var port: Int
public var sender: String
public var username: String
public var password: String
public var ignoreTLS: Bool
public init(
host: String,
port: Int,
sender: String,
username: String,
password: String,
ignoreTLS: Bool
) {
self.host = host
self.port = port
self.sender = sender
self.username = username
self.password = password
self.ignoreTLS = ignoreTLS
}
public var __variables: Variables? { [
"host": host,
"port": port,
"sender": sender,
"username": username,
"password": password,
"ignoreTLS": ignoreTLS
] }
public struct Data: AffineGraphQL.SelectionSet {
public let __data: DataDict
public init(_dataDict: DataDict) { __data = _dataDict }
public static var __parentType: any ApolloAPI.ParentType { AffineGraphQL.Objects.Mutation }
public static var __selections: [ApolloAPI.Selection] { [
.field("sendTestEmail", Bool.self, arguments: ["config": [
"host": .variable("host"),
"port": .variable("port"),
"sender": .variable("sender"),
"username": .variable("username"),
"password": .variable("password"),
"ignoreTLS": .variable("ignoreTLS")
]]),
] }
public var sendTestEmail: Bool { __data["sendTestEmail"] }
}
}

View File

@@ -0,0 +1,60 @@
// @generated
// This file was automatically generated and should not be edited.
@_exported import ApolloAPI
public class SetEnableDocEmbeddingMutation: GraphQLMutation {
public static let operationName: String = "setEnableDocEmbedding"
public static let operationDocument: ApolloAPI.OperationDocument = .init(
definition: .init(
#"mutation setEnableDocEmbedding($id: ID!, $enableDocEmbedding: Boolean!) { updateWorkspace(input: { id: $id, enableDocEmbedding: $enableDocEmbedding }) { __typename id } }"#
))
public var id: ID
public var enableDocEmbedding: Bool
public init(
id: ID,
enableDocEmbedding: Bool
) {
self.id = id
self.enableDocEmbedding = enableDocEmbedding
}
public var __variables: Variables? { [
"id": id,
"enableDocEmbedding": enableDocEmbedding
] }
public struct Data: AffineGraphQL.SelectionSet {
public let __data: DataDict
public init(_dataDict: DataDict) { __data = _dataDict }
public static var __parentType: any ApolloAPI.ParentType { AffineGraphQL.Objects.Mutation }
public static var __selections: [ApolloAPI.Selection] { [
.field("updateWorkspace", UpdateWorkspace.self, arguments: ["input": [
"id": .variable("id"),
"enableDocEmbedding": .variable("enableDocEmbedding")
]]),
] }
/// Update workspace
public var updateWorkspace: UpdateWorkspace { __data["updateWorkspace"] }
/// UpdateWorkspace
///
/// Parent Type: `WorkspaceType`
public struct UpdateWorkspace: AffineGraphQL.SelectionSet {
public let __data: DataDict
public init(_dataDict: DataDict) { __data = _dataDict }
public static var __parentType: any ApolloAPI.ParentType { AffineGraphQL.Objects.WorkspaceType }
public static var __selections: [ApolloAPI.Selection] { [
.field("__typename", String.self),
.field("id", AffineGraphQL.ID.self),
] }
public var id: AffineGraphQL.ID { __data["id"] }
}
}
}

View File

@@ -7,27 +7,31 @@ public class SubmitAudioTranscriptionMutation: GraphQLMutation {
public static let operationName: String = "submitAudioTranscription"
public static let operationDocument: ApolloAPI.OperationDocument = .init(
definition: .init(
#"mutation submitAudioTranscription($workspaceId: String!, $blobId: String!, $blob: Upload!) { submitAudioTranscription( blob: $blob blobId: $blobId workspaceId: $workspaceId ) { __typename id status } }"#
#"mutation submitAudioTranscription($workspaceId: String!, $blobId: String!, $blob: Upload, $blobs: [Upload!]) { submitAudioTranscription( blob: $blob blobs: $blobs blobId: $blobId workspaceId: $workspaceId ) { __typename id status } }"#
))
public var workspaceId: String
public var blobId: String
public var blob: Upload
public var blob: GraphQLNullable<Upload>
public var blobs: GraphQLNullable<[Upload]>
public init(
workspaceId: String,
blobId: String,
blob: Upload
blob: GraphQLNullable<Upload>,
blobs: GraphQLNullable<[Upload]>
) {
self.workspaceId = workspaceId
self.blobId = blobId
self.blob = blob
self.blobs = blobs
}
public var __variables: Variables? { [
"workspaceId": workspaceId,
"blobId": blobId,
"blob": blob
"blob": blob,
"blobs": blobs
] }
public struct Data: AffineGraphQL.SelectionSet {
@@ -38,6 +42,7 @@ public class SubmitAudioTranscriptionMutation: GraphQLMutation {
public static var __selections: [ApolloAPI.Selection] { [
.field("submitAudioTranscription", SubmitAudioTranscription?.self, arguments: [
"blob": .variable("blob"),
"blobs": .variable("blobs"),
"blobId": .variable("blobId"),
"workspaceId": .variable("workspaceId")
]),

View File

@@ -7,7 +7,7 @@ public class UpdatePromptMutation: GraphQLMutation {
public static let operationName: String = "updatePrompt"
public static let operationDocument: ApolloAPI.OperationDocument = .init(
definition: .init(
#"mutation updatePrompt($name: String!, $messages: [CopilotPromptMessageInput!]!) { updateCopilotPrompt(name: $name, messages: $messages) { __typename name model action config { __typename jsonMode frequencyPenalty presencePenalty temperature topP } messages { __typename role content params } } }"#
#"mutation updatePrompt($name: String!, $messages: [CopilotPromptMessageInput!]!) { updateCopilotPrompt(name: $name, messages: $messages) { __typename name model action config { __typename frequencyPenalty presencePenalty temperature topP } messages { __typename role content params } } }"#
))
public var name: String
@@ -74,14 +74,12 @@ public class UpdatePromptMutation: GraphQLMutation {
public static var __parentType: any ApolloAPI.ParentType { AffineGraphQL.Objects.CopilotPromptConfigType }
public static var __selections: [ApolloAPI.Selection] { [
.field("__typename", String.self),
.field("jsonMode", Bool?.self),
.field("frequencyPenalty", Double?.self),
.field("presencePenalty", Double?.self),
.field("temperature", Double?.self),
.field("topP", Double?.self),
] }
public var jsonMode: Bool? { __data["jsonMode"] }
public var frequencyPenalty: Double? { __data["frequencyPenalty"] }
public var presencePenalty: Double? { __data["presencePenalty"] }
public var temperature: Double? { __data["temperature"] }

View File

@@ -0,0 +1,57 @@
// @generated
// This file was automatically generated and should not be edited.
@_exported import ApolloAPI
public class ValidateConfigMutation: GraphQLMutation {
public static let operationName: String = "validateConfig"
public static let operationDocument: ApolloAPI.OperationDocument = .init(
definition: .init(
#"mutation validateConfig($updates: [UpdateAppConfigInput!]!) { validateAppConfig(updates: $updates) { __typename module key value valid error } }"#
))
public var updates: [UpdateAppConfigInput]
public init(updates: [UpdateAppConfigInput]) {
self.updates = updates
}
public var __variables: Variables? { ["updates": updates] }
public struct Data: AffineGraphQL.SelectionSet {
public let __data: DataDict
public init(_dataDict: DataDict) { __data = _dataDict }
public static var __parentType: any ApolloAPI.ParentType { AffineGraphQL.Objects.Mutation }
public static var __selections: [ApolloAPI.Selection] { [
.field("validateAppConfig", [ValidateAppConfig].self, arguments: ["updates": .variable("updates")]),
] }
/// validate app configuration
public var validateAppConfig: [ValidateAppConfig] { __data["validateAppConfig"] }
/// ValidateAppConfig
///
/// Parent Type: `AppConfigValidateResult`
public struct ValidateAppConfig: AffineGraphQL.SelectionSet {
public let __data: DataDict
public init(_dataDict: DataDict) { __data = _dataDict }
public static var __parentType: any ApolloAPI.ParentType { AffineGraphQL.Objects.AppConfigValidateResult }
public static var __selections: [ApolloAPI.Selection] { [
.field("__typename", String.self),
.field("module", String.self),
.field("key", String.self),
.field("value", AffineGraphQL.JSON.self),
.field("valid", Bool.self),
.field("error", String?.self),
] }
public var module: String { __data["module"] }
public var key: String { __data["key"] }
public var value: AffineGraphQL.JSON { __data["value"] }
public var valid: Bool { __data["valid"] }
public var error: String? { __data["error"] }
}
}
}

View File

@@ -0,0 +1,83 @@
// @generated
// This file was automatically generated and should not be edited.
@_exported import ApolloAPI
public class GetAllWorkspaceEmbeddingIgnoredDocsQuery: GraphQLQuery {
public static let operationName: String = "getAllWorkspaceEmbeddingIgnoredDocs"
public static let operationDocument: ApolloAPI.OperationDocument = .init(
definition: .init(
#"query getAllWorkspaceEmbeddingIgnoredDocs($workspaceId: String!) { workspace(id: $workspaceId) { __typename embedding { __typename allIgnoredDocs { __typename docId createdAt } } } }"#
))
public var workspaceId: String
public init(workspaceId: String) {
self.workspaceId = workspaceId
}
public var __variables: Variables? { ["workspaceId": workspaceId] }
public struct Data: AffineGraphQL.SelectionSet {
public let __data: DataDict
public init(_dataDict: DataDict) { __data = _dataDict }
public static var __parentType: any ApolloAPI.ParentType { AffineGraphQL.Objects.Query }
public static var __selections: [ApolloAPI.Selection] { [
.field("workspace", Workspace.self, arguments: ["id": .variable("workspaceId")]),
] }
/// Get workspace by id
public var workspace: Workspace { __data["workspace"] }
/// Workspace
///
/// Parent Type: `WorkspaceType`
public struct Workspace: AffineGraphQL.SelectionSet {
public let __data: DataDict
public init(_dataDict: DataDict) { __data = _dataDict }
public static var __parentType: any ApolloAPI.ParentType { AffineGraphQL.Objects.WorkspaceType }
public static var __selections: [ApolloAPI.Selection] { [
.field("__typename", String.self),
.field("embedding", Embedding.self),
] }
public var embedding: Embedding { __data["embedding"] }
/// Workspace.Embedding
///
/// Parent Type: `CopilotWorkspaceConfig`
public struct Embedding: AffineGraphQL.SelectionSet {
public let __data: DataDict
public init(_dataDict: DataDict) { __data = _dataDict }
public static var __parentType: any ApolloAPI.ParentType { AffineGraphQL.Objects.CopilotWorkspaceConfig }
public static var __selections: [ApolloAPI.Selection] { [
.field("__typename", String.self),
.field("allIgnoredDocs", [AllIgnoredDoc].self),
] }
public var allIgnoredDocs: [AllIgnoredDoc] { __data["allIgnoredDocs"] }
/// Workspace.Embedding.AllIgnoredDoc
///
/// Parent Type: `CopilotWorkspaceIgnoredDoc`
public struct AllIgnoredDoc: AffineGraphQL.SelectionSet {
public let __data: DataDict
public init(_dataDict: DataDict) { __data = _dataDict }
public static var __parentType: any ApolloAPI.ParentType { AffineGraphQL.Objects.CopilotWorkspaceIgnoredDoc }
public static var __selections: [ApolloAPI.Selection] { [
.field("__typename", String.self),
.field("docId", String.self),
.field("createdAt", AffineGraphQL.DateTime.self),
] }
public var docId: String { __data["docId"] }
public var createdAt: AffineGraphQL.DateTime { __data["createdAt"] }
}
}
}
}
}

View File

@@ -0,0 +1,98 @@
// @generated
// This file was automatically generated and should not be edited.
@_exported import ApolloAPI
public class GetCopilotSessionQuery: GraphQLQuery {
public static let operationName: String = "getCopilotSession"
public static let operationDocument: ApolloAPI.OperationDocument = .init(
definition: .init(
#"query getCopilotSession($workspaceId: String!, $sessionId: String!) { currentUser { __typename copilot(workspaceId: $workspaceId) { __typename session(sessionId: $sessionId) { __typename id parentSessionId promptName model optionalModels } } } }"#
))
public var workspaceId: String
public var sessionId: String
public init(
workspaceId: String,
sessionId: String
) {
self.workspaceId = workspaceId
self.sessionId = sessionId
}
public var __variables: Variables? { [
"workspaceId": workspaceId,
"sessionId": sessionId
] }
public struct Data: AffineGraphQL.SelectionSet {
public let __data: DataDict
public init(_dataDict: DataDict) { __data = _dataDict }
public static var __parentType: any ApolloAPI.ParentType { AffineGraphQL.Objects.Query }
public static var __selections: [ApolloAPI.Selection] { [
.field("currentUser", CurrentUser?.self),
] }
/// Get current user
public var currentUser: CurrentUser? { __data["currentUser"] }
/// CurrentUser
///
/// Parent Type: `UserType`
public struct CurrentUser: AffineGraphQL.SelectionSet {
public let __data: DataDict
public init(_dataDict: DataDict) { __data = _dataDict }
public static var __parentType: any ApolloAPI.ParentType { AffineGraphQL.Objects.UserType }
public static var __selections: [ApolloAPI.Selection] { [
.field("__typename", String.self),
.field("copilot", Copilot.self, arguments: ["workspaceId": .variable("workspaceId")]),
] }
public var copilot: Copilot { __data["copilot"] }
/// CurrentUser.Copilot
///
/// Parent Type: `Copilot`
public struct Copilot: AffineGraphQL.SelectionSet {
public let __data: DataDict
public init(_dataDict: DataDict) { __data = _dataDict }
public static var __parentType: any ApolloAPI.ParentType { AffineGraphQL.Objects.Copilot }
public static var __selections: [ApolloAPI.Selection] { [
.field("__typename", String.self),
.field("session", Session.self, arguments: ["sessionId": .variable("sessionId")]),
] }
/// Get the session by id
public var session: Session { __data["session"] }
/// CurrentUser.Copilot.Session
///
/// Parent Type: `CopilotSessionType`
public struct Session: AffineGraphQL.SelectionSet {
public let __data: DataDict
public init(_dataDict: DataDict) { __data = _dataDict }
public static var __parentType: any ApolloAPI.ParentType { AffineGraphQL.Objects.CopilotSessionType }
public static var __selections: [ApolloAPI.Selection] { [
.field("__typename", String.self),
.field("id", AffineGraphQL.ID.self),
.field("parentSessionId", AffineGraphQL.ID?.self),
.field("promptName", String.self),
.field("model", String.self),
.field("optionalModels", [String].self),
] }
public var id: AffineGraphQL.ID { __data["id"] }
public var parentSessionId: AffineGraphQL.ID? { __data["parentSessionId"] }
public var promptName: String { __data["promptName"] }
public var model: String { __data["model"] }
public var optionalModels: [String] { __data["optionalModels"] }
}
}
}
}
}

View File

@@ -7,7 +7,7 @@ public class GetCopilotSessionsQuery: GraphQLQuery {
public static let operationName: String = "getCopilotSessions"
public static let operationDocument: ApolloAPI.OperationDocument = .init(
definition: .init(
#"query getCopilotSessions($workspaceId: String!, $docId: String, $options: QueryChatSessionsInput) { currentUser { __typename copilot(workspaceId: $workspaceId) { __typename sessions(docId: $docId, options: $options) { __typename id parentSessionId promptName } } } }"#
#"query getCopilotSessions($workspaceId: String!, $docId: String, $options: QueryChatSessionsInput) { currentUser { __typename copilot(workspaceId: $workspaceId) { __typename sessions(docId: $docId, options: $options) { __typename id parentSessionId promptName model optionalModels } } } }"#
))
public var workspaceId: String
@@ -89,11 +89,15 @@ public class GetCopilotSessionsQuery: GraphQLQuery {
.field("id", AffineGraphQL.ID.self),
.field("parentSessionId", AffineGraphQL.ID?.self),
.field("promptName", String.self),
.field("model", String.self),
.field("optionalModels", [String].self),
] }
public var id: AffineGraphQL.ID { __data["id"] }
public var parentSessionId: AffineGraphQL.ID? { __data["parentSessionId"] }
public var promptName: String { __data["promptName"] }
public var model: String { __data["model"] }
public var optionalModels: [String] { __data["optionalModels"] }
}
}
}

View File

@@ -0,0 +1,131 @@
// @generated
// This file was automatically generated and should not be edited.
@_exported import ApolloAPI
public class GetDocCreatedByUpdatedByListQuery: GraphQLQuery {
public static let operationName: String = "getDocCreatedByUpdatedByList"
public static let operationDocument: ApolloAPI.OperationDocument = .init(
definition: .init(
#"query getDocCreatedByUpdatedByList($workspaceId: String!, $pagination: PaginationInput!) { workspace(id: $workspaceId) { __typename docs(pagination: $pagination) { __typename totalCount pageInfo { __typename endCursor hasNextPage } edges { __typename node { __typename id creatorId lastUpdaterId } } } } }"#
))
public var workspaceId: String
public var pagination: PaginationInput
public init(
workspaceId: String,
pagination: PaginationInput
) {
self.workspaceId = workspaceId
self.pagination = pagination
}
public var __variables: Variables? { [
"workspaceId": workspaceId,
"pagination": pagination
] }
public struct Data: AffineGraphQL.SelectionSet {
public let __data: DataDict
public init(_dataDict: DataDict) { __data = _dataDict }
public static var __parentType: any ApolloAPI.ParentType { AffineGraphQL.Objects.Query }
public static var __selections: [ApolloAPI.Selection] { [
.field("workspace", Workspace.self, arguments: ["id": .variable("workspaceId")]),
] }
/// Get workspace by id
public var workspace: Workspace { __data["workspace"] }
/// Workspace
///
/// Parent Type: `WorkspaceType`
public struct Workspace: AffineGraphQL.SelectionSet {
public let __data: DataDict
public init(_dataDict: DataDict) { __data = _dataDict }
public static var __parentType: any ApolloAPI.ParentType { AffineGraphQL.Objects.WorkspaceType }
public static var __selections: [ApolloAPI.Selection] { [
.field("__typename", String.self),
.field("docs", Docs.self, arguments: ["pagination": .variable("pagination")]),
] }
public var docs: Docs { __data["docs"] }
/// Workspace.Docs
///
/// Parent Type: `PaginatedDocType`
public struct Docs: AffineGraphQL.SelectionSet {
public let __data: DataDict
public init(_dataDict: DataDict) { __data = _dataDict }
public static var __parentType: any ApolloAPI.ParentType { AffineGraphQL.Objects.PaginatedDocType }
public static var __selections: [ApolloAPI.Selection] { [
.field("__typename", String.self),
.field("totalCount", Int.self),
.field("pageInfo", PageInfo.self),
.field("edges", [Edge].self),
] }
public var totalCount: Int { __data["totalCount"] }
public var pageInfo: PageInfo { __data["pageInfo"] }
public var edges: [Edge] { __data["edges"] }
/// Workspace.Docs.PageInfo
///
/// Parent Type: `PageInfo`
public struct PageInfo: AffineGraphQL.SelectionSet {
public let __data: DataDict
public init(_dataDict: DataDict) { __data = _dataDict }
public static var __parentType: any ApolloAPI.ParentType { AffineGraphQL.Objects.PageInfo }
public static var __selections: [ApolloAPI.Selection] { [
.field("__typename", String.self),
.field("endCursor", String?.self),
.field("hasNextPage", Bool.self),
] }
public var endCursor: String? { __data["endCursor"] }
public var hasNextPage: Bool { __data["hasNextPage"] }
}
/// Workspace.Docs.Edge
///
/// Parent Type: `DocTypeEdge`
public struct Edge: AffineGraphQL.SelectionSet {
public let __data: DataDict
public init(_dataDict: DataDict) { __data = _dataDict }
public static var __parentType: any ApolloAPI.ParentType { AffineGraphQL.Objects.DocTypeEdge }
public static var __selections: [ApolloAPI.Selection] { [
.field("__typename", String.self),
.field("node", Node.self),
] }
public var node: Node { __data["node"] }
/// Workspace.Docs.Edge.Node
///
/// Parent Type: `DocType`
public struct Node: AffineGraphQL.SelectionSet {
public let __data: DataDict
public init(_dataDict: DataDict) { __data = _dataDict }
public static var __parentType: any ApolloAPI.ParentType { AffineGraphQL.Objects.DocType }
public static var __selections: [ApolloAPI.Selection] { [
.field("__typename", String.self),
.field("id", String.self),
.field("creatorId", String?.self),
.field("lastUpdaterId", String?.self),
] }
public var id: String { __data["id"] }
public var creatorId: String? { __data["creatorId"] }
public var lastUpdaterId: String? { __data["lastUpdaterId"] }
}
}
}
}
}
}

View File

@@ -27,7 +27,7 @@ public class GetInviteInfoQuery: GraphQLQuery {
.field("getInviteInfo", GetInviteInfo.self, arguments: ["inviteId": .variable("inviteId")]),
] }
/// send workspace invitation
/// get workspace invitation info
public var getInviteInfo: GetInviteInfo { __data["getInviteInfo"] }
/// GetInviteInfo

View File

@@ -7,7 +7,8 @@ public class GetLicenseQuery: GraphQLQuery {
public static let operationName: String = "getLicense"
public static let operationDocument: ApolloAPI.OperationDocument = .init(
definition: .init(
#"query getLicense($workspaceId: String!) { workspace(id: $workspaceId) { __typename license { __typename expiredAt installedAt quantity recurring validatedAt } } }"#
#"query getLicense($workspaceId: String!) { workspace(id: $workspaceId) { __typename license { __typename ...license } } }"#,
fragments: [License.self]
))
public var workspaceId: String
@@ -56,11 +57,7 @@ public class GetLicenseQuery: GraphQLQuery {
public static var __parentType: any ApolloAPI.ParentType { AffineGraphQL.Objects.License }
public static var __selections: [ApolloAPI.Selection] { [
.field("__typename", String.self),
.field("expiredAt", AffineGraphQL.DateTime?.self),
.field("installedAt", AffineGraphQL.DateTime.self),
.field("quantity", Int.self),
.field("recurring", GraphQLEnum<AffineGraphQL.SubscriptionRecurring>.self),
.field("validatedAt", AffineGraphQL.DateTime.self),
.fragment(License.self),
] }
public var expiredAt: AffineGraphQL.DateTime? { __data["expiredAt"] }
@@ -68,6 +65,14 @@ public class GetLicenseQuery: GraphQLQuery {
public var quantity: Int { __data["quantity"] }
public var recurring: GraphQLEnum<AffineGraphQL.SubscriptionRecurring> { __data["recurring"] }
public var validatedAt: AffineGraphQL.DateTime { __data["validatedAt"] }
public var variant: GraphQLEnum<AffineGraphQL.SubscriptionVariant>? { __data["variant"] }
public struct Fragments: FragmentContainer {
public let __data: DataDict
public init(_dataDict: DataDict) { __data = _dataDict }
public var license: License { _toFragment() }
}
}
}
}

View File

@@ -7,7 +7,7 @@ public class GetPromptsQuery: GraphQLQuery {
public static let operationName: String = "getPrompts"
public static let operationDocument: ApolloAPI.OperationDocument = .init(
definition: .init(
#"query getPrompts { listCopilotPrompts { __typename name model action config { __typename jsonMode frequencyPenalty presencePenalty temperature topP } messages { __typename role content params } } }"#
#"query getPrompts { listCopilotPrompts { __typename name model action config { __typename frequencyPenalty presencePenalty temperature topP } messages { __typename role content params } } }"#
))
public init() {}
@@ -57,14 +57,12 @@ public class GetPromptsQuery: GraphQLQuery {
public static var __parentType: any ApolloAPI.ParentType { AffineGraphQL.Objects.CopilotPromptConfigType }
public static var __selections: [ApolloAPI.Selection] { [
.field("__typename", String.self),
.field("jsonMode", Bool?.self),
.field("frequencyPenalty", Double?.self),
.field("presencePenalty", Double?.self),
.field("temperature", Double?.self),
.field("topP", Double?.self),
] }
public var jsonMode: Bool? { __data["jsonMode"] }
public var frequencyPenalty: Double? { __data["frequencyPenalty"] }
public var presencePenalty: Double? { __data["presencePenalty"] }
public var temperature: Double? { __data["temperature"] }

View File

@@ -7,7 +7,7 @@ public class GetWorkspaceConfigQuery: GraphQLQuery {
public static let operationName: String = "getWorkspaceConfig"
public static let operationDocument: ApolloAPI.OperationDocument = .init(
definition: .init(
#"query getWorkspaceConfig($id: String!) { workspace(id: $id) { __typename enableAi enableUrlPreview inviteLink { __typename link expireTime } } }"#
#"query getWorkspaceConfig($id: String!) { workspace(id: $id) { __typename enableAi enableUrlPreview enableDocEmbedding inviteLink { __typename link expireTime } } }"#
))
public var id: String
@@ -42,6 +42,7 @@ public class GetWorkspaceConfigQuery: GraphQLQuery {
.field("__typename", String.self),
.field("enableAi", Bool.self),
.field("enableUrlPreview", Bool.self),
.field("enableDocEmbedding", Bool.self),
.field("inviteLink", InviteLink?.self),
] }
@@ -49,6 +50,8 @@ public class GetWorkspaceConfigQuery: GraphQLQuery {
public var enableAi: Bool { __data["enableAi"] }
/// Enable url previous when sharing
public var enableUrlPreview: Bool { __data["enableUrlPreview"] }
/// Enable doc embedding
public var enableDocEmbedding: Bool { __data["enableDocEmbedding"] }
/// invite link for workspace
public var inviteLink: InviteLink? { __data["inviteLink"] }

View File

@@ -0,0 +1,153 @@
// @generated
// This file was automatically generated and should not be edited.
@_exported import ApolloAPI
public class GetWorkspaceEmbeddingFilesQuery: GraphQLQuery {
public static let operationName: String = "getWorkspaceEmbeddingFiles"
public static let operationDocument: ApolloAPI.OperationDocument = .init(
definition: .init(
#"query getWorkspaceEmbeddingFiles($workspaceId: String!, $pagination: PaginationInput!) { workspace(id: $workspaceId) { __typename embedding { __typename files(pagination: $pagination) { __typename totalCount pageInfo { __typename endCursor hasNextPage } edges { __typename node { __typename fileId fileName blobId mimeType size createdAt } } } } } }"#
))
public var workspaceId: String
public var pagination: PaginationInput
public init(
workspaceId: String,
pagination: PaginationInput
) {
self.workspaceId = workspaceId
self.pagination = pagination
}
public var __variables: Variables? { [
"workspaceId": workspaceId,
"pagination": pagination
] }
public struct Data: AffineGraphQL.SelectionSet {
public let __data: DataDict
public init(_dataDict: DataDict) { __data = _dataDict }
public static var __parentType: any ApolloAPI.ParentType { AffineGraphQL.Objects.Query }
public static var __selections: [ApolloAPI.Selection] { [
.field("workspace", Workspace.self, arguments: ["id": .variable("workspaceId")]),
] }
/// Get workspace by id
public var workspace: Workspace { __data["workspace"] }
/// Workspace
///
/// Parent Type: `WorkspaceType`
public struct Workspace: AffineGraphQL.SelectionSet {
public let __data: DataDict
public init(_dataDict: DataDict) { __data = _dataDict }
public static var __parentType: any ApolloAPI.ParentType { AffineGraphQL.Objects.WorkspaceType }
public static var __selections: [ApolloAPI.Selection] { [
.field("__typename", String.self),
.field("embedding", Embedding.self),
] }
public var embedding: Embedding { __data["embedding"] }
/// Workspace.Embedding
///
/// Parent Type: `CopilotWorkspaceConfig`
public struct Embedding: AffineGraphQL.SelectionSet {
public let __data: DataDict
public init(_dataDict: DataDict) { __data = _dataDict }
public static var __parentType: any ApolloAPI.ParentType { AffineGraphQL.Objects.CopilotWorkspaceConfig }
public static var __selections: [ApolloAPI.Selection] { [
.field("__typename", String.self),
.field("files", Files.self, arguments: ["pagination": .variable("pagination")]),
] }
public var files: Files { __data["files"] }
/// Workspace.Embedding.Files
///
/// Parent Type: `PaginatedCopilotWorkspaceFileType`
public struct Files: AffineGraphQL.SelectionSet {
public let __data: DataDict
public init(_dataDict: DataDict) { __data = _dataDict }
public static var __parentType: any ApolloAPI.ParentType { AffineGraphQL.Objects.PaginatedCopilotWorkspaceFileType }
public static var __selections: [ApolloAPI.Selection] { [
.field("__typename", String.self),
.field("totalCount", Int.self),
.field("pageInfo", PageInfo.self),
.field("edges", [Edge].self),
] }
public var totalCount: Int { __data["totalCount"] }
public var pageInfo: PageInfo { __data["pageInfo"] }
public var edges: [Edge] { __data["edges"] }
/// Workspace.Embedding.Files.PageInfo
///
/// Parent Type: `PageInfo`
public struct PageInfo: AffineGraphQL.SelectionSet {
public let __data: DataDict
public init(_dataDict: DataDict) { __data = _dataDict }
public static var __parentType: any ApolloAPI.ParentType { AffineGraphQL.Objects.PageInfo }
public static var __selections: [ApolloAPI.Selection] { [
.field("__typename", String.self),
.field("endCursor", String?.self),
.field("hasNextPage", Bool.self),
] }
public var endCursor: String? { __data["endCursor"] }
public var hasNextPage: Bool { __data["hasNextPage"] }
}
/// Workspace.Embedding.Files.Edge
///
/// Parent Type: `CopilotWorkspaceFileTypeEdge`
public struct Edge: AffineGraphQL.SelectionSet {
public let __data: DataDict
public init(_dataDict: DataDict) { __data = _dataDict }
public static var __parentType: any ApolloAPI.ParentType { AffineGraphQL.Objects.CopilotWorkspaceFileTypeEdge }
public static var __selections: [ApolloAPI.Selection] { [
.field("__typename", String.self),
.field("node", Node.self),
] }
public var node: Node { __data["node"] }
/// Workspace.Embedding.Files.Edge.Node
///
/// Parent Type: `CopilotWorkspaceFile`
public struct Node: AffineGraphQL.SelectionSet {
public let __data: DataDict
public init(_dataDict: DataDict) { __data = _dataDict }
public static var __parentType: any ApolloAPI.ParentType { AffineGraphQL.Objects.CopilotWorkspaceFile }
public static var __selections: [ApolloAPI.Selection] { [
.field("__typename", String.self),
.field("fileId", String.self),
.field("fileName", String.self),
.field("blobId", String.self),
.field("mimeType", String.self),
.field("size", AffineGraphQL.SafeInt.self),
.field("createdAt", AffineGraphQL.DateTime.self),
] }
public var fileId: String { __data["fileId"] }
public var fileName: String { __data["fileName"] }
public var blobId: String { __data["blobId"] }
public var mimeType: String { __data["mimeType"] }
public var size: AffineGraphQL.SafeInt { __data["size"] }
public var createdAt: AffineGraphQL.DateTime { __data["createdAt"] }
}
}
}
}
}
}
}

View File

@@ -0,0 +1,157 @@
// @generated
// This file was automatically generated and should not be edited.
@_exported import ApolloAPI
public class GetWorkspaceEmbeddingIgnoredDocsQuery: GraphQLQuery {
public static let operationName: String = "getWorkspaceEmbeddingIgnoredDocs"
public static let operationDocument: ApolloAPI.OperationDocument = .init(
definition: .init(
#"query getWorkspaceEmbeddingIgnoredDocs($workspaceId: String!, $pagination: PaginationInput!) { workspace(id: $workspaceId) { __typename embedding { __typename ignoredDocs(pagination: $pagination) { __typename totalCount pageInfo { __typename endCursor hasNextPage } edges { __typename node { __typename docId createdAt docCreatedAt docUpdatedAt title createdBy createdByAvatar updatedBy } } } } } }"#
))
public var workspaceId: String
public var pagination: PaginationInput
public init(
workspaceId: String,
pagination: PaginationInput
) {
self.workspaceId = workspaceId
self.pagination = pagination
}
public var __variables: Variables? { [
"workspaceId": workspaceId,
"pagination": pagination
] }
public struct Data: AffineGraphQL.SelectionSet {
public let __data: DataDict
public init(_dataDict: DataDict) { __data = _dataDict }
public static var __parentType: any ApolloAPI.ParentType { AffineGraphQL.Objects.Query }
public static var __selections: [ApolloAPI.Selection] { [
.field("workspace", Workspace.self, arguments: ["id": .variable("workspaceId")]),
] }
/// Get workspace by id
public var workspace: Workspace { __data["workspace"] }
/// Workspace
///
/// Parent Type: `WorkspaceType`
public struct Workspace: AffineGraphQL.SelectionSet {
public let __data: DataDict
public init(_dataDict: DataDict) { __data = _dataDict }
public static var __parentType: any ApolloAPI.ParentType { AffineGraphQL.Objects.WorkspaceType }
public static var __selections: [ApolloAPI.Selection] { [
.field("__typename", String.self),
.field("embedding", Embedding.self),
] }
public var embedding: Embedding { __data["embedding"] }
/// Workspace.Embedding
///
/// Parent Type: `CopilotWorkspaceConfig`
public struct Embedding: AffineGraphQL.SelectionSet {
public let __data: DataDict
public init(_dataDict: DataDict) { __data = _dataDict }
public static var __parentType: any ApolloAPI.ParentType { AffineGraphQL.Objects.CopilotWorkspaceConfig }
public static var __selections: [ApolloAPI.Selection] { [
.field("__typename", String.self),
.field("ignoredDocs", IgnoredDocs.self, arguments: ["pagination": .variable("pagination")]),
] }
public var ignoredDocs: IgnoredDocs { __data["ignoredDocs"] }
/// Workspace.Embedding.IgnoredDocs
///
/// Parent Type: `PaginatedIgnoredDocsType`
public struct IgnoredDocs: AffineGraphQL.SelectionSet {
public let __data: DataDict
public init(_dataDict: DataDict) { __data = _dataDict }
public static var __parentType: any ApolloAPI.ParentType { AffineGraphQL.Objects.PaginatedIgnoredDocsType }
public static var __selections: [ApolloAPI.Selection] { [
.field("__typename", String.self),
.field("totalCount", Int.self),
.field("pageInfo", PageInfo.self),
.field("edges", [Edge].self),
] }
public var totalCount: Int { __data["totalCount"] }
public var pageInfo: PageInfo { __data["pageInfo"] }
public var edges: [Edge] { __data["edges"] }
/// Workspace.Embedding.IgnoredDocs.PageInfo
///
/// Parent Type: `PageInfo`
public struct PageInfo: AffineGraphQL.SelectionSet {
public let __data: DataDict
public init(_dataDict: DataDict) { __data = _dataDict }
public static var __parentType: any ApolloAPI.ParentType { AffineGraphQL.Objects.PageInfo }
public static var __selections: [ApolloAPI.Selection] { [
.field("__typename", String.self),
.field("endCursor", String?.self),
.field("hasNextPage", Bool.self),
] }
public var endCursor: String? { __data["endCursor"] }
public var hasNextPage: Bool { __data["hasNextPage"] }
}
/// Workspace.Embedding.IgnoredDocs.Edge
///
/// Parent Type: `CopilotWorkspaceIgnoredDocTypeEdge`
public struct Edge: AffineGraphQL.SelectionSet {
public let __data: DataDict
public init(_dataDict: DataDict) { __data = _dataDict }
public static var __parentType: any ApolloAPI.ParentType { AffineGraphQL.Objects.CopilotWorkspaceIgnoredDocTypeEdge }
public static var __selections: [ApolloAPI.Selection] { [
.field("__typename", String.self),
.field("node", Node.self),
] }
public var node: Node { __data["node"] }
/// Workspace.Embedding.IgnoredDocs.Edge.Node
///
/// Parent Type: `CopilotWorkspaceIgnoredDoc`
public struct Node: AffineGraphQL.SelectionSet {
public let __data: DataDict
public init(_dataDict: DataDict) { __data = _dataDict }
public static var __parentType: any ApolloAPI.ParentType { AffineGraphQL.Objects.CopilotWorkspaceIgnoredDoc }
public static var __selections: [ApolloAPI.Selection] { [
.field("__typename", String.self),
.field("docId", String.self),
.field("createdAt", AffineGraphQL.DateTime.self),
.field("docCreatedAt", AffineGraphQL.DateTime?.self),
.field("docUpdatedAt", AffineGraphQL.DateTime?.self),
.field("title", String?.self),
.field("createdBy", String?.self),
.field("createdByAvatar", String?.self),
.field("updatedBy", String?.self),
] }
public var docId: String { __data["docId"] }
public var createdAt: AffineGraphQL.DateTime { __data["createdAt"] }
public var docCreatedAt: AffineGraphQL.DateTime? { __data["docCreatedAt"] }
public var docUpdatedAt: AffineGraphQL.DateTime? { __data["docUpdatedAt"] }
public var title: String? { __data["title"] }
public var createdBy: String? { __data["createdBy"] }
public var createdByAvatar: String? { __data["createdByAvatar"] }
public var updatedBy: String? { __data["updatedBy"] }
}
}
}
}
}
}
}

View File

@@ -7,7 +7,7 @@ public class GetWorkspaceInfoQuery: GraphQLQuery {
public static let operationName: String = "getWorkspaceInfo"
public static let operationDocument: ApolloAPI.OperationDocument = .init(
definition: .init(
#"query getWorkspaceInfo($workspaceId: String!) { isAdmin(workspaceId: $workspaceId) isOwner(workspaceId: $workspaceId) workspace(id: $workspaceId) { __typename team } }"#
#"query getWorkspaceInfo($workspaceId: String!) { workspace(id: $workspaceId) { __typename role team } }"#
))
public var workspaceId: String
@@ -24,17 +24,9 @@ public class GetWorkspaceInfoQuery: GraphQLQuery {
public static var __parentType: any ApolloAPI.ParentType { AffineGraphQL.Objects.Query }
public static var __selections: [ApolloAPI.Selection] { [
.field("isAdmin", Bool.self, arguments: ["workspaceId": .variable("workspaceId")]),
.field("isOwner", Bool.self, arguments: ["workspaceId": .variable("workspaceId")]),
.field("workspace", Workspace.self, arguments: ["id": .variable("workspaceId")]),
] }
/// Get is admin of workspace
@available(*, deprecated, message: "use WorkspaceType[role] instead")
public var isAdmin: Bool { __data["isAdmin"] }
/// Get is owner of workspace
@available(*, deprecated, message: "use WorkspaceType[role] instead")
public var isOwner: Bool { __data["isOwner"] }
/// Get workspace by id
public var workspace: Workspace { __data["workspace"] }
@@ -48,9 +40,12 @@ public class GetWorkspaceInfoQuery: GraphQLQuery {
public static var __parentType: any ApolloAPI.ParentType { AffineGraphQL.Objects.WorkspaceType }
public static var __selections: [ApolloAPI.Selection] { [
.field("__typename", String.self),
.field("role", GraphQLEnum<AffineGraphQL.Permission>.self),
.field("team", Bool.self),
] }
/// Role of current signed in user in workspace
public var role: GraphQLEnum<AffineGraphQL.Permission> { __data["role"] }
/// if workspace is team workspace
public var team: Bool { __data["team"] }
}

View File

@@ -52,16 +52,17 @@ public class GetWorkspacePageMetaByIdQuery: GraphQLQuery {
] }
/// Cloud page metadata of workspace
@available(*, deprecated, message: "use [WorkspaceType.doc] instead")
public var pageMeta: PageMeta { __data["pageMeta"] }
/// Workspace.PageMeta
///
/// Parent Type: `WorkspacePageMeta`
/// Parent Type: `WorkspaceDocMeta`
public struct PageMeta: AffineGraphQL.SelectionSet {
public let __data: DataDict
public init(_dataDict: DataDict) { __data = _dataDict }
public static var __parentType: any ApolloAPI.ParentType { AffineGraphQL.Objects.WorkspacePageMeta }
public static var __parentType: any ApolloAPI.ParentType { AffineGraphQL.Objects.WorkspaceDocMeta }
public static var __selections: [ApolloAPI.Selection] { [
.field("__typename", String.self),
.field("createdAt", AffineGraphQL.DateTime.self),

View File

@@ -0,0 +1,153 @@
// @generated
// This file was automatically generated and should not be edited.
@_exported import ApolloAPI
public class IndexerAggregateQuery: GraphQLQuery {
public static let operationName: String = "indexerAggregate"
public static let operationDocument: ApolloAPI.OperationDocument = .init(
definition: .init(
#"query indexerAggregate($id: String!, $input: AggregateInput!) { workspace(id: $id) { __typename aggregate(input: $input) { __typename buckets { __typename key count hits { __typename nodes { __typename fields highlights } } } pagination { __typename count hasMore nextCursor } } } }"#
))
public var id: String
public var input: AggregateInput
public init(
id: String,
input: AggregateInput
) {
self.id = id
self.input = input
}
public var __variables: Variables? { [
"id": id,
"input": input
] }
public struct Data: AffineGraphQL.SelectionSet {
public let __data: DataDict
public init(_dataDict: DataDict) { __data = _dataDict }
public static var __parentType: any ApolloAPI.ParentType { AffineGraphQL.Objects.Query }
public static var __selections: [ApolloAPI.Selection] { [
.field("workspace", Workspace.self, arguments: ["id": .variable("id")]),
] }
/// Get workspace by id
public var workspace: Workspace { __data["workspace"] }
/// Workspace
///
/// Parent Type: `WorkspaceType`
public struct Workspace: AffineGraphQL.SelectionSet {
public let __data: DataDict
public init(_dataDict: DataDict) { __data = _dataDict }
public static var __parentType: any ApolloAPI.ParentType { AffineGraphQL.Objects.WorkspaceType }
public static var __selections: [ApolloAPI.Selection] { [
.field("__typename", String.self),
.field("aggregate", Aggregate.self, arguments: ["input": .variable("input")]),
] }
/// Search a specific table with aggregate
public var aggregate: Aggregate { __data["aggregate"] }
/// Workspace.Aggregate
///
/// Parent Type: `AggregateResultObjectType`
public struct Aggregate: AffineGraphQL.SelectionSet {
public let __data: DataDict
public init(_dataDict: DataDict) { __data = _dataDict }
public static var __parentType: any ApolloAPI.ParentType { AffineGraphQL.Objects.AggregateResultObjectType }
public static var __selections: [ApolloAPI.Selection] { [
.field("__typename", String.self),
.field("buckets", [Bucket].self),
.field("pagination", Pagination.self),
] }
public var buckets: [Bucket] { __data["buckets"] }
public var pagination: Pagination { __data["pagination"] }
/// Workspace.Aggregate.Bucket
///
/// Parent Type: `AggregateBucketObjectType`
public struct Bucket: AffineGraphQL.SelectionSet {
public let __data: DataDict
public init(_dataDict: DataDict) { __data = _dataDict }
public static var __parentType: any ApolloAPI.ParentType { AffineGraphQL.Objects.AggregateBucketObjectType }
public static var __selections: [ApolloAPI.Selection] { [
.field("__typename", String.self),
.field("key", String.self),
.field("count", Int.self),
.field("hits", Hits.self),
] }
public var key: String { __data["key"] }
public var count: Int { __data["count"] }
/// The hits object
public var hits: Hits { __data["hits"] }
/// Workspace.Aggregate.Bucket.Hits
///
/// Parent Type: `AggregateBucketHitsObjectType`
public struct Hits: AffineGraphQL.SelectionSet {
public let __data: DataDict
public init(_dataDict: DataDict) { __data = _dataDict }
public static var __parentType: any ApolloAPI.ParentType { AffineGraphQL.Objects.AggregateBucketHitsObjectType }
public static var __selections: [ApolloAPI.Selection] { [
.field("__typename", String.self),
.field("nodes", [Node].self),
] }
public var nodes: [Node] { __data["nodes"] }
/// Workspace.Aggregate.Bucket.Hits.Node
///
/// Parent Type: `SearchNodeObjectType`
public struct Node: AffineGraphQL.SelectionSet {
public let __data: DataDict
public init(_dataDict: DataDict) { __data = _dataDict }
public static var __parentType: any ApolloAPI.ParentType { AffineGraphQL.Objects.SearchNodeObjectType }
public static var __selections: [ApolloAPI.Selection] { [
.field("__typename", String.self),
.field("fields", AffineGraphQL.JSONObject.self),
.field("highlights", AffineGraphQL.JSONObject?.self),
] }
/// The search result fields, see UnionSearchItemObjectType
public var fields: AffineGraphQL.JSONObject { __data["fields"] }
/// The search result fields, see UnionSearchItemObjectType
public var highlights: AffineGraphQL.JSONObject? { __data["highlights"] }
}
}
}
/// Workspace.Aggregate.Pagination
///
/// Parent Type: `SearchResultPagination`
public struct Pagination: AffineGraphQL.SelectionSet {
public let __data: DataDict
public init(_dataDict: DataDict) { __data = _dataDict }
public static var __parentType: any ApolloAPI.ParentType { AffineGraphQL.Objects.SearchResultPagination }
public static var __selections: [ApolloAPI.Selection] { [
.field("__typename", String.self),
.field("count", Int.self),
.field("hasMore", Bool.self),
.field("nextCursor", String?.self),
] }
public var count: Int { __data["count"] }
public var hasMore: Bool { __data["hasMore"] }
public var nextCursor: String? { __data["nextCursor"] }
}
}
}
}
}

View File

@@ -0,0 +1,116 @@
// @generated
// This file was automatically generated and should not be edited.
@_exported import ApolloAPI
public class IndexerSearchQuery: GraphQLQuery {
public static let operationName: String = "indexerSearch"
public static let operationDocument: ApolloAPI.OperationDocument = .init(
definition: .init(
#"query indexerSearch($id: String!, $input: SearchInput!) { workspace(id: $id) { __typename search(input: $input) { __typename nodes { __typename fields highlights } pagination { __typename count hasMore nextCursor } } } }"#
))
public var id: String
public var input: SearchInput
public init(
id: String,
input: SearchInput
) {
self.id = id
self.input = input
}
public var __variables: Variables? { [
"id": id,
"input": input
] }
public struct Data: AffineGraphQL.SelectionSet {
public let __data: DataDict
public init(_dataDict: DataDict) { __data = _dataDict }
public static var __parentType: any ApolloAPI.ParentType { AffineGraphQL.Objects.Query }
public static var __selections: [ApolloAPI.Selection] { [
.field("workspace", Workspace.self, arguments: ["id": .variable("id")]),
] }
/// Get workspace by id
public var workspace: Workspace { __data["workspace"] }
/// Workspace
///
/// Parent Type: `WorkspaceType`
public struct Workspace: AffineGraphQL.SelectionSet {
public let __data: DataDict
public init(_dataDict: DataDict) { __data = _dataDict }
public static var __parentType: any ApolloAPI.ParentType { AffineGraphQL.Objects.WorkspaceType }
public static var __selections: [ApolloAPI.Selection] { [
.field("__typename", String.self),
.field("search", Search.self, arguments: ["input": .variable("input")]),
] }
/// Search a specific table
public var search: Search { __data["search"] }
/// Workspace.Search
///
/// Parent Type: `SearchResultObjectType`
public struct Search: AffineGraphQL.SelectionSet {
public let __data: DataDict
public init(_dataDict: DataDict) { __data = _dataDict }
public static var __parentType: any ApolloAPI.ParentType { AffineGraphQL.Objects.SearchResultObjectType }
public static var __selections: [ApolloAPI.Selection] { [
.field("__typename", String.self),
.field("nodes", [Node].self),
.field("pagination", Pagination.self),
] }
public var nodes: [Node] { __data["nodes"] }
public var pagination: Pagination { __data["pagination"] }
/// Workspace.Search.Node
///
/// Parent Type: `SearchNodeObjectType`
public struct Node: AffineGraphQL.SelectionSet {
public let __data: DataDict
public init(_dataDict: DataDict) { __data = _dataDict }
public static var __parentType: any ApolloAPI.ParentType { AffineGraphQL.Objects.SearchNodeObjectType }
public static var __selections: [ApolloAPI.Selection] { [
.field("__typename", String.self),
.field("fields", AffineGraphQL.JSONObject.self),
.field("highlights", AffineGraphQL.JSONObject?.self),
] }
/// The search result fields, see UnionSearchItemObjectType
public var fields: AffineGraphQL.JSONObject { __data["fields"] }
/// The search result fields, see UnionSearchItemObjectType
public var highlights: AffineGraphQL.JSONObject? { __data["highlights"] }
}
/// Workspace.Search.Pagination
///
/// Parent Type: `SearchResultPagination`
public struct Pagination: AffineGraphQL.SelectionSet {
public let __data: DataDict
public init(_dataDict: DataDict) { __data = _dataDict }
public static var __parentType: any ApolloAPI.ParentType { AffineGraphQL.Objects.SearchResultPagination }
public static var __selections: [ApolloAPI.Selection] { [
.field("__typename", String.self),
.field("count", Int.self),
.field("hasMore", Bool.self),
.field("nextCursor", String?.self),
] }
public var count: Int { __data["count"] }
public var hasMore: Bool { __data["hasMore"] }
public var nextCursor: String? { __data["nextCursor"] }
}
}
}
}
}

View File

@@ -7,7 +7,7 @@ public class ListContextObjectQuery: GraphQLQuery {
public static let operationName: String = "listContextObject"
public static let operationDocument: ApolloAPI.OperationDocument = .init(
definition: .init(
#"query listContextObject($workspaceId: String!, $sessionId: String!, $contextId: String!) { currentUser { __typename copilot(workspaceId: $workspaceId) { __typename contexts(sessionId: $sessionId, contextId: $contextId) { __typename docs { __typename id status error createdAt } files { __typename id name blobId chunkSize error status createdAt } tags { __typename type id docs { __typename id status createdAt } createdAt } collections { __typename type id docs { __typename id status createdAt } createdAt } } } } }"#
#"query listContextObject($workspaceId: String!, $sessionId: String!, $contextId: String!) { currentUser { __typename copilot(workspaceId: $workspaceId) { __typename contexts(sessionId: $sessionId, contextId: $contextId) { __typename docs { __typename id status error createdAt } files { __typename id name mimeType blobId chunkSize error status createdAt } tags { __typename type id docs { __typename id status createdAt } createdAt } collections { __typename type id docs { __typename id status createdAt } createdAt } } } } }"#
))
public var workspaceId: String
@@ -135,6 +135,7 @@ public class ListContextObjectQuery: GraphQLQuery {
.field("__typename", String.self),
.field("id", AffineGraphQL.ID.self),
.field("name", String.self),
.field("mimeType", String.self),
.field("blobId", String.self),
.field("chunkSize", AffineGraphQL.SafeInt.self),
.field("error", String?.self),
@@ -144,6 +145,7 @@ public class ListContextObjectQuery: GraphQLQuery {
public var id: AffineGraphQL.ID { __data["id"] }
public var name: String { __data["name"] }
public var mimeType: String { __data["mimeType"] }
public var blobId: String { __data["blobId"] }
public var chunkSize: AffineGraphQL.SafeInt { __data["chunkSize"] }
public var error: String? { __data["error"] }

View File

@@ -79,11 +79,11 @@ public class ListContextQuery: GraphQLQuery {
public static var __parentType: any ApolloAPI.ParentType { AffineGraphQL.Objects.CopilotContext }
public static var __selections: [ApolloAPI.Selection] { [
.field("__typename", String.self),
.field("id", AffineGraphQL.ID.self),
.field("id", AffineGraphQL.ID?.self),
.field("workspaceId", String.self),
] }
public var id: AffineGraphQL.ID { __data["id"] }
public var id: AffineGraphQL.ID? { __data["id"] }
public var workspaceId: String { __data["workspaceId"] }
}
}

View File

@@ -7,7 +7,7 @@ public class ListUsersQuery: GraphQLQuery {
public static let operationName: String = "listUsers"
public static let operationDocument: ApolloAPI.OperationDocument = .init(
definition: .init(
#"query listUsers($filter: ListUserInput!) { users(filter: $filter) { __typename id name email disabled features hasPassword emailVerified avatarUrl } }"#
#"query listUsers($filter: ListUserInput!) { users(filter: $filter) { __typename id name email disabled features hasPassword emailVerified avatarUrl } usersCount }"#
))
public var filter: ListUserInput
@@ -25,10 +25,13 @@ public class ListUsersQuery: GraphQLQuery {
public static var __parentType: any ApolloAPI.ParentType { AffineGraphQL.Objects.Query }
public static var __selections: [ApolloAPI.Selection] { [
.field("users", [User].self, arguments: ["filter": .variable("filter")]),
.field("usersCount", Int.self),
] }
/// List registered users
public var users: [User] { __data["users"] }
/// Get users count
public var usersCount: Int { __data["usersCount"] }
/// User
///

View File

@@ -7,30 +7,38 @@ public class MatchContextQuery: GraphQLQuery {
public static let operationName: String = "matchContext"
public static let operationDocument: ApolloAPI.OperationDocument = .init(
definition: .init(
#"query matchContext($contextId: String!, $content: String!, $limit: SafeInt, $threshold: Float) { currentUser { __typename copilot { __typename contexts(contextId: $contextId) { __typename matchFiles(content: $content, limit: $limit, threshold: $threshold) { __typename fileId chunk content distance } matchWorkspaceDocs(content: $content, limit: $limit, threshold: $threshold) { __typename docId chunk content distance } } } } }"#
#"query matchContext($contextId: String, $workspaceId: String, $content: String!, $limit: SafeInt, $scopedThreshold: Float, $threshold: Float) { currentUser { __typename copilot(workspaceId: $workspaceId) { __typename contexts(contextId: $contextId) { __typename matchFiles( content: $content limit: $limit scopedThreshold: $scopedThreshold threshold: $threshold ) { __typename fileId blobId name mimeType chunk content distance } matchWorkspaceDocs( content: $content limit: $limit scopedThreshold: $scopedThreshold threshold: $threshold ) { __typename docId chunk content distance } } } } }"#
))
public var contextId: String
public var contextId: GraphQLNullable<String>
public var workspaceId: GraphQLNullable<String>
public var content: String
public var limit: GraphQLNullable<SafeInt>
public var scopedThreshold: GraphQLNullable<Double>
public var threshold: GraphQLNullable<Double>
public init(
contextId: String,
contextId: GraphQLNullable<String>,
workspaceId: GraphQLNullable<String>,
content: String,
limit: GraphQLNullable<SafeInt>,
scopedThreshold: GraphQLNullable<Double>,
threshold: GraphQLNullable<Double>
) {
self.contextId = contextId
self.workspaceId = workspaceId
self.content = content
self.limit = limit
self.scopedThreshold = scopedThreshold
self.threshold = threshold
}
public var __variables: Variables? { [
"contextId": contextId,
"workspaceId": workspaceId,
"content": content,
"limit": limit,
"scopedThreshold": scopedThreshold,
"threshold": threshold
] }
@@ -56,7 +64,7 @@ public class MatchContextQuery: GraphQLQuery {
public static var __parentType: any ApolloAPI.ParentType { AffineGraphQL.Objects.UserType }
public static var __selections: [ApolloAPI.Selection] { [
.field("__typename", String.self),
.field("copilot", Copilot.self),
.field("copilot", Copilot.self, arguments: ["workspaceId": .variable("workspaceId")]),
] }
public var copilot: Copilot { __data["copilot"] }
@@ -90,11 +98,13 @@ public class MatchContextQuery: GraphQLQuery {
.field("matchFiles", [MatchFile].self, arguments: [
"content": .variable("content"),
"limit": .variable("limit"),
"scopedThreshold": .variable("scopedThreshold"),
"threshold": .variable("threshold")
]),
.field("matchWorkspaceDocs", [MatchWorkspaceDoc].self, arguments: [
"content": .variable("content"),
"limit": .variable("limit"),
"scopedThreshold": .variable("scopedThreshold"),
"threshold": .variable("threshold")
]),
] }
@@ -115,12 +125,18 @@ public class MatchContextQuery: GraphQLQuery {
public static var __selections: [ApolloAPI.Selection] { [
.field("__typename", String.self),
.field("fileId", String.self),
.field("blobId", String.self),
.field("name", String.self),
.field("mimeType", String.self),
.field("chunk", AffineGraphQL.SafeInt.self),
.field("content", String.self),
.field("distance", Double?.self),
] }
public var fileId: String { __data["fileId"] }
public var blobId: String { __data["blobId"] }
public var name: String { __data["name"] }
public var mimeType: String { __data["mimeType"] }
public var chunk: AffineGraphQL.SafeInt { __data["chunk"] }
public var content: String { __data["content"] }
public var distance: Double? { __data["distance"] }

View File

@@ -7,27 +7,39 @@ public class MatchFilesQuery: GraphQLQuery {
public static let operationName: String = "matchFiles"
public static let operationDocument: ApolloAPI.OperationDocument = .init(
definition: .init(
#"query matchFiles($contextId: String!, $content: String!, $limit: SafeInt) { currentUser { __typename copilot { __typename contexts(contextId: $contextId) { __typename matchFiles(content: $content, limit: $limit) { __typename fileId chunk content distance } } } } }"#
#"query matchFiles($contextId: String, $workspaceId: String, $content: String!, $limit: SafeInt, $scopedThreshold: Float, $threshold: Float) { currentUser { __typename copilot(workspaceId: $workspaceId) { __typename contexts(contextId: $contextId) { __typename matchFiles( content: $content limit: $limit scopedThreshold: $scopedThreshold threshold: $threshold ) { __typename fileId blobId chunk content distance } } } } }"#
))
public var contextId: String
public var contextId: GraphQLNullable<String>
public var workspaceId: GraphQLNullable<String>
public var content: String
public var limit: GraphQLNullable<SafeInt>
public var scopedThreshold: GraphQLNullable<Double>
public var threshold: GraphQLNullable<Double>
public init(
contextId: String,
contextId: GraphQLNullable<String>,
workspaceId: GraphQLNullable<String>,
content: String,
limit: GraphQLNullable<SafeInt>
limit: GraphQLNullable<SafeInt>,
scopedThreshold: GraphQLNullable<Double>,
threshold: GraphQLNullable<Double>
) {
self.contextId = contextId
self.workspaceId = workspaceId
self.content = content
self.limit = limit
self.scopedThreshold = scopedThreshold
self.threshold = threshold
}
public var __variables: Variables? { [
"contextId": contextId,
"workspaceId": workspaceId,
"content": content,
"limit": limit
"limit": limit,
"scopedThreshold": scopedThreshold,
"threshold": threshold
] }
public struct Data: AffineGraphQL.SelectionSet {
@@ -52,7 +64,7 @@ public class MatchFilesQuery: GraphQLQuery {
public static var __parentType: any ApolloAPI.ParentType { AffineGraphQL.Objects.UserType }
public static var __selections: [ApolloAPI.Selection] { [
.field("__typename", String.self),
.field("copilot", Copilot.self),
.field("copilot", Copilot.self, arguments: ["workspaceId": .variable("workspaceId")]),
] }
public var copilot: Copilot { __data["copilot"] }
@@ -85,7 +97,9 @@ public class MatchFilesQuery: GraphQLQuery {
.field("__typename", String.self),
.field("matchFiles", [MatchFile].self, arguments: [
"content": .variable("content"),
"limit": .variable("limit")
"limit": .variable("limit"),
"scopedThreshold": .variable("scopedThreshold"),
"threshold": .variable("threshold")
]),
] }
@@ -103,12 +117,14 @@ public class MatchFilesQuery: GraphQLQuery {
public static var __selections: [ApolloAPI.Selection] { [
.field("__typename", String.self),
.field("fileId", String.self),
.field("blobId", String.self),
.field("chunk", AffineGraphQL.SafeInt.self),
.field("content", String.self),
.field("distance", Double?.self),
] }
public var fileId: String { __data["fileId"] }
public var blobId: String { __data["blobId"] }
public var chunk: AffineGraphQL.SafeInt { __data["chunk"] }
public var content: String { __data["content"] }
public var distance: Double? { __data["distance"] }

View File

@@ -7,27 +7,39 @@ public class MatchWorkspaceDocsQuery: GraphQLQuery {
public static let operationName: String = "matchWorkspaceDocs"
public static let operationDocument: ApolloAPI.OperationDocument = .init(
definition: .init(
#"query matchWorkspaceDocs($contextId: String!, $content: String!, $limit: SafeInt) { currentUser { __typename copilot { __typename contexts(contextId: $contextId) { __typename matchWorkspaceDocs(content: $content, limit: $limit) { __typename docId chunk content distance } } } } }"#
#"query matchWorkspaceDocs($contextId: String, $workspaceId: String, $content: String!, $limit: SafeInt, $scopedThreshold: Float, $threshold: Float) { currentUser { __typename copilot(workspaceId: $workspaceId) { __typename contexts(contextId: $contextId) { __typename matchWorkspaceDocs( content: $content limit: $limit scopedThreshold: $scopedThreshold threshold: $threshold ) { __typename docId chunk content distance } } } } }"#
))
public var contextId: String
public var contextId: GraphQLNullable<String>
public var workspaceId: GraphQLNullable<String>
public var content: String
public var limit: GraphQLNullable<SafeInt>
public var scopedThreshold: GraphQLNullable<Double>
public var threshold: GraphQLNullable<Double>
public init(
contextId: String,
contextId: GraphQLNullable<String>,
workspaceId: GraphQLNullable<String>,
content: String,
limit: GraphQLNullable<SafeInt>
limit: GraphQLNullable<SafeInt>,
scopedThreshold: GraphQLNullable<Double>,
threshold: GraphQLNullable<Double>
) {
self.contextId = contextId
self.workspaceId = workspaceId
self.content = content
self.limit = limit
self.scopedThreshold = scopedThreshold
self.threshold = threshold
}
public var __variables: Variables? { [
"contextId": contextId,
"workspaceId": workspaceId,
"content": content,
"limit": limit
"limit": limit,
"scopedThreshold": scopedThreshold,
"threshold": threshold
] }
public struct Data: AffineGraphQL.SelectionSet {
@@ -52,7 +64,7 @@ public class MatchWorkspaceDocsQuery: GraphQLQuery {
public static var __parentType: any ApolloAPI.ParentType { AffineGraphQL.Objects.UserType }
public static var __selections: [ApolloAPI.Selection] { [
.field("__typename", String.self),
.field("copilot", Copilot.self),
.field("copilot", Copilot.self, arguments: ["workspaceId": .variable("workspaceId")]),
] }
public var copilot: Copilot { __data["copilot"] }
@@ -85,7 +97,9 @@ public class MatchWorkspaceDocsQuery: GraphQLQuery {
.field("__typename", String.self),
.field("matchWorkspaceDocs", [MatchWorkspaceDoc].self, arguments: [
"content": .variable("content"),
"limit": .variable("limit")
"limit": .variable("limit"),
"scopedThreshold": .variable("scopedThreshold"),
"threshold": .variable("threshold")
]),
] }

View File

@@ -0,0 +1,84 @@
// @generated
// This file was automatically generated and should not be edited.
@_exported import ApolloAPI
public class WorkspaceBlobQuotaQuery: GraphQLQuery {
public static let operationName: String = "workspaceBlobQuota"
public static let operationDocument: ApolloAPI.OperationDocument = .init(
definition: .init(
#"query workspaceBlobQuota($id: String!) { workspace(id: $id) { __typename quota { __typename blobLimit humanReadable { __typename blobLimit } } } }"#
))
public var id: String
public init(id: String) {
self.id = id
}
public var __variables: Variables? { ["id": id] }
public struct Data: AffineGraphQL.SelectionSet {
public let __data: DataDict
public init(_dataDict: DataDict) { __data = _dataDict }
public static var __parentType: any ApolloAPI.ParentType { AffineGraphQL.Objects.Query }
public static var __selections: [ApolloAPI.Selection] { [
.field("workspace", Workspace.self, arguments: ["id": .variable("id")]),
] }
/// Get workspace by id
public var workspace: Workspace { __data["workspace"] }
/// Workspace
///
/// Parent Type: `WorkspaceType`
public struct Workspace: AffineGraphQL.SelectionSet {
public let __data: DataDict
public init(_dataDict: DataDict) { __data = _dataDict }
public static var __parentType: any ApolloAPI.ParentType { AffineGraphQL.Objects.WorkspaceType }
public static var __selections: [ApolloAPI.Selection] { [
.field("__typename", String.self),
.field("quota", Quota.self),
] }
/// quota of workspace
public var quota: Quota { __data["quota"] }
/// Workspace.Quota
///
/// Parent Type: `WorkspaceQuotaType`
public struct Quota: AffineGraphQL.SelectionSet {
public let __data: DataDict
public init(_dataDict: DataDict) { __data = _dataDict }
public static var __parentType: any ApolloAPI.ParentType { AffineGraphQL.Objects.WorkspaceQuotaType }
public static var __selections: [ApolloAPI.Selection] { [
.field("__typename", String.self),
.field("blobLimit", AffineGraphQL.SafeInt.self),
.field("humanReadable", HumanReadable.self),
] }
public var blobLimit: AffineGraphQL.SafeInt { __data["blobLimit"] }
public var humanReadable: HumanReadable { __data["humanReadable"] }
/// Workspace.Quota.HumanReadable
///
/// Parent Type: `WorkspaceQuotaHumanReadableType`
public struct HumanReadable: AffineGraphQL.SelectionSet {
public let __data: DataDict
public init(_dataDict: DataDict) { __data = _dataDict }
public static var __parentType: any ApolloAPI.ParentType { AffineGraphQL.Objects.WorkspaceQuotaHumanReadableType }
public static var __selections: [ApolloAPI.Selection] { [
.field("__typename", String.self),
.field("blobLimit", String.self),
] }
public var blobLimit: String { __data["blobLimit"] }
}
}
}
}
}

View File

@@ -7,7 +7,7 @@ public class WorkspaceQuotaQuery: GraphQLQuery {
public static let operationName: String = "workspaceQuota"
public static let operationDocument: ApolloAPI.OperationDocument = .init(
definition: .init(
#"query workspaceQuota($id: String!) { workspace(id: $id) { __typename quota { __typename name blobLimit storageQuota usedStorageQuota historyPeriod memberLimit memberCount humanReadable { __typename name blobLimit storageQuota historyPeriod memberLimit } } } }"#
#"query workspaceQuota($id: String!) { workspace(id: $id) { __typename quota { __typename name blobLimit storageQuota usedStorageQuota historyPeriod memberLimit memberCount overcapacityMemberCount humanReadable { __typename name blobLimit storageQuota historyPeriod memberLimit memberCount overcapacityMemberCount } } } }"#
))
public var id: String
@@ -63,6 +63,7 @@ public class WorkspaceQuotaQuery: GraphQLQuery {
.field("historyPeriod", AffineGraphQL.SafeInt.self),
.field("memberLimit", Int.self),
.field("memberCount", Int.self),
.field("overcapacityMemberCount", Int.self),
.field("humanReadable", HumanReadable.self),
] }
@@ -73,6 +74,7 @@ public class WorkspaceQuotaQuery: GraphQLQuery {
public var historyPeriod: AffineGraphQL.SafeInt { __data["historyPeriod"] }
public var memberLimit: Int { __data["memberLimit"] }
public var memberCount: Int { __data["memberCount"] }
public var overcapacityMemberCount: Int { __data["overcapacityMemberCount"] }
public var humanReadable: HumanReadable { __data["humanReadable"] }
/// Workspace.Quota.HumanReadable
@@ -90,6 +92,8 @@ public class WorkspaceQuotaQuery: GraphQLQuery {
.field("storageQuota", String.self),
.field("historyPeriod", String.self),
.field("memberLimit", String.self),
.field("memberCount", String.self),
.field("overcapacityMemberCount", String.self),
] }
public var name: String { __data["name"] }
@@ -97,6 +101,8 @@ public class WorkspaceQuotaQuery: GraphQLQuery {
public var storageQuota: String { __data["storageQuota"] }
public var historyPeriod: String { __data["historyPeriod"] }
public var memberLimit: String { __data["memberLimit"] }
public var memberCount: String { __data["memberCount"] }
public var overcapacityMemberCount: String { __data["overcapacityMemberCount"] }
}
}
}

View File

@@ -4,6 +4,7 @@
import ApolloAPI
public enum OAuthProviderType: String, EnumType {
case apple = "Apple"
case gitHub = "GitHub"
case google = "Google"
case oidc = "OIDC"

View File

@@ -0,0 +1,11 @@
// @generated
// This file was automatically generated and should not be edited.
import ApolloAPI
/// Search query occur
public enum SearchQueryOccur: String, EnumType {
case must = "must"
case mustNot = "must_not"
case should = "should"
}

View File

@@ -0,0 +1,13 @@
// @generated
// This file was automatically generated and should not be edited.
import ApolloAPI
/// Search query type
public enum SearchQueryType: String, EnumType {
case all = "all"
case boolean = "boolean"
case boost = "boost"
case exists = "exists"
case match = "match"
}

View File

@@ -0,0 +1,10 @@
// @generated
// This file was automatically generated and should not be edited.
import ApolloAPI
/// Search table
public enum SearchTable: String, EnumType {
case block = "block"
case doc = "doc"
}

View File

@@ -6,6 +6,8 @@ import ApolloAPI
public enum ServerFeature: String, EnumType {
case captcha = "Captcha"
case copilot = "Copilot"
case copilotEmbedding = "CopilotEmbedding"
case indexer = "Indexer"
case oAuth = "OAuth"
case payment = "Payment"
}

View File

@@ -6,6 +6,7 @@ import ApolloAPI
/// Member invite status in workspace
public enum WorkspaceMemberStatus: String, EnumType {
case accepted = "Accepted"
case allocatingSeat = "AllocatingSeat"
case needMoreSeat = "NeedMoreSeat"
case needMoreSeatAndReview = "NeedMoreSeatAndReview"
case pending = "Pending"

View File

@@ -0,0 +1,39 @@
// @generated
// This file was automatically generated and should not be edited.
import ApolloAPI
public struct AggregateHitsOptions: InputObject {
public private(set) var __data: InputDict
public init(_ data: InputDict) {
__data = data
}
public init(
fields: [String],
highlights: GraphQLNullable<[SearchHighlight]> = nil,
pagination: GraphQLNullable<AggregateHitsPagination> = nil
) {
__data = InputDict([
"fields": fields,
"highlights": highlights,
"pagination": pagination
])
}
public var fields: [String] {
get { __data["fields"] }
set { __data["fields"] = newValue }
}
public var highlights: GraphQLNullable<[SearchHighlight]> {
get { __data["highlights"] }
set { __data["highlights"] = newValue }
}
public var pagination: GraphQLNullable<AggregateHitsPagination> {
get { __data["pagination"] }
set { __data["pagination"] = newValue }
}
}

View File

@@ -0,0 +1,32 @@
// @generated
// This file was automatically generated and should not be edited.
import ApolloAPI
public struct AggregateHitsPagination: InputObject {
public private(set) var __data: InputDict
public init(_ data: InputDict) {
__data = data
}
public init(
limit: GraphQLNullable<Int> = nil,
skip: GraphQLNullable<Int> = nil
) {
__data = InputDict([
"limit": limit,
"skip": skip
])
}
public var limit: GraphQLNullable<Int> {
get { __data["limit"] }
set { __data["limit"] = newValue }
}
public var skip: GraphQLNullable<Int> {
get { __data["skip"] }
set { __data["skip"] = newValue }
}
}

View File

@@ -0,0 +1,46 @@
// @generated
// This file was automatically generated and should not be edited.
import ApolloAPI
public struct AggregateInput: InputObject {
public private(set) var __data: InputDict
public init(_ data: InputDict) {
__data = data
}
public init(
field: String,
options: AggregateOptions,
query: SearchQuery,
table: GraphQLEnum<SearchTable>
) {
__data = InputDict([
"field": field,
"options": options,
"query": query,
"table": table
])
}
public var field: String {
get { __data["field"] }
set { __data["field"] = newValue }
}
public var options: AggregateOptions {
get { __data["options"] }
set { __data["options"] = newValue }
}
public var query: SearchQuery {
get { __data["query"] }
set { __data["query"] = newValue }
}
public var table: GraphQLEnum<SearchTable> {
get { __data["table"] }
set { __data["table"] = newValue }
}
}

View File

@@ -0,0 +1,32 @@
// @generated
// This file was automatically generated and should not be edited.
import ApolloAPI
public struct AggregateOptions: InputObject {
public private(set) var __data: InputDict
public init(_ data: InputDict) {
__data = data
}
public init(
hits: AggregateHitsOptions,
pagination: GraphQLNullable<SearchPagination> = nil
) {
__data = InputDict([
"hits": hits,
"pagination": pagination
])
}
public var hits: AggregateHitsOptions {
get { __data["hits"] }
set { __data["hits"] = newValue }
}
public var pagination: GraphQLNullable<SearchPagination> {
get { __data["pagination"] }
set { __data["pagination"] = newValue }
}
}

View File

@@ -12,11 +12,13 @@ public struct CreateUserInput: InputObject {
public init(
email: String,
name: GraphQLNullable<String> = nil
name: GraphQLNullable<String> = nil,
password: GraphQLNullable<String> = nil
) {
__data = InputDict([
"email": email,
"name": name
"name": name,
"password": password
])
}
@@ -29,4 +31,9 @@ public struct CreateUserInput: InputObject {
get { __data["name"] }
set { __data["name"] = newValue }
}
public var password: GraphQLNullable<String> {
get { __data["password"] }
set { __data["password"] = newValue }
}
}

View File

@@ -12,7 +12,7 @@ public struct ForkChatSessionInput: InputObject {
public init(
docId: String,
latestMessageId: String,
latestMessageId: GraphQLNullable<String> = nil,
sessionId: String,
workspaceId: String
) {
@@ -30,7 +30,7 @@ public struct ForkChatSessionInput: InputObject {
}
/// Identify a message in the array and keep it with all previous messages into a forked session.
public var latestMessageId: String {
public var latestMessageId: GraphQLNullable<String> {
get { __data["latestMessageId"] }
set { __data["latestMessageId"] = newValue }
}

View File

@@ -0,0 +1,39 @@
// @generated
// This file was automatically generated and should not be edited.
import ApolloAPI
public struct SearchHighlight: InputObject {
public private(set) var __data: InputDict
public init(_ data: InputDict) {
__data = data
}
public init(
before: String,
end: String,
field: String
) {
__data = InputDict([
"before": before,
"end": end,
"field": field
])
}
public var before: String {
get { __data["before"] }
set { __data["before"] = newValue }
}
public var end: String {
get { __data["end"] }
set { __data["end"] = newValue }
}
public var field: String {
get { __data["field"] }
set { __data["field"] = newValue }
}
}

View File

@@ -0,0 +1,39 @@
// @generated
// This file was automatically generated and should not be edited.
import ApolloAPI
public struct SearchInput: InputObject {
public private(set) var __data: InputDict
public init(_ data: InputDict) {
__data = data
}
public init(
options: SearchOptions,
query: SearchQuery,
table: GraphQLEnum<SearchTable>
) {
__data = InputDict([
"options": options,
"query": query,
"table": table
])
}
public var options: SearchOptions {
get { __data["options"] }
set { __data["options"] = newValue }
}
public var query: SearchQuery {
get { __data["query"] }
set { __data["query"] = newValue }
}
public var table: GraphQLEnum<SearchTable> {
get { __data["table"] }
set { __data["table"] = newValue }
}
}

View File

@@ -0,0 +1,39 @@
// @generated
// This file was automatically generated and should not be edited.
import ApolloAPI
public struct SearchOptions: InputObject {
public private(set) var __data: InputDict
public init(_ data: InputDict) {
__data = data
}
public init(
fields: [String],
highlights: GraphQLNullable<[SearchHighlight]> = nil,
pagination: GraphQLNullable<SearchPagination> = nil
) {
__data = InputDict([
"fields": fields,
"highlights": highlights,
"pagination": pagination
])
}
public var fields: [String] {
get { __data["fields"] }
set { __data["fields"] = newValue }
}
public var highlights: GraphQLNullable<[SearchHighlight]> {
get { __data["highlights"] }
set { __data["highlights"] = newValue }
}
public var pagination: GraphQLNullable<SearchPagination> {
get { __data["pagination"] }
set { __data["pagination"] = newValue }
}
}

View File

@@ -0,0 +1,39 @@
// @generated
// This file was automatically generated and should not be edited.
import ApolloAPI
public struct SearchPagination: InputObject {
public private(set) var __data: InputDict
public init(_ data: InputDict) {
__data = data
}
public init(
cursor: GraphQLNullable<String> = nil,
limit: GraphQLNullable<Int> = nil,
skip: GraphQLNullable<Int> = nil
) {
__data = InputDict([
"cursor": cursor,
"limit": limit,
"skip": skip
])
}
public var cursor: GraphQLNullable<String> {
get { __data["cursor"] }
set { __data["cursor"] = newValue }
}
public var limit: GraphQLNullable<Int> {
get { __data["limit"] }
set { __data["limit"] = newValue }
}
public var skip: GraphQLNullable<Int> {
get { __data["skip"] }
set { __data["skip"] = newValue }
}
}

View File

@@ -0,0 +1,67 @@
// @generated
// This file was automatically generated and should not be edited.
import ApolloAPI
public struct SearchQuery: InputObject {
public private(set) var __data: InputDict
public init(_ data: InputDict) {
__data = data
}
public init(
boost: GraphQLNullable<Double> = nil,
field: GraphQLNullable<String> = nil,
match: GraphQLNullable<String> = nil,
occur: GraphQLNullable<GraphQLEnum<SearchQueryOccur>> = nil,
queries: GraphQLNullable<[SearchQuery]> = nil,
query: GraphQLNullable<SearchQuery> = nil,
type: GraphQLEnum<SearchQueryType>
) {
__data = InputDict([
"boost": boost,
"field": field,
"match": match,
"occur": occur,
"queries": queries,
"query": query,
"type": type
])
}
public var boost: GraphQLNullable<Double> {
get { __data["boost"] }
set { __data["boost"] = newValue }
}
public var field: GraphQLNullable<String> {
get { __data["field"] }
set { __data["field"] = newValue }
}
public var match: GraphQLNullable<String> {
get { __data["match"] }
set { __data["match"] = newValue }
}
public var occur: GraphQLNullable<GraphQLEnum<SearchQueryOccur>> {
get { __data["occur"] }
set { __data["occur"] = newValue }
}
public var queries: GraphQLNullable<[SearchQuery]> {
get { __data["queries"] }
set { __data["queries"] = newValue }
}
public var query: GraphQLNullable<SearchQuery> {
get { __data["query"] }
set { __data["query"] = newValue }
}
public var type: GraphQLEnum<SearchQueryType> {
get { __data["type"] }
set { __data["type"] = newValue }
}
}

View File

@@ -0,0 +1,12 @@
// @generated
// This file was automatically generated and should not be edited.
import ApolloAPI
public extension Objects {
static let AggregateBucketHitsObjectType = ApolloAPI.Object(
typename: "AggregateBucketHitsObjectType",
implementedInterfaces: [],
keyFields: nil
)
}

View File

@@ -0,0 +1,12 @@
// @generated
// This file was automatically generated and should not be edited.
import ApolloAPI
public extension Objects {
static let AggregateBucketObjectType = ApolloAPI.Object(
typename: "AggregateBucketObjectType",
implementedInterfaces: [],
keyFields: nil
)
}

View File

@@ -0,0 +1,12 @@
// @generated
// This file was automatically generated and should not be edited.
import ApolloAPI
public extension Objects {
static let AggregateResultObjectType = ApolloAPI.Object(
typename: "AggregateResultObjectType",
implementedInterfaces: [],
keyFields: nil
)
}

View File

@@ -0,0 +1,12 @@
// @generated
// This file was automatically generated and should not be edited.
import ApolloAPI
public extension Objects {
static let AppConfigValidateResult = ApolloAPI.Object(
typename: "AppConfigValidateResult",
implementedInterfaces: [],
keyFields: nil
)
}

View File

@@ -0,0 +1,12 @@
// @generated
// This file was automatically generated and should not be edited.
import ApolloAPI
public extension Objects {
static let CopilotWorkspaceConfig = ApolloAPI.Object(
typename: "CopilotWorkspaceConfig",
implementedInterfaces: [],
keyFields: nil
)
}

View File

@@ -0,0 +1,12 @@
// @generated
// This file was automatically generated and should not be edited.
import ApolloAPI
public extension Objects {
static let CopilotWorkspaceFile = ApolloAPI.Object(
typename: "CopilotWorkspaceFile",
implementedInterfaces: [],
keyFields: nil
)
}

View File

@@ -0,0 +1,12 @@
// @generated
// This file was automatically generated and should not be edited.
import ApolloAPI
public extension Objects {
static let CopilotWorkspaceFileTypeEdge = ApolloAPI.Object(
typename: "CopilotWorkspaceFileTypeEdge",
implementedInterfaces: [],
keyFields: nil
)
}

View File

@@ -0,0 +1,12 @@
// @generated
// This file was automatically generated and should not be edited.
import ApolloAPI
public extension Objects {
static let CopilotWorkspaceIgnoredDoc = ApolloAPI.Object(
typename: "CopilotWorkspaceIgnoredDoc",
implementedInterfaces: [],
keyFields: nil
)
}

View File

@@ -0,0 +1,12 @@
// @generated
// This file was automatically generated and should not be edited.
import ApolloAPI
public extension Objects {
static let CopilotWorkspaceIgnoredDocTypeEdge = ApolloAPI.Object(
typename: "CopilotWorkspaceIgnoredDocTypeEdge",
implementedInterfaces: [],
keyFields: nil
)
}

View File

@@ -0,0 +1,12 @@
// @generated
// This file was automatically generated and should not be edited.
import ApolloAPI
public extension Objects {
static let DocTypeEdge = ApolloAPI.Object(
typename: "DocTypeEdge",
implementedInterfaces: [],
keyFields: nil
)
}

View File

@@ -0,0 +1,12 @@
// @generated
// This file was automatically generated and should not be edited.
import ApolloAPI
public extension Objects {
static let PaginatedCopilotWorkspaceFileType = ApolloAPI.Object(
typename: "PaginatedCopilotWorkspaceFileType",
implementedInterfaces: [],
keyFields: nil
)
}

View File

@@ -0,0 +1,12 @@
// @generated
// This file was automatically generated and should not be edited.
import ApolloAPI
public extension Objects {
static let PaginatedDocType = ApolloAPI.Object(
typename: "PaginatedDocType",
implementedInterfaces: [],
keyFields: nil
)
}

View File

@@ -0,0 +1,12 @@
// @generated
// This file was automatically generated and should not be edited.
import ApolloAPI
public extension Objects {
static let PaginatedIgnoredDocsType = ApolloAPI.Object(
typename: "PaginatedIgnoredDocsType",
implementedInterfaces: [],
keyFields: nil
)
}

View File

@@ -0,0 +1,12 @@
// @generated
// This file was automatically generated and should not be edited.
import ApolloAPI
public extension Objects {
static let SearchNodeObjectType = ApolloAPI.Object(
typename: "SearchNodeObjectType",
implementedInterfaces: [],
keyFields: nil
)
}

View File

@@ -0,0 +1,12 @@
// @generated
// This file was automatically generated and should not be edited.
import ApolloAPI
public extension Objects {
static let SearchResultObjectType = ApolloAPI.Object(
typename: "SearchResultObjectType",
implementedInterfaces: [],
keyFields: nil
)
}

View File

@@ -0,0 +1,12 @@
// @generated
// This file was automatically generated and should not be edited.
import ApolloAPI
public extension Objects {
static let SearchResultPagination = ApolloAPI.Object(
typename: "SearchResultPagination",
implementedInterfaces: [],
keyFields: nil
)
}

View File

@@ -0,0 +1,12 @@
// @generated
// This file was automatically generated and should not be edited.
import ApolloAPI
public extension Objects {
static let WorkspaceDocMeta = ApolloAPI.Object(
typename: "WorkspaceDocMeta",
implementedInterfaces: [],
keyFields: nil
)
}

View File

@@ -20,6 +20,10 @@ public enum SchemaMetadata: ApolloAPI.SchemaMetadata {
public static func objectType(forTypename typename: String) -> ApolloAPI.Object? {
switch typename {
case "AggregateBucketHitsObjectType": return AffineGraphQL.Objects.AggregateBucketHitsObjectType
case "AggregateBucketObjectType": return AffineGraphQL.Objects.AggregateBucketObjectType
case "AggregateResultObjectType": return AffineGraphQL.Objects.AggregateResultObjectType
case "AppConfigValidateResult": return AffineGraphQL.Objects.AppConfigValidateResult
case "ChatMessage": return AffineGraphQL.Objects.ChatMessage
case "ContextMatchedDocChunk": return AffineGraphQL.Objects.ContextMatchedDocChunk
case "ContextMatchedFileChunk": return AffineGraphQL.Objects.ContextMatchedFileChunk
@@ -36,11 +40,17 @@ public enum SchemaMetadata: ApolloAPI.SchemaMetadata {
case "CopilotPromptType": return AffineGraphQL.Objects.CopilotPromptType
case "CopilotQuota": return AffineGraphQL.Objects.CopilotQuota
case "CopilotSessionType": return AffineGraphQL.Objects.CopilotSessionType
case "CopilotWorkspaceConfig": return AffineGraphQL.Objects.CopilotWorkspaceConfig
case "CopilotWorkspaceFile": return AffineGraphQL.Objects.CopilotWorkspaceFile
case "CopilotWorkspaceFileTypeEdge": return AffineGraphQL.Objects.CopilotWorkspaceFileTypeEdge
case "CopilotWorkspaceIgnoredDoc": return AffineGraphQL.Objects.CopilotWorkspaceIgnoredDoc
case "CopilotWorkspaceIgnoredDocTypeEdge": return AffineGraphQL.Objects.CopilotWorkspaceIgnoredDocTypeEdge
case "CredentialsRequirementType": return AffineGraphQL.Objects.CredentialsRequirementType
case "DeleteAccount": return AffineGraphQL.Objects.DeleteAccount
case "DocHistoryType": return AffineGraphQL.Objects.DocHistoryType
case "DocPermissions": return AffineGraphQL.Objects.DocPermissions
case "DocType": return AffineGraphQL.Objects.DocType
case "DocTypeEdge": return AffineGraphQL.Objects.DocTypeEdge
case "EditorType": return AffineGraphQL.Objects.EditorType
case "GrantedDocUserType": return AffineGraphQL.Objects.GrantedDocUserType
case "GrantedDocUserTypeEdge": return AffineGraphQL.Objects.GrantedDocUserTypeEdge
@@ -57,13 +67,19 @@ public enum SchemaMetadata: ApolloAPI.SchemaMetadata {
case "NotificationObjectType": return AffineGraphQL.Objects.NotificationObjectType
case "NotificationObjectTypeEdge": return AffineGraphQL.Objects.NotificationObjectTypeEdge
case "PageInfo": return AffineGraphQL.Objects.PageInfo
case "PaginatedCopilotWorkspaceFileType": return AffineGraphQL.Objects.PaginatedCopilotWorkspaceFileType
case "PaginatedDocType": return AffineGraphQL.Objects.PaginatedDocType
case "PaginatedGrantedDocUserType": return AffineGraphQL.Objects.PaginatedGrantedDocUserType
case "PaginatedIgnoredDocsType": return AffineGraphQL.Objects.PaginatedIgnoredDocsType
case "PaginatedNotificationObjectType": return AffineGraphQL.Objects.PaginatedNotificationObjectType
case "PasswordLimitsType": return AffineGraphQL.Objects.PasswordLimitsType
case "PublicUserType": return AffineGraphQL.Objects.PublicUserType
case "Query": return AffineGraphQL.Objects.Query
case "ReleaseVersionType": return AffineGraphQL.Objects.ReleaseVersionType
case "RemoveAvatar": return AffineGraphQL.Objects.RemoveAvatar
case "SearchNodeObjectType": return AffineGraphQL.Objects.SearchNodeObjectType
case "SearchResultObjectType": return AffineGraphQL.Objects.SearchResultObjectType
case "SearchResultPagination": return AffineGraphQL.Objects.SearchResultPagination
case "ServerConfigType": return AffineGraphQL.Objects.ServerConfigType
case "SubscriptionPrice": return AffineGraphQL.Objects.SubscriptionPrice
case "SubscriptionType": return AffineGraphQL.Objects.SubscriptionType
@@ -75,7 +91,7 @@ public enum SchemaMetadata: ApolloAPI.SchemaMetadata {
case "UserQuotaUsageType": return AffineGraphQL.Objects.UserQuotaUsageType
case "UserSettingsType": return AffineGraphQL.Objects.UserSettingsType
case "UserType": return AffineGraphQL.Objects.UserType
case "WorkspacePageMeta": return AffineGraphQL.Objects.WorkspacePageMeta
case "WorkspaceDocMeta": return AffineGraphQL.Objects.WorkspaceDocMeta
case "WorkspacePermissions": return AffineGraphQL.Objects.WorkspacePermissions
case "WorkspaceQuotaHumanReadableType": return AffineGraphQL.Objects.WorkspaceQuotaHumanReadableType
case "WorkspaceQuotaType": return AffineGraphQL.Objects.WorkspaceQuotaType

View File

@@ -7,26 +7,20 @@ let package = Package(
name: "Intelligents",
defaultLocalization: "en",
platforms: [
.iOS(.v15),
.macCatalyst(.v15),
.iOS(.v17),
],
products: [
.library(name: "Intelligents", targets: ["Intelligents"]),
],
dependencies: [
.package(path: "../AffineGraphQL"),
.package(path: "../MarkdownView"),
.package(url: "https://github.com/apollographql/apollo-ios.git", from: "1.22.0"),
.package(url: "https://github.com/apollographql/apollo-ios.git", from: "1.18.0"),
.package(url: "https://github.com/LaunchDarkly/swift-eventsource.git", from: "3.3.0"),
.package(url: "https://github.com/apple/swift-collections", from: "1.2.0"),
.package(url: "https://github.com/Lakr233/ChidoriMenu", from: "3.0.0"),
],
targets: [
.target(name: "Intelligents", dependencies: [
"AffineGraphQL",
"ChidoriMenu",
"MarkdownView",
"ChidoriMenu",
.product(name: "Apollo", package: "apollo-ios"),
.product(name: "LDSwiftEventSource", package: "swift-eventsource"),
.product(name: "OrderedCollections", package: "swift-collections"),

View File

@@ -1,15 +0,0 @@
//
// Constant.swift
// Intelligents
//
// Created by on 2024/11/18.
//
import UIKit
enum Constant {
static let affineTabbarHeight: CGFloat = 44
static let affineTintColor: UIColor = .init(red: 30 / 255, green: 150 / 255, blue: 235 / 255, alpha: 1.0)
static var affineUpstreamURL = URL(string: "https://app.affine.pro/")!
}

View File

@@ -1,45 +0,0 @@
//
// UnableTo.swift
// Intelligents
//
// Created by on 4/1/25.
//
import Foundation
private let domain = "Intelligents"
enum UnableTo {
static let identifyDocumentOrWorkspace =
NSError(
domain: domain,
code: -1,
userInfo: [NSLocalizedDescriptionKey: "Unable to identify the document or workspace"]
)
static let createSession = NSError(
domain: domain,
code: -1,
userInfo: [NSLocalizedDescriptionKey: "Unable to create a session"]
)
static let createMessage = NSError(
domain: domain,
code: -1,
userInfo: [NSLocalizedDescriptionKey: "Unable to create a message"]
)
static let compressImage = NSError(
domain: domain,
code: -1,
userInfo: [
NSLocalizedDescriptionKey: "Failed to compress image data",
]
)
static let clearHistory = NSError(
domain: domain,
code: -1,
userInfo: [NSLocalizedDescriptionKey: "Unable to clear history"]
)
}

View File

@@ -1,27 +0,0 @@
//
// Chat.swift
// Intelligents
//
// Created by on 2024/11/18.
//
import Foundation
struct Chat: Codable {
enum ParticipantType: String, Codable, Equatable {
case user
case bot
}
var participant: ParticipantType
typealias MarkdownDocument = String
var content: MarkdownDocument
var date: Date
init(participant: ParticipantType, content: MarkdownDocument, date: Date = .init()) {
self.participant = participant
self.content = content
self.date = date
}
}

View File

@@ -1,53 +0,0 @@
//
// Prompt.swift
// Intelligents
//
// Created by on 2024/12/26.
//
import Foundation
enum Prompt: String {
#if DEBUG
case debug_action_dalle3 = "debug:action:dalle3"
case debug_action_fal_sd15 = "debug:action:fal-sd15"
case debug_action_fal_upscaler = "debug:action:fal-upscaler"
case debug_action_fal_remove_bg = "debug:action:fal-remove-bg"
case debug_action_fal_face_to_sticker = "debug:action:fal-face-to-sticker"
#endif
case general_Chat_With_AFFiNE_AI = "Chat With AFFiNE AI"
case general_Summary = "Summary"
case general_Generate_a_caption = "Generate a caption"
case general_Summary_the_webpage = "Summary the webpage"
case general_Explain_this = "Explain this"
case general_Explain_this_image = "Explain this image"
case general_Explain_this_code = "Explain this code"
case general_Translate_to = "Translate to"
case general_Write_an_article_about_this = "Write an article about this"
case general_Write_a_twitter_about_this = "Write a twitter about this"
case general_Write_a_poem_about_this = "Write a poem about this"
case general_Write_a_blog_post_about_this = "Write a blog post about this"
case general_Write_outline = "Write outline"
case general_Change_tone_to = "Change tone to"
case general_Brainstorm_ideas_about_this = "Brainstorm ideas about this"
case general_Expand_mind_map = "Expand mind map"
case general_Improve_writing_for_it = "Improve writing for it"
case general_Improve_grammar_for_it = "Improve grammar for it"
case general_Fix_spelling_for_it = "Fix spelling for it"
case general_Find_action_items_from_it = "Find action items from it"
case general_Check_code_error = "Check code error"
case general_Create_headings = "Create headings"
case general_Make_it_real = "Make it real"
case general_Make_it_real_with_text = "Make it real with text"
case general_Make_it_longer = "Make it longer"
case general_Make_it_shorter = "Make it shorter"
case general_Continue_writing = "Continue writing"
case workflow_presentation = "workflow:presentation"
case workflow_brainstorm = "workflow:brainstorm"
case workflow_image_sketch = "workflow:image-sketch"
case workflow_image_clay = "workflow:image-clay"
case workflow_image_anime = "workflow:image-anime"
case workflow_image_pixel = "workflow:image-pixel"
}

View File

@@ -1,37 +0,0 @@
//
// Ext+EventHandler.swift
// Intelligents
//
// Created by on 2024/12/26.
//
import Foundation
import LDSwiftEventSource
class BlockEventHandler: EventHandler {
var onOpenedBlock: (() -> Void)?
var onClosedBlock: (() -> Void)?
var onMessageBlock: ((String, LDSwiftEventSource.MessageEvent) -> Void)?
var onCommentBlock: ((String) -> Void)?
var onErrorBlock: ((Error) -> Void)?
public func onOpened() {
onOpenedBlock?()
}
public func onClosed() {
onClosedBlock?()
}
public func onMessage(eventType: String, messageEvent: LDSwiftEventSource.MessageEvent) {
onMessageBlock?(eventType, messageEvent)
}
public func onComment(comment: String) {
onCommentBlock?(comment)
}
public func onError(error: any Error) {
onErrorBlock?(error)
}
}

View File

@@ -1,19 +0,0 @@
//
// Ext+String.swift
// Intelligents
//
// Created by on 2024/11/18.
//
import Foundation
extension String {
func localized() -> String {
let ans = NSLocalizedString(self, bundle: Bundle.module, comment: "")
guard !ans.isEmpty else {
assertionFailure()
return self
}
return ans
}
}

View File

@@ -1,27 +0,0 @@
//
// Ext+UIColor.swift
// Intelligents
//
// Created by on 2024/12/13.
//
import UIKit
extension UIColor {
static var accent: UIColor {
Constant.affineTintColor
}
convenience init(light: UIColor, dark: UIColor) {
self.init(dynamicProvider: { traitCollection in
switch traitCollection.userInterfaceStyle {
case .light:
light
case .dark:
dark
default:
light
}
})
}
}

View File

@@ -1,33 +0,0 @@
//
// Ext+UIFont.swift
// Intelligents
//
// Created by on 2024/11/21.
//
import UIKit
extension UIFont {
static func preferredFont(for style: TextStyle, weight: Weight, italic: Bool = false) -> UIFont {
// Get the style's default pointSize
let traits = UITraitCollection(preferredContentSizeCategory: .large)
let desc = UIFontDescriptor.preferredFontDescriptor(withTextStyle: style, compatibleWith: traits)
// Get the font at the default size and preferred weight
var font = UIFont.systemFont(ofSize: desc.pointSize, weight: weight)
if italic == true {
font = font.with([.traitItalic])
}
// Setup the font to be auto-scalable
let metrics = UIFontMetrics(forTextStyle: style)
return metrics.scaledFont(for: font)
}
private func with(_ traits: UIFontDescriptor.SymbolicTraits...) -> UIFont {
guard let descriptor = fontDescriptor.withSymbolicTraits(UIFontDescriptor.SymbolicTraits(traits).union(fontDescriptor.symbolicTraits)) else {
return self
}
return UIFont(descriptor: descriptor, size: 0)
}
}

View File

@@ -1,46 +0,0 @@
//
// Ext+UIView.swift
// Intelligents
//
// Created by on 2024/11/18.
//
import UIKit
extension UIView {
var parentViewController: UIViewController? {
var responder: UIResponder? = self
while responder != nil {
if let responder = responder as? UIViewController {
return responder
}
responder = responder?.next
}
return nil
}
func removeEveryAutoResizingMasks() {
var views: [UIView] = [self]
while let view = views.first {
views.removeFirst()
view.translatesAutoresizingMaskIntoConstraints = false
view.subviews.forEach { views.append($0) }
}
}
#if DEBUG
func debugFrame() {
layer.borderWidth = 1
layer.borderColor = [
UIColor.red,
.green,
.blue,
.yellow,
.cyan,
.magenta,
.orange,
].map(\.cgColor).randomElement()
subviews.forEach { $0.debugFrame() }
}
#endif
}

View File

@@ -1,52 +0,0 @@
//
// Ext+UIViewController.swift
// Intelligents
//
// Created by on 2024/11/18.
//
import UIKit
public extension UIViewController {
func presentIntoCurrentContext(withTargetController targetController: UIViewController, animated: Bool = true) {
if let nav = self as? UINavigationController {
nav.pushViewController(targetController, animated: animated)
} else if let nav = navigationController {
nav.pushViewController(targetController, animated: animated)
} else {
present(targetController, animated: animated, completion: nil)
}
}
func dismissInContext() {
if let nav = navigationController {
nav.popViewController(animated: true)
} else {
dismiss(animated: true, completion: nil)
}
}
func hideKeyboardWhenTappedAround() {
let tap = UITapGestureRecognizer(target: self, action: #selector(UIViewController.dismissKeyboard))
tap.cancelsTouchesInView = false
view.addGestureRecognizer(tap)
}
@objc func dismissKeyboard() {
view.endEditing(true)
}
func presentError(_ error: Error, onDismiss: @escaping () -> Void = {}) {
DispatchQueue.main.async { [self] in
let alert = UIAlertController(
title: "Error".localized(),
message: error.localizedDescription,
preferredStyle: .alert
)
alert.addAction(UIAlertAction(title: "OK".localized(), style: .default) { _ in
onDismiss()
})
present(alert, animated: true)
}
}
}

View File

@@ -1,14 +0,0 @@
//
// Ext+print.swift
// Intelligents
//
// Created by on 2024/11/18.
//
import Foundation
public func print(_ items: Any..., separator: String = " ", terminator: String = "\n") {
#if DEBUG
Swift.print(items, separator: separator, terminator: terminator)
#endif
}

View File

@@ -1,163 +0,0 @@
//
// AttachmentBannerView.swift
// Intelligents
//
// Created by on 2024/11/18.
//
import UIKit
private let attachmentSize: CGFloat = 100
private let attachmentSpacing: CGFloat = 16
class AttachmentBannerView: UIScrollView {
var readAttachments: (() -> ([UIImage]))?
var onAttachmentsDelete: ((Int) -> Void)?
var attachments: [UIImage] {
get { readAttachments?() ?? [] }
set { assertionFailure() }
}
override var intrinsicContentSize: CGSize {
if attachments.isEmpty { return .zero }
return .init(
width: (attachmentSize + attachmentSize) * CGFloat(attachments.count)
- attachmentSpacing,
height: attachmentSize
)
}
let stackView = UIStackView()
init() {
super.init(frame: .zero)
translatesAutoresizingMaskIntoConstraints = false
showsHorizontalScrollIndicator = false
showsVerticalScrollIndicator = false
stackView.axis = .horizontal
stackView.spacing = attachmentSpacing
stackView.alignment = .center
stackView.distribution = .fill
stackView.translatesAutoresizingMaskIntoConstraints = false
addSubview(stackView)
[
stackView.topAnchor.constraint(equalTo: topAnchor),
stackView.leadingAnchor.constraint(equalTo: leadingAnchor),
stackView.trailingAnchor.constraint(equalTo: trailingAnchor),
stackView.bottomAnchor.constraint(equalTo: bottomAnchor),
].forEach { $0.isActive = true }
rebuildViews()
}
@available(*, unavailable)
required init?(coder _: NSCoder) {
fatalError()
}
var reusableViews = [AttachmentPreviewView]()
func rebuildViews() {
let attachments = attachments
if reusableViews.count > attachments.count {
for index in attachments.count ..< reusableViews.count {
reusableViews[index].removeFromSuperview()
}
reusableViews.removeLast(reusableViews.count - attachments.count)
}
if reusableViews.count < attachments.count {
for _ in reusableViews.count ..< attachments.count {
let view = AttachmentPreviewView()
view.alpha = 0
reusableViews.append(view)
}
}
assert(reusableViews.count == attachments.count)
for (index, attachment) in attachments.enumerated() {
let view = reusableViews[index]
view.imageView.image = attachment
stackView.addArrangedSubview(view)
view.deleteButtonAction = { [weak self] in
self?.onAttachmentsDelete?(index)
}
}
invalidateIntrinsicContentSize()
contentSize = intrinsicContentSize
UIView.performWithoutAnimation {
self.layoutIfNeeded()
}
UIView.animate(withDuration: 0.3) {
for view in self.reusableViews {
view.alpha = 1
}
}
}
}
extension AttachmentBannerView {
class AttachmentPreviewView: UIView {
let imageView = UIImageView()
let deleteButton = UIButton()
var deleteButtonAction: (() -> Void)?
override var intrinsicContentSize: CGSize {
.init(width: attachmentSize, height: attachmentSize)
}
init() {
super.init(frame: .zero)
addSubview(imageView)
addSubview(deleteButton)
layer.cornerRadius = 8
clipsToBounds = true
imageView.contentMode = .scaleAspectFill
imageView.clipsToBounds = true
imageView.translatesAutoresizingMaskIntoConstraints = false
[
imageView.topAnchor.constraint(equalTo: topAnchor),
imageView.leadingAnchor.constraint(equalTo: leadingAnchor),
imageView.trailingAnchor.constraint(equalTo: trailingAnchor),
imageView.bottomAnchor.constraint(equalTo: bottomAnchor),
].forEach { $0.isActive = true }
deleteButton.setImage(.init(named: "close", in: .module, with: nil), for: .normal)
deleteButton.imageView?.contentMode = .scaleAspectFit
deleteButton.tintColor = .white
deleteButton.translatesAutoresizingMaskIntoConstraints = false
[
deleteButton.topAnchor.constraint(equalTo: topAnchor, constant: 4),
deleteButton.trailingAnchor.constraint(equalTo: trailingAnchor, constant: -4),
deleteButton.widthAnchor.constraint(equalToConstant: 32),
deleteButton.heightAnchor.constraint(equalToConstant: 32),
].forEach { $0.isActive = true }
deleteButton.addTarget(self, action: #selector(deleteButtonTapped), for: .touchUpInside)
[
widthAnchor.constraint(equalToConstant: attachmentSize),
heightAnchor.constraint(equalToConstant: attachmentSize),
].forEach { $0.isActive = true }
}
@available(*, unavailable)
required init?(coder _: NSCoder) {
fatalError()
}
@objc func deleteButtonTapped() {
deleteButtonAction?()
deleteButtonAction = nil
}
}
}

View File

@@ -1,63 +0,0 @@
//
// InputEditView+Camera.swift
// Intelligents
//
// Created by on 2024/12/6.
//
import AVKit
import UIKit
extension InputEditView: UIImagePickerControllerDelegate, UINavigationControllerDelegate {
@objc func takePhoto() {
AVCaptureDevice.requestAccess(for: .video) { _ in
DispatchQueue.main.async {
let ctrl = UIImagePickerController()
ctrl.allowsEditing = false
ctrl.sourceType = .camera
ctrl.mediaTypes = [UTType.movie.identifier, UTType.image.identifier]
ctrl.cameraCaptureMode = .photo
ctrl.delegate = self
self.parentViewController?.present(ctrl, animated: true)
}
}
}
private func processJPEGImageData(_ image: UIImage) throws -> Data? {
guard let data = image.jpegData(compressionQuality: 0.75) else {
throw UnableTo.compressImage
}
return data
}
func imagePickerController(_ picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [UIImagePickerController.InfoKey: Any]) {
picker.dismiss(animated: true) {
var itemUrl: URL?
if itemUrl == nil,
let image = info[.editedImage] as? UIImage ?? info[.originalImage] as? UIImage
{
let tempDir = URL(fileURLWithPath: NSTemporaryDirectory())
.appendingPathComponent("Camera")
try? FileManager.default.createDirectory(at: tempDir, withIntermediateDirectories: true)
let tempFile = tempDir
.appendingPathComponent(UUID().uuidString)
.appendingPathExtension("jpeg")
try? self.processJPEGImageData(image)?.write(to: tempFile)
itemUrl = tempFile
}
if itemUrl == nil,
let url = info[.mediaURL] as? URL
{
itemUrl = url
}
guard let url = itemUrl, FileManager.default.fileExists(atPath: url.path) else {
return
}
guard let image = UIImage(contentsOfFile: url.path) else { return }
try? FileManager.default.removeItem(at: url)
self.viewModel.attachments.append(image)
}
}
}

View File

@@ -1,38 +0,0 @@
//
// InputEditView+Photo.swift
// Intelligents
//
// Created by on 2024/12/6.
//
import PhotosUI
import UIKit
extension InputEditView: PHPickerViewControllerDelegate {
@objc func selectPhoto() {
var config = PHPickerConfiguration(photoLibrary: .shared())
config.filter = .images
config.selectionLimit = 9
let picker = PHPickerViewController(configuration: config)
picker.modalPresentationStyle = .formSheet
picker.delegate = self
parentViewController?.present(picker, animated: true, completion: nil)
}
func picker(_ picker: PHPickerViewController, didFinishPicking results: [PHPickerResult]) {
picker.dismiss(animated: true)
loadPNG(from: results)
}
private func loadPNG(from results: [PHPickerResult]) {
for result in results {
result.itemProvider.loadObject(ofClass: UIImage.self) { [weak self] image, _ in
if let image = image as? UIImage {
DispatchQueue.main.async {
self?.viewModel.attachments.append(image)
}
}
}
}
}
}

View File

@@ -1,48 +0,0 @@
//
// InputEditView+ViewModel.swift
// Intelligents
//
// Created by on 2024/11/18.
//
import Combine
import UIKit
extension InputEditView {
class ViewModel: ObservableObject {
var cancellables: Set<AnyCancellable> = []
@Published var text: String = ""
@Published var attachments: [UIImage] = []
init() {}
deinit {
cancellables.forEach { $0.cancel() }
cancellables.removeAll()
}
func reset() {
text = ""
attachments = []
}
func duplicate() -> ViewModel {
let ans = ViewModel()
ans.text = text
ans.attachments = attachments
return ans
}
}
}
extension InputEditView.ViewModel: Hashable, Equatable {
func hash(into hasher: inout Hasher) {
hasher.combine(text)
hasher.combine(attachments)
}
static func == (lhs: InputEditView.ViewModel, rhs: InputEditView.ViewModel) -> Bool {
lhs.hashValue == rhs.hashValue
}
}

View File

@@ -1,131 +0,0 @@
//
// InputEditView.swift
// Intelligents
//
// Created by on 2024/11/18.
//
import Combine
import UIKit
class InputEditView: UIView {
let mainStack = UIStackView()
let attachmentsEditor = AttachmentBannerView()
let textEditor = PlainTextEditView()
let placeholderLabel = UILabel()
let controlBanner = TextEditControlBanner()
let viewModel = ViewModel()
var placeholderText: String = "" {
didSet {
placeholderLabel.text = placeholderText
}
}
var submitAction: (() -> Void) = {}
init() {
super.init(frame: .zero)
addSubview(mainStack)
mainStack.translatesAutoresizingMaskIntoConstraints = false
mainStack.axis = .vertical
mainStack.spacing = 16
mainStack.alignment = .fill
mainStack.distribution = .equalSpacing
[
mainStack.topAnchor.constraint(equalTo: topAnchor),
mainStack.leadingAnchor.constraint(equalTo: leadingAnchor),
mainStack.trailingAnchor.constraint(equalTo: trailingAnchor),
mainStack.bottomAnchor.constraint(equalTo: bottomAnchor),
].forEach { $0.isActive = true }
textEditor.heightAnchor.constraint(greaterThanOrEqualToConstant: 64).isActive = true
[
attachmentsEditor, textEditor, controlBanner,
].forEach {
$0.translatesAutoresizingMaskIntoConstraints = false
mainStack.addArrangedSubview($0)
[
$0.leadingAnchor.constraint(equalTo: mainStack.leadingAnchor),
$0.trailingAnchor.constraint(equalTo: mainStack.trailingAnchor),
].forEach { $0.isActive = true }
}
attachmentsEditor.readAttachments = { [weak self] in
self?.viewModel.attachments ?? []
}
attachmentsEditor.onAttachmentsDelete = { [weak self] index in
self?.viewModel.attachments.remove(at: index)
}
controlBanner.cameraButton.addTarget(
self,
action: #selector(takePhoto),
for: .touchUpInside
)
controlBanner.photoButton.addTarget(
self,
action: #selector(selectPhoto),
for: .touchUpInside
)
textEditor.returnKeyType = .send
textEditor.addSubview(placeholderLabel)
placeholderLabel.textColor = .label.withAlphaComponent(0.25)
placeholderLabel.font = textEditor.font
placeholderLabel.translatesAutoresizingMaskIntoConstraints = false
[
placeholderLabel.leadingAnchor.constraint(equalTo: textEditor.leadingAnchor, constant: 2),
placeholderLabel.trailingAnchor.constraint(equalTo: textEditor.trailingAnchor, constant: -2),
placeholderLabel.topAnchor.constraint(equalTo: textEditor.topAnchor, constant: 0),
].forEach { $0.isActive = true }
viewModel.objectWillChange
.receive(on: DispatchQueue.main)
.sink { [weak self] _ in
self?.updateValues()
}
.store(in: &viewModel.cancellables)
updateValues()
textEditor.textDidChange = { [weak self] text in
self?.viewModel.text = text
self?.updatePlaceholderVisibility()
}
textEditor.textDidReturn = { [weak self] in
self?.submitAction()
}
}
@available(*, unavailable)
required init?(coder _: NSCoder) {
fatalError()
}
func updatePlaceholderVisibility() {
let visible = viewModel.text.isEmpty && !textEditor.isFirstResponder
UIView.animate(withDuration: 0.25) {
self.placeholderLabel.alpha = visible ? 1 : 0
}
}
func updateValues() {
UIView.animate(
withDuration: 0.5,
delay: 0,
usingSpringWithDamping: 1.0,
initialSpringVelocity: 0.8
) { [self] in
if textEditor.text != viewModel.text {
textEditor.text = viewModel.text
}
attachmentsEditor.rebuildViews()
parentViewController?.view.layoutIfNeeded()
updatePlaceholderVisibility()
}
}
}

View File

@@ -1,69 +0,0 @@
//
// PlainTextEditView.swift
// Intelligents
//
// Created by on 2024/11/18.
//
import UIKit
class PlainTextEditView: UITextView, UITextViewDelegate {
var textDidChange: ((String) -> Void) = { _ in }
var textDidReturn: (() -> Void) = {}
init() {
super.init(frame: .zero, textContainer: nil)
delegate = self
tintColor = .accent
linkTextAttributes = [:]
showsVerticalScrollIndicator = false
showsHorizontalScrollIndicator = false
textContainer.lineFragmentPadding = .zero
textAlignment = .natural
backgroundColor = .clear
textContainerInset = .zero
textContainer.lineBreakMode = .byTruncatingTail
isScrollEnabled = false
clipsToBounds = false
isEditable = true
isSelectable = true
isScrollEnabled = false
}
@available(*, unavailable)
required init?(coder _: NSCoder) {
fatalError()
}
func textViewDidChange(_ textView: UITextView) {
textDidChange(textView.text)
}
func textViewDidBeginEditing(_ textView: UITextView) {
textDidChange(textView.text)
}
func textViewDidEndEditing(_ textView: UITextView) {
textDidChange(textView.text)
}
func textView(_: UITextView, editMenuForTextIn _: NSRange, suggestedActions: [UIMenuElement]) -> UIMenu? {
.init(children: suggestedActions + [
UIAction(title: "Insert Newline") { [weak self] _ in
self?.insertText("\n")
},
])
}
func textView(_: UITextView, shouldChangeTextIn _: NSRange, replacementText text: String) -> Bool {
if text == "\n" {
textDidReturn()
return false
} else {
return true
}
}
}

View File

@@ -1,62 +0,0 @@
//
// TextEditControlBanner.swift
// Intelligents
//
// Created by on 2024/11/18.
//
import UIKit
class TextEditControlBanner: UIStackView {
static let height: CGFloat = 32
let cameraButton = UIButton()
let photoButton = UIButton()
let spacer = UIView()
let sendButton = UIButton()
init() {
super.init(frame: .zero)
axis = .horizontal
spacing = 16
alignment = .center
distribution = .fill
[
heightAnchor.constraint(equalToConstant: Self.height),
].forEach { $0.isActive = true }
[
cameraButton, photoButton,
sendButton,
].forEach {
$0.widthAnchor.constraint(equalToConstant: Self.height).isActive = true
$0.heightAnchor.constraint(equalToConstant: Self.height).isActive = true
}
[
cameraButton, photoButton,
spacer,
sendButton,
].forEach {
$0.translatesAutoresizingMaskIntoConstraints = false
addArrangedSubview($0)
}
cameraButton.setImage(.init(systemName: "camera"), for: .normal)
cameraButton.tintColor = .label
photoButton.setImage(.init(systemName: "photo"), for: .normal)
photoButton.tintColor = .label
sendButton.setImage(.init(systemName: "paperplane.fill"), for: .normal)
sendButton.tintColor = .label
}
@available(*, unavailable)
required init(coder _: NSCoder) {
fatalError()
}
}

View File

@@ -1,372 +0,0 @@
//
// IntelligentsChatController+Chat.swift
// Intelligents
//
// Created by on 2024/12/26.
//
import AffineGraphQL
import LDSwiftEventSource
import MarkdownParser
import UIKit
extension IntelligentsChatController {
@objc func chat_onLoad() {
beginProgress()
chat_createSession { session in
self.sessionID = session ?? ""
self.chat_retrieveHistories {
self.dispatchToMain {
self.endProgress()
}
}
} onFailure: { error in
self.presentError(error) {
if let nav = self.navigationController {
nav.popViewController(animated: true)
} else {
self.dismiss(animated: true)
}
}
}
}
@objc func chat_onSend() {
beginProgress()
let viewModel = inputBox.editor.viewModel.duplicate()
viewModel.text = viewModel.text.trimmingCharacters(in: .whitespacesAndNewlines)
inputBox.editor.viewModel.reset()
inputBox.editor.updateValues()
DispatchQueue.global().async {
self.chat_onSendExecute(viewModel: viewModel)
self.endProgress()
}
}
func chat_clearHistory() {
beginProgress()
Intelligents.qlClient.perform(mutation: CleanupCopilotSessionMutation(input: .init(
docId: metadata[.documentID] ?? "",
sessionIds: [sessionID],
workspaceId: metadata[.workspaceID] ?? ""
))) { result in
self.dispatchToMain {
self.endProgress()
if case let .success(value) = result,
let sessions = value.data?.cleanupCopilotSession,
sessions.contains(self.sessionID)
{
self.simpleChatContents.removeAll()
return
}
self.presentError(UnableTo.clearHistory)
}
}
}
func chat_retrieveHistories(_ completion: @escaping () -> Void) {
Intelligents.qlClient.fetch(query: GetCopilotHistoriesQuery(
workspaceId: metadata[.workspaceID] ?? "",
docId: .init(stringLiteral: metadata[.documentID] ?? ""),
options: .some(.init(
action: false,
fork: false,
limit: .init(nilLiteral: ()),
messageOrder: .some(.case(.asc)),
sessionId: .init(stringLiteral: sessionID),
sessionOrder: .some(.case(.desc)),
skip: .init(nilLiteral: ()),
withPrompt: .init(booleanLiteral: false)
))
)) { [weak self] result in
if let self,
case let .success(value) = result,
let object = value.data,
let currentUser = object.__data._data["currentUser"] as? DataDict,
let copilot = currentUser._data["copilot"] as? DataDict,
let histories = copilot._data["histories"] as? [DataDict],
let mostRecent = histories.first,
let messages = mostRecent._data["messages"] as? [DataDict],
!messages.isEmpty
{
print("[*] retrieved \(messages.count) messages")
tableView.scrollToBottomOnNextUpdate = true
tableView.alpha = 0
DispatchQueue.main.asyncAfter(deadline: .now() + 0.5) {
UIView.animate(withDuration: 0.5, delay: 0, usingSpringWithDamping: 1.0, initialSpringVelocity: 0.8) {
self.tableView.alpha = 1
}
}
for message in messages {
guard let role = message._data["role"] as? String,
let content = message._data["content"] as? String
// TODO: ATTACHMENTS
else { continue }
switch role {
case "assistant":
simpleChatContents.updateValue(
.assistant(document: content),
forKey: UUID()
)
case "user":
simpleChatContents.updateValue(
.user(document: content),
forKey: UUID()
)
default:
assertionFailure()
}
}
}
completion()
}
}
}
private extension IntelligentsChatController {
func dispatchToMain(_ block: @escaping () -> Void) {
if Thread.isMainThread {
block()
} else {
DispatchQueue.main.async(execute: block)
}
}
func beginProgress() {
dispatchToMain { [self] in
header.isUserInteractionEnabled = false
inputBox.isUserInteractionEnabled = false
progressView.isHidden = false
progressView.alpha = 0
progressView.startAnimating()
UIView.animate(withDuration: 0.25) {
self.inputBox.editor.alpha = 0
self.progressView.alpha = 1
}
}
}
func endProgress() {
dispatchToMain { [self] in
UIView.animate(withDuration: 0.3) {
self.inputBox.editor.alpha = 1
self.progressView.alpha = 0
self.header.isUserInteractionEnabled = true
} completion: { _ in
self.inputBox.isUserInteractionEnabled = true
self.progressView.stopAnimating()
}
}
}
}
private extension IntelligentsChatController {
func chat_onError(_ error: Error) {
print("[*] chat error", error)
dispatchToMain {
let key = UUID()
let content = ChatContent.error(text: error.localizedDescription)
self.simpleChatContents.updateValue(content, forKey: key)
}
}
func chat_createSession(
forceCreateNewSession: Bool = false,
onSuccess: @escaping (String?) -> Void,
onFailure: @escaping (Error) -> Void
) {
if !forceCreateNewSession,
let doc = metadata[.documentID],
!doc.isEmpty
{
Intelligents.qlClient.fetch(query: GetCopilotSessionsQuery(
workspaceId: .init(stringLiteral: metadata[.workspaceID] ?? ""),
docId: .init(stringLiteral: doc),
options: .some(QueryChatSessionsInput(InputDict([
"action": false,
])))
)) { result in
switch result {
case let .success(value):
if let result = value.data,
let currentUser = result.__data._data["currentUser"] as? DataDict,
let copilot = currentUser._data["copilot"] as? DataDict,
let sessions = copilot._data["sessions"] as? [DataDict],
let mostRecent = sessions.last,
let sessionID = mostRecent._data["id"] as? String
{
print("[*] using existing session", sessionID)
self.dispatchToMain { onSuccess(sessionID) }
return
}
self.chat_createSession(
forceCreateNewSession: true,
onSuccess: onSuccess,
onFailure: onFailure
)
case let .failure(error):
self.dispatchToMain { onFailure(error) }
}
}
}
Intelligents.qlClient.perform(
mutation: CreateCopilotSessionMutation(options: .init(
docId: metadata[.documentID] ?? "",
promptName: Prompt.general_Chat_With_AFFiNE_AI.rawValue,
workspaceId: metadata[.workspaceID] ?? ""
)),
queue: .global()
) { result in
switch result {
case let .success(value):
if let session = value.data?.createCopilotSession {
self.dispatchToMain { onSuccess(session) }
} else {
self.dispatchToMain {
onFailure(UnableTo.createSession)
}
}
case let .failure(error):
self.dispatchToMain { onFailure(error) }
}
}
}
func chat_onSendExecute(viewModel: InputEditView.ViewModel) {
let text = viewModel.text
// let images = viewModel.attachments
let assistantContentID = UUID()
dispatchToMain {
let content = ChatContent.user(document: text)
self.simpleChatContents.updateValue(content, forKey: .init())
self.simpleChatContents.updateValue(
.assistant(document: "..."),
forKey: assistantContentID
)
self.tableView.scrollToBottomOnNextUpdate = true
}
let sem = DispatchSemaphore(value: 0)
let sessionID = sessionID
Intelligents.qlClient.perform(
mutation: CreateCopilotMessageMutation(options: .init(
content: .init(stringLiteral: text),
params: .some(.dictionary([
"docs": [
"docId": metadata[.documentID] ?? "",
"docContent": metadata[.content] ?? "",
],
])),
sessionId: sessionID
)),
queue: .global()
) { result in
defer { sem.signal() }
switch result {
case let .success(value):
if let messageID = value.data?.createCopilotMessage {
print("[*] messageID", messageID)
self.chat_processWithMessageID(
sessionID: sessionID,
messageID: messageID,
cellID: assistantContentID
)
} else {
self.chat_onError(UnableTo.createMessage)
}
case let .failure(error):
self.chat_onError(error)
}
}
sem.wait()
}
func chat_processWithMessageID(sessionID: String, messageID: String, cellID: UUID) {
let url = Constant.affineUpstreamURL
.appendingPathComponent("api")
.appendingPathComponent("copilot")
.appendingPathComponent("chat")
.appendingPathComponent(sessionID)
.appendingPathComponent("stream")
var comps = URLComponents(url: url, resolvingAgainstBaseURL: false)
comps?.queryItems = [URLQueryItem(name: "messageId", value: messageID)]
guard let url = comps?.url else {
assertionFailure()
chat_onError(UnableTo.createMessage)
return
}
dispatchToMain {
self.simpleChatContents.updateValue(
.assistant(document: "..."),
forKey: cellID
)
}
let sem = DispatchSemaphore(value: 0)
let eventHandler = BlockEventHandler()
eventHandler.onOpenedBlock = {
print("[*] chat opened")
}
eventHandler.onClosedBlock = {
sem.signal()
self.chatTask?.stop()
self.chatTask = nil
}
eventHandler.onErrorBlock = { error in
self.chat_onError(error)
}
var document = ""
eventHandler.onMessageBlock = { _, message in
self.dispatchToMain {
document += message.data
let content = ChatContent.assistant(document: document)
self.simpleChatContents.updateValue(content, forKey: cellID)
}
}
let eventSource = EventSource(config: .init(handler: eventHandler, url: url))
chatTask = eventSource
eventSource.start()
sem.wait()
}
}
extension IntelligentsChatController {
func updateContentToPublisher() {
assert(Thread.isMainThread)
let copy = simpleChatContents
let input: [MessageListView.Element] = copy.map { key, value in
switch value {
case let .assistant(document):
let nodes = MarkdownParser().feed(document)
return .init(
id: key,
cell: .assistant,
viewModel: MessageListView.AssistantCell.ViewModel(blocks: nodes),
object: nil
)
case let .user(document):
return .init(
id: key,
cell: .user,
viewModel: MessageListView.UserCell.ViewModel(text: document),
object: nil
)
case let .error(text):
return .init(
id: key,
cell: .hint,
viewModel: MessageListView.HintCell.ViewModel(hint: text),
object: nil
)
}
}
publisher.send(input)
}
}

Some files were not shown because too many files have changed in this diff Show More