From 5415f1579b654d79ae55378e4ab0ce5ad0388da1 Mon Sep 17 00:00:00 2001 From: Lakr Date: Mon, 21 Jul 2025 13:23:43 +0800 Subject: [PATCH] chore: gql update --- .../ApplyDocUpdatesQuery.graphql.swift | 54 +++++++++++++++++++ ...etCopilotRecentSessionsQuery.graphql.swift | 16 ++++-- .../CreateChatMessageInput.graphql.swift | 7 +++ 3 files changed, 73 insertions(+), 4 deletions(-) create mode 100644 packages/frontend/apps/ios/App/Packages/AffineGraphQL/Sources/Operations/Queries/ApplyDocUpdatesQuery.graphql.swift diff --git a/packages/frontend/apps/ios/App/Packages/AffineGraphQL/Sources/Operations/Queries/ApplyDocUpdatesQuery.graphql.swift b/packages/frontend/apps/ios/App/Packages/AffineGraphQL/Sources/Operations/Queries/ApplyDocUpdatesQuery.graphql.swift new file mode 100644 index 0000000000..13080d5963 --- /dev/null +++ b/packages/frontend/apps/ios/App/Packages/AffineGraphQL/Sources/Operations/Queries/ApplyDocUpdatesQuery.graphql.swift @@ -0,0 +1,54 @@ +// @generated +// This file was automatically generated and should not be edited. + +@_exported import ApolloAPI + +public class ApplyDocUpdatesQuery: GraphQLQuery { + public static let operationName: String = "applyDocUpdates" + public static let operationDocument: ApolloAPI.OperationDocument = .init( + definition: .init( + #"query applyDocUpdates($workspaceId: String!, $docId: String!, $op: String!, $updates: String!) { applyDocUpdates( workspaceId: $workspaceId docId: $docId op: $op updates: $updates ) }"# + )) + + public var workspaceId: String + public var docId: String + public var op: String + public var updates: String + + public init( + workspaceId: String, + docId: String, + op: String, + updates: String + ) { + self.workspaceId = workspaceId + self.docId = docId + self.op = op + self.updates = updates + } + + public var __variables: Variables? { [ + "workspaceId": workspaceId, + "docId": docId, + "op": op, + "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.Query } + public static var __selections: [ApolloAPI.Selection] { [ + .field("applyDocUpdates", String.self, arguments: [ + "workspaceId": .variable("workspaceId"), + "docId": .variable("docId"), + "op": .variable("op"), + "updates": .variable("updates") + ]), + ] } + + /// Apply updates to a doc using LLM and return the merged markdown. + public var applyDocUpdates: String { __data["applyDocUpdates"] } + } +} diff --git a/packages/frontend/apps/ios/App/Packages/AffineGraphQL/Sources/Operations/Queries/GetCopilotRecentSessionsQuery.graphql.swift b/packages/frontend/apps/ios/App/Packages/AffineGraphQL/Sources/Operations/Queries/GetCopilotRecentSessionsQuery.graphql.swift index ca0f2f1735..3de44adfaa 100644 --- a/packages/frontend/apps/ios/App/Packages/AffineGraphQL/Sources/Operations/Queries/GetCopilotRecentSessionsQuery.graphql.swift +++ b/packages/frontend/apps/ios/App/Packages/AffineGraphQL/Sources/Operations/Queries/GetCopilotRecentSessionsQuery.graphql.swift @@ -7,24 +7,28 @@ public class GetCopilotRecentSessionsQuery: GraphQLQuery { public static let operationName: String = "getCopilotRecentSessions" public static let operationDocument: ApolloAPI.OperationDocument = .init( definition: .init( - #"query getCopilotRecentSessions($workspaceId: String!, $limit: Int = 10) { currentUser { __typename copilot(workspaceId: $workspaceId) { __typename chats( pagination: { first: $limit } options: { fork: false, sessionOrder: desc, withMessages: false } ) { __typename ...PaginatedCopilotChats } } } }"#, + #"query getCopilotRecentSessions($workspaceId: String!, $limit: Int = 10, $offset: Int = 0) { currentUser { __typename copilot(workspaceId: $workspaceId) { __typename chats( pagination: { first: $limit, offset: $offset } options: { action: false, fork: false, sessionOrder: desc, withMessages: false } ) { __typename ...PaginatedCopilotChats } } } }"#, fragments: [CopilotChatHistory.self, CopilotChatMessage.self, PaginatedCopilotChats.self] )) public var workspaceId: String public var limit: GraphQLNullable + public var offset: GraphQLNullable public init( workspaceId: String, - limit: GraphQLNullable = 10 + limit: GraphQLNullable = 10, + offset: GraphQLNullable = 0 ) { self.workspaceId = workspaceId self.limit = limit + self.offset = offset } public var __variables: Variables? { [ "workspaceId": workspaceId, - "limit": limit + "limit": limit, + "offset": offset ] } public struct Data: AffineGraphQL.SelectionSet { @@ -65,8 +69,12 @@ public class GetCopilotRecentSessionsQuery: GraphQLQuery { public static var __selections: [ApolloAPI.Selection] { [ .field("__typename", String.self), .field("chats", Chats.self, arguments: [ - "pagination": ["first": .variable("limit")], + "pagination": [ + "first": .variable("limit"), + "offset": .variable("offset") + ], "options": [ + "action": false, "fork": false, "sessionOrder": "desc", "withMessages": false diff --git a/packages/frontend/apps/ios/App/Packages/AffineGraphQL/Sources/Schema/InputObjects/CreateChatMessageInput.graphql.swift b/packages/frontend/apps/ios/App/Packages/AffineGraphQL/Sources/Schema/InputObjects/CreateChatMessageInput.graphql.swift index 45f0868e7f..9d57fe5fdf 100644 --- a/packages/frontend/apps/ios/App/Packages/AffineGraphQL/Sources/Schema/InputObjects/CreateChatMessageInput.graphql.swift +++ b/packages/frontend/apps/ios/App/Packages/AffineGraphQL/Sources/Schema/InputObjects/CreateChatMessageInput.graphql.swift @@ -12,6 +12,7 @@ public struct CreateChatMessageInput: InputObject { public init( attachments: GraphQLNullable<[String]> = nil, + blob: GraphQLNullable = nil, blobs: GraphQLNullable<[Upload]> = nil, content: GraphQLNullable = nil, params: GraphQLNullable = nil, @@ -19,6 +20,7 @@ public struct CreateChatMessageInput: InputObject { ) { __data = InputDict([ "attachments": attachments, + "blob": blob, "blobs": blobs, "content": content, "params": params, @@ -31,6 +33,11 @@ public struct CreateChatMessageInput: InputObject { set { __data["attachments"] = newValue } } + public var blob: GraphQLNullable { + get { __data["blob"] } + set { __data["blob"] = newValue } + } + public var blobs: GraphQLNullable<[Upload]> { get { __data["blobs"] } set { __data["blobs"] = newValue }