chore: update graphql support for fetching initial user status (#12905)

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

- **New Features**
- Introduced a new context management system for intelligent features,
enabling the collection and preparation of metadata from both web view
and GraphQL sources.
- Added a service for managing GraphQL API interactions, including user,
workspace, subscription, and quota queries.
- Enabled searching documents within a workspace using a new GraphQL
query and input structure.

- **Enhancements**
- Expanded chat session and chat history search capabilities with
additional filter and pagination options.

- **Refactor**
- Replaced the previous context management class with a more
comprehensive and modular implementation.
- Improved handling of cookies for network requests to ensure session
continuity.

- **Style**
- Minor code style and formatting improvements for clarity and
consistency.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
This commit is contained in:
Lakr
2025-06-24 13:03:35 +08:00
committed by GitHub
parent 63de20c3d5
commit 10139205b4
17 changed files with 585 additions and 97 deletions

View File

@@ -15,6 +15,7 @@ public struct QueryChatHistoriesInput: InputObject {
fork: GraphQLNullable<Bool> = nil,
limit: GraphQLNullable<Int> = nil,
messageOrder: GraphQLNullable<GraphQLEnum<ChatHistoryOrder>> = nil,
pinned: GraphQLNullable<Bool> = nil,
sessionId: GraphQLNullable<String> = nil,
sessionOrder: GraphQLNullable<GraphQLEnum<ChatHistoryOrder>> = nil,
skip: GraphQLNullable<Int> = nil,
@@ -25,6 +26,7 @@ public struct QueryChatHistoriesInput: InputObject {
"fork": fork,
"limit": limit,
"messageOrder": messageOrder,
"pinned": pinned,
"sessionId": sessionId,
"sessionOrder": sessionOrder,
"skip": skip,
@@ -52,6 +54,11 @@ public struct QueryChatHistoriesInput: InputObject {
set { __data["messageOrder"] = newValue }
}
public var pinned: GraphQLNullable<Bool> {
get { __data["pinned"] }
set { __data["pinned"] = newValue }
}
public var sessionId: GraphQLNullable<String> {
get { __data["sessionId"] }
set { __data["sessionId"] = newValue }

View File

@@ -11,10 +11,18 @@ public struct QueryChatSessionsInput: InputObject {
}
public init(
action: GraphQLNullable<Bool> = nil
action: GraphQLNullable<Bool> = nil,
fork: GraphQLNullable<Bool> = nil,
limit: GraphQLNullable<Int> = nil,
pinned: GraphQLNullable<Bool> = nil,
skip: GraphQLNullable<Int> = nil
) {
__data = InputDict([
"action": action
"action": action,
"fork": fork,
"limit": limit,
"pinned": pinned,
"skip": skip
])
}
@@ -22,4 +30,24 @@ public struct QueryChatSessionsInput: InputObject {
get { __data["action"] }
set { __data["action"] = newValue }
}
public var fork: GraphQLNullable<Bool> {
get { __data["fork"] }
set { __data["fork"] = newValue }
}
public var limit: GraphQLNullable<Int> {
get { __data["limit"] }
set { __data["limit"] = newValue }
}
public var pinned: GraphQLNullable<Bool> {
get { __data["pinned"] }
set { __data["pinned"] = newValue }
}
public var skip: GraphQLNullable<Int> {
get { __data["skip"] }
set { __data["skip"] = newValue }
}
}

View File

@@ -0,0 +1,33 @@
// @generated
// This file was automatically generated and should not be edited.
import ApolloAPI
public struct SearchDocsInput: InputObject {
public private(set) var __data: InputDict
public init(_ data: InputDict) {
__data = data
}
public init(
keyword: String,
limit: GraphQLNullable<Int> = nil
) {
__data = InputDict([
"keyword": keyword,
"limit": limit
])
}
public var keyword: String {
get { __data["keyword"] }
set { __data["keyword"] = newValue }
}
/// Limit the number of docs to return, default is 20
public var limit: GraphQLNullable<Int> {
get { __data["limit"] }
set { __data["limit"] = 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 SearchDocObjectType = ApolloAPI.Object(
typename: "SearchDocObjectType",
implementedInterfaces: [],
keyFields: nil
)
}

View File

@@ -77,6 +77,7 @@ public enum SchemaMetadata: ApolloAPI.SchemaMetadata {
case "Query": return AffineGraphQL.Objects.Query
case "ReleaseVersionType": return AffineGraphQL.Objects.ReleaseVersionType
case "RemoveAvatar": return AffineGraphQL.Objects.RemoveAvatar
case "SearchDocObjectType": return AffineGraphQL.Objects.SearchDocObjectType
case "SearchNodeObjectType": return AffineGraphQL.Objects.SearchNodeObjectType
case "SearchResultObjectType": return AffineGraphQL.Objects.SearchResultObjectType
case "SearchResultPagination": return AffineGraphQL.Objects.SearchResultPagination