mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-15 05:37:32 +00:00
chore: basic setup of v2 AI (#12864)
Co-authored-by: Hwang <hwangdev97@gmail.com>
This commit is contained in:
@@ -7,7 +7,7 @@ public class GetCopilotHistoriesQuery: GraphQLQuery {
|
||||
public static let operationName: String = "getCopilotHistories"
|
||||
public static let operationDocument: ApolloAPI.OperationDocument = .init(
|
||||
definition: .init(
|
||||
#"query getCopilotHistories($workspaceId: String!, $docId: String, $options: QueryChatHistoriesInput) { currentUser { __typename copilot(workspaceId: $workspaceId) { __typename histories(docId: $docId, options: $options) { __typename sessionId tokens action createdAt messages { __typename id role content attachments createdAt } } } } }"#
|
||||
#"query getCopilotHistories($workspaceId: String!, $docId: String, $options: QueryChatHistoriesInput) { currentUser { __typename copilot(workspaceId: $workspaceId) { __typename histories(docId: $docId, options: $options) { __typename sessionId pinned tokens action createdAt messages { __typename id role content streamObjects { __typename type textDelta toolCallId toolName args result } attachments createdAt } } } } }"#
|
||||
))
|
||||
|
||||
public var workspaceId: String
|
||||
@@ -86,6 +86,7 @@ public class GetCopilotHistoriesQuery: GraphQLQuery {
|
||||
public static var __selections: [ApolloAPI.Selection] { [
|
||||
.field("__typename", String.self),
|
||||
.field("sessionId", String.self),
|
||||
.field("pinned", Bool.self),
|
||||
.field("tokens", Int.self),
|
||||
.field("action", String?.self),
|
||||
.field("createdAt", AffineGraphQL.DateTime.self),
|
||||
@@ -93,6 +94,7 @@ public class GetCopilotHistoriesQuery: GraphQLQuery {
|
||||
] }
|
||||
|
||||
public var sessionId: String { __data["sessionId"] }
|
||||
public var pinned: Bool { __data["pinned"] }
|
||||
/// The number of tokens used in the session
|
||||
public var tokens: Int { __data["tokens"] }
|
||||
/// An mark identifying which view to use to display the session
|
||||
@@ -113,6 +115,7 @@ public class GetCopilotHistoriesQuery: GraphQLQuery {
|
||||
.field("id", AffineGraphQL.ID?.self),
|
||||
.field("role", String.self),
|
||||
.field("content", String.self),
|
||||
.field("streamObjects", [StreamObject]?.self),
|
||||
.field("attachments", [String]?.self),
|
||||
.field("createdAt", AffineGraphQL.DateTime.self),
|
||||
] }
|
||||
@@ -120,8 +123,35 @@ public class GetCopilotHistoriesQuery: GraphQLQuery {
|
||||
public var id: AffineGraphQL.ID? { __data["id"] }
|
||||
public var role: String { __data["role"] }
|
||||
public var content: String { __data["content"] }
|
||||
public var streamObjects: [StreamObject]? { __data["streamObjects"] }
|
||||
public var attachments: [String]? { __data["attachments"] }
|
||||
public var createdAt: AffineGraphQL.DateTime { __data["createdAt"] }
|
||||
|
||||
/// CurrentUser.Copilot.History.Message.StreamObject
|
||||
///
|
||||
/// Parent Type: `StreamObject`
|
||||
public struct StreamObject: AffineGraphQL.SelectionSet {
|
||||
public let __data: DataDict
|
||||
public init(_dataDict: DataDict) { __data = _dataDict }
|
||||
|
||||
public static var __parentType: any ApolloAPI.ParentType { AffineGraphQL.Objects.StreamObject }
|
||||
public static var __selections: [ApolloAPI.Selection] { [
|
||||
.field("__typename", String.self),
|
||||
.field("type", String.self),
|
||||
.field("textDelta", String?.self),
|
||||
.field("toolCallId", String?.self),
|
||||
.field("toolName", String?.self),
|
||||
.field("args", AffineGraphQL.JSON?.self),
|
||||
.field("result", AffineGraphQL.JSON?.self),
|
||||
] }
|
||||
|
||||
public var type: String { __data["type"] }
|
||||
public var textDelta: String? { __data["textDelta"] }
|
||||
public var toolCallId: String? { __data["toolCallId"] }
|
||||
public var toolName: String? { __data["toolName"] }
|
||||
public var args: AffineGraphQL.JSON? { __data["args"] }
|
||||
public var result: AffineGraphQL.JSON? { __data["result"] }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@ public class GetCopilotHistoryIdsQuery: GraphQLQuery {
|
||||
public static let operationName: String = "getCopilotHistoryIds"
|
||||
public static let operationDocument: ApolloAPI.OperationDocument = .init(
|
||||
definition: .init(
|
||||
#"query getCopilotHistoryIds($workspaceId: String!, $docId: String, $options: QueryChatHistoriesInput) { currentUser { __typename copilot(workspaceId: $workspaceId) { __typename histories(docId: $docId, options: $options) { __typename sessionId messages { __typename id role createdAt } } } } }"#
|
||||
#"query getCopilotHistoryIds($workspaceId: String!, $docId: String, $options: QueryChatHistoriesInput) { currentUser { __typename copilot(workspaceId: $workspaceId) { __typename histories(docId: $docId, options: $options) { __typename sessionId pinned messages { __typename id role createdAt } } } } }"#
|
||||
))
|
||||
|
||||
public var workspaceId: String
|
||||
@@ -86,10 +86,12 @@ public class GetCopilotHistoryIdsQuery: GraphQLQuery {
|
||||
public static var __selections: [ApolloAPI.Selection] { [
|
||||
.field("__typename", String.self),
|
||||
.field("sessionId", String.self),
|
||||
.field("pinned", Bool.self),
|
||||
.field("messages", [Message].self),
|
||||
] }
|
||||
|
||||
public var sessionId: String { __data["sessionId"] }
|
||||
public var pinned: Bool { __data["pinned"] }
|
||||
public var messages: [Message] { __data["messages"] }
|
||||
|
||||
/// CurrentUser.Copilot.History.Message
|
||||
|
||||
@@ -7,7 +7,7 @@ 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 } } } }"#
|
||||
#"query getCopilotSession($workspaceId: String!, $sessionId: String!) { currentUser { __typename copilot(workspaceId: $workspaceId) { __typename session(sessionId: $sessionId) { __typename id parentSessionId docId pinned promptName model optionalModels } } } }"#
|
||||
))
|
||||
|
||||
public var workspaceId: String
|
||||
@@ -81,6 +81,8 @@ public class GetCopilotSessionQuery: GraphQLQuery {
|
||||
.field("__typename", String.self),
|
||||
.field("id", AffineGraphQL.ID.self),
|
||||
.field("parentSessionId", AffineGraphQL.ID?.self),
|
||||
.field("docId", String?.self),
|
||||
.field("pinned", Bool.self),
|
||||
.field("promptName", String.self),
|
||||
.field("model", String.self),
|
||||
.field("optionalModels", [String].self),
|
||||
@@ -88,6 +90,8 @@ public class GetCopilotSessionQuery: GraphQLQuery {
|
||||
|
||||
public var id: AffineGraphQL.ID { __data["id"] }
|
||||
public var parentSessionId: AffineGraphQL.ID? { __data["parentSessionId"] }
|
||||
public var docId: String? { __data["docId"] }
|
||||
public var pinned: Bool { __data["pinned"] }
|
||||
public var promptName: String { __data["promptName"] }
|
||||
public var model: String { __data["model"] }
|
||||
public var optionalModels: [String] { __data["optionalModels"] }
|
||||
|
||||
@@ -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 model optionalModels } } } }"#
|
||||
#"query getCopilotSessions($workspaceId: String!, $docId: String, $options: QueryChatSessionsInput) { currentUser { __typename copilot(workspaceId: $workspaceId) { __typename sessions(docId: $docId, options: $options) { __typename id parentSessionId docId pinned promptName model optionalModels } } } }"#
|
||||
))
|
||||
|
||||
public var workspaceId: String
|
||||
@@ -88,6 +88,8 @@ public class GetCopilotSessionsQuery: GraphQLQuery {
|
||||
.field("__typename", String.self),
|
||||
.field("id", AffineGraphQL.ID.self),
|
||||
.field("parentSessionId", AffineGraphQL.ID?.self),
|
||||
.field("docId", String?.self),
|
||||
.field("pinned", Bool.self),
|
||||
.field("promptName", String.self),
|
||||
.field("model", String.self),
|
||||
.field("optionalModels", [String].self),
|
||||
@@ -95,6 +97,8 @@ public class GetCopilotSessionsQuery: GraphQLQuery {
|
||||
|
||||
public var id: AffineGraphQL.ID { __data["id"] }
|
||||
public var parentSessionId: AffineGraphQL.ID? { __data["parentSessionId"] }
|
||||
public var docId: String? { __data["docId"] }
|
||||
public var pinned: Bool { __data["pinned"] }
|
||||
public var promptName: String { __data["promptName"] }
|
||||
public var model: String { __data["model"] }
|
||||
public var optionalModels: [String] { __data["optionalModels"] }
|
||||
|
||||
@@ -0,0 +1,138 @@
|
||||
// @generated
|
||||
// This file was automatically generated and should not be edited.
|
||||
|
||||
@_exported import ApolloAPI
|
||||
|
||||
public class GetRecentlyUpdatedDocsQuery: GraphQLQuery {
|
||||
public static let operationName: String = "getRecentlyUpdatedDocs"
|
||||
public static let operationDocument: ApolloAPI.OperationDocument = .init(
|
||||
definition: .init(
|
||||
#"query getRecentlyUpdatedDocs($workspaceId: String!, $pagination: PaginationInput!) { workspace(id: $workspaceId) { __typename recentlyUpdatedDocs(pagination: $pagination) { __typename totalCount pageInfo { __typename endCursor hasNextPage } edges { __typename node { __typename id title createdAt updatedAt 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("recentlyUpdatedDocs", RecentlyUpdatedDocs.self, arguments: ["pagination": .variable("pagination")]),
|
||||
] }
|
||||
|
||||
/// Get recently updated docs of a workspace
|
||||
public var recentlyUpdatedDocs: RecentlyUpdatedDocs { __data["recentlyUpdatedDocs"] }
|
||||
|
||||
/// Workspace.RecentlyUpdatedDocs
|
||||
///
|
||||
/// Parent Type: `PaginatedDocType`
|
||||
public struct RecentlyUpdatedDocs: 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.RecentlyUpdatedDocs.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.RecentlyUpdatedDocs.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.RecentlyUpdatedDocs.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("title", String?.self),
|
||||
.field("createdAt", AffineGraphQL.DateTime?.self),
|
||||
.field("updatedAt", AffineGraphQL.DateTime?.self),
|
||||
.field("creatorId", String?.self),
|
||||
.field("lastUpdaterId", String?.self),
|
||||
] }
|
||||
|
||||
public var id: String { __data["id"] }
|
||||
public var title: String? { __data["title"] }
|
||||
public var createdAt: AffineGraphQL.DateTime? { __data["createdAt"] }
|
||||
public var updatedAt: AffineGraphQL.DateTime? { __data["updatedAt"] }
|
||||
public var creatorId: String? { __data["creatorId"] }
|
||||
public var lastUpdaterId: String? { __data["lastUpdaterId"] }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -11,22 +11,29 @@ public struct CreateChatSessionInput: InputObject {
|
||||
}
|
||||
|
||||
public init(
|
||||
docId: String,
|
||||
docId: GraphQLNullable<String> = nil,
|
||||
pinned: GraphQLNullable<Bool> = nil,
|
||||
promptName: String,
|
||||
workspaceId: String
|
||||
) {
|
||||
__data = InputDict([
|
||||
"docId": docId,
|
||||
"pinned": pinned,
|
||||
"promptName": promptName,
|
||||
"workspaceId": workspaceId
|
||||
])
|
||||
}
|
||||
|
||||
public var docId: String {
|
||||
public var docId: GraphQLNullable<String> {
|
||||
get { __data["docId"] }
|
||||
set { __data["docId"] = newValue }
|
||||
}
|
||||
|
||||
public var pinned: GraphQLNullable<Bool> {
|
||||
get { __data["pinned"] }
|
||||
set { __data["pinned"] = newValue }
|
||||
}
|
||||
|
||||
/// The prompt name to use for the session
|
||||
public var promptName: String {
|
||||
get { __data["promptName"] }
|
||||
|
||||
@@ -11,17 +11,33 @@ public struct UpdateChatSessionInput: InputObject {
|
||||
}
|
||||
|
||||
public init(
|
||||
promptName: String,
|
||||
docId: GraphQLNullable<String> = nil,
|
||||
pinned: GraphQLNullable<Bool> = nil,
|
||||
promptName: GraphQLNullable<String> = nil,
|
||||
sessionId: String
|
||||
) {
|
||||
__data = InputDict([
|
||||
"docId": docId,
|
||||
"pinned": pinned,
|
||||
"promptName": promptName,
|
||||
"sessionId": sessionId
|
||||
])
|
||||
}
|
||||
|
||||
/// The workspace id of the session
|
||||
public var docId: GraphQLNullable<String> {
|
||||
get { __data["docId"] }
|
||||
set { __data["docId"] = newValue }
|
||||
}
|
||||
|
||||
/// Whether to pin the session
|
||||
public var pinned: GraphQLNullable<Bool> {
|
||||
get { __data["pinned"] }
|
||||
set { __data["pinned"] = newValue }
|
||||
}
|
||||
|
||||
/// The prompt name to use for the session
|
||||
public var promptName: String {
|
||||
public var promptName: GraphQLNullable<String> {
|
||||
get { __data["promptName"] }
|
||||
set { __data["promptName"] = newValue }
|
||||
}
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
// @generated
|
||||
// This file was automatically generated and should not be edited.
|
||||
|
||||
import ApolloAPI
|
||||
|
||||
public extension Objects {
|
||||
static let StreamObject = ApolloAPI.Object(
|
||||
typename: "StreamObject",
|
||||
implementedInterfaces: [],
|
||||
keyFields: nil
|
||||
)
|
||||
}
|
||||
@@ -81,6 +81,7 @@ public enum SchemaMetadata: ApolloAPI.SchemaMetadata {
|
||||
case "SearchResultObjectType": return AffineGraphQL.Objects.SearchResultObjectType
|
||||
case "SearchResultPagination": return AffineGraphQL.Objects.SearchResultPagination
|
||||
case "ServerConfigType": return AffineGraphQL.Objects.ServerConfigType
|
||||
case "StreamObject": return AffineGraphQL.Objects.StreamObject
|
||||
case "SubscriptionPrice": return AffineGraphQL.Objects.SubscriptionPrice
|
||||
case "SubscriptionType": return AffineGraphQL.Objects.SubscriptionType
|
||||
case "TranscriptionItemType": return AffineGraphQL.Objects.TranscriptionItemType
|
||||
|
||||
Reference in New Issue
Block a user