refactor: update gateway agent session key handling and improve related logic
This commit is contained in:
@@ -3498,7 +3498,7 @@ export const useUpdateAgentSoulApiV1AgentBoardsBoardIdAgentsAgentIdSoulPut = <
|
||||
);
|
||||
};
|
||||
/**
|
||||
* Route a lead's ask-user request through the gateway main agent.
|
||||
* Route a lead's ask-user request through the dedicated gateway agent.
|
||||
* @summary Ask User Via Gateway Main
|
||||
*/
|
||||
export type askUserViaGatewayMainApiV1AgentBoardsBoardIdGatewayMainAskUserPostResponse200 =
|
||||
|
||||
@@ -275,7 +275,7 @@ export function useGetOnboardingApiV1BoardsBoardIdOnboardingGet<
|
||||
}
|
||||
|
||||
/**
|
||||
* Start onboarding and send instructions to the gateway main agent.
|
||||
* Start onboarding and send instructions to the gateway agent.
|
||||
* @summary Start Onboarding
|
||||
*/
|
||||
export type startOnboardingApiV1BoardsBoardIdOnboardingStartPostResponse200 = {
|
||||
@@ -417,7 +417,7 @@ export const useStartOnboardingApiV1BoardsBoardIdOnboardingStartPost = <
|
||||
);
|
||||
};
|
||||
/**
|
||||
* Send a user onboarding answer to the gateway main agent.
|
||||
* Send a user onboarding answer to the gateway agent.
|
||||
* @summary Answer Onboarding
|
||||
*/
|
||||
export type answerOnboardingApiV1BoardsBoardIdOnboardingAnswerPostResponse200 =
|
||||
@@ -567,7 +567,7 @@ export const useAnswerOnboardingApiV1BoardsBoardIdOnboardingAnswerPost = <
|
||||
);
|
||||
};
|
||||
/**
|
||||
* Store onboarding updates submitted by the gateway main agent.
|
||||
* Store onboarding updates submitted by the gateway agent.
|
||||
* @summary Agent Onboarding Update
|
||||
*/
|
||||
export type agentOnboardingUpdateApiV1BoardsBoardIdOnboardingAgentPostResponse200 =
|
||||
|
||||
@@ -24,13 +24,13 @@ import type {
|
||||
GatewayCommandsResponse,
|
||||
GatewayCreate,
|
||||
GatewayRead,
|
||||
GatewayResolveQuery,
|
||||
GatewaySessionHistoryResponse,
|
||||
GatewaySessionMessageRequest,
|
||||
GatewaySessionResponse,
|
||||
GatewaySessionsResponse,
|
||||
GatewayTemplatesSyncResult,
|
||||
GatewayUpdate,
|
||||
GatewaysStatusApiV1GatewaysStatusGetParams,
|
||||
GatewaysStatusResponse,
|
||||
GetGatewaySessionApiV1GatewaysSessionsSessionIdGetParams,
|
||||
GetSessionHistoryApiV1GatewaysSessionsSessionIdHistoryGetParams,
|
||||
@@ -74,36 +74,48 @@ export type gatewaysStatusApiV1GatewaysStatusGetResponse =
|
||||
| gatewaysStatusApiV1GatewaysStatusGetResponseSuccess
|
||||
| gatewaysStatusApiV1GatewaysStatusGetResponseError;
|
||||
|
||||
export const getGatewaysStatusApiV1GatewaysStatusGetUrl = () => {
|
||||
return `/api/v1/gateways/status`;
|
||||
export const getGatewaysStatusApiV1GatewaysStatusGetUrl = (
|
||||
params?: GatewaysStatusApiV1GatewaysStatusGetParams,
|
||||
) => {
|
||||
const normalizedParams = new URLSearchParams();
|
||||
|
||||
Object.entries(params || {}).forEach(([key, value]) => {
|
||||
if (value !== undefined) {
|
||||
normalizedParams.append(key, value === null ? "null" : value.toString());
|
||||
}
|
||||
});
|
||||
|
||||
const stringifiedParams = normalizedParams.toString();
|
||||
|
||||
return stringifiedParams.length > 0
|
||||
? `/api/v1/gateways/status?${stringifiedParams}`
|
||||
: `/api/v1/gateways/status`;
|
||||
};
|
||||
|
||||
export const gatewaysStatusApiV1GatewaysStatusGet = async (
|
||||
gatewayResolveQuery: GatewayResolveQuery,
|
||||
params?: GatewaysStatusApiV1GatewaysStatusGetParams,
|
||||
options?: RequestInit,
|
||||
): Promise<gatewaysStatusApiV1GatewaysStatusGetResponse> => {
|
||||
return customFetch<gatewaysStatusApiV1GatewaysStatusGetResponse>(
|
||||
getGatewaysStatusApiV1GatewaysStatusGetUrl(),
|
||||
getGatewaysStatusApiV1GatewaysStatusGetUrl(params),
|
||||
{
|
||||
...options,
|
||||
method: "GET",
|
||||
headers: { "Content-Type": "application/json", ...options?.headers },
|
||||
body: JSON.stringify(gatewayResolveQuery),
|
||||
},
|
||||
);
|
||||
};
|
||||
|
||||
export const getGatewaysStatusApiV1GatewaysStatusGetQueryKey = (
|
||||
gatewayResolveQuery?: GatewayResolveQuery,
|
||||
params?: GatewaysStatusApiV1GatewaysStatusGetParams,
|
||||
) => {
|
||||
return [`/api/v1/gateways/status`, gatewayResolveQuery] as const;
|
||||
return [`/api/v1/gateways/status`, ...(params ? [params] : [])] as const;
|
||||
};
|
||||
|
||||
export const getGatewaysStatusApiV1GatewaysStatusGetQueryOptions = <
|
||||
TData = Awaited<ReturnType<typeof gatewaysStatusApiV1GatewaysStatusGet>>,
|
||||
TError = HTTPValidationError,
|
||||
>(
|
||||
gatewayResolveQuery: GatewayResolveQuery,
|
||||
params?: GatewaysStatusApiV1GatewaysStatusGetParams,
|
||||
options?: {
|
||||
query?: Partial<
|
||||
UseQueryOptions<
|
||||
@@ -119,15 +131,12 @@ export const getGatewaysStatusApiV1GatewaysStatusGetQueryOptions = <
|
||||
|
||||
const queryKey =
|
||||
queryOptions?.queryKey ??
|
||||
getGatewaysStatusApiV1GatewaysStatusGetQueryKey(gatewayResolveQuery);
|
||||
getGatewaysStatusApiV1GatewaysStatusGetQueryKey(params);
|
||||
|
||||
const queryFn: QueryFunction<
|
||||
Awaited<ReturnType<typeof gatewaysStatusApiV1GatewaysStatusGet>>
|
||||
> = ({ signal }) =>
|
||||
gatewaysStatusApiV1GatewaysStatusGet(gatewayResolveQuery, {
|
||||
signal,
|
||||
...requestOptions,
|
||||
});
|
||||
gatewaysStatusApiV1GatewaysStatusGet(params, { signal, ...requestOptions });
|
||||
|
||||
return { queryKey, queryFn, ...queryOptions } as UseQueryOptions<
|
||||
Awaited<ReturnType<typeof gatewaysStatusApiV1GatewaysStatusGet>>,
|
||||
@@ -146,7 +155,7 @@ export function useGatewaysStatusApiV1GatewaysStatusGet<
|
||||
TData = Awaited<ReturnType<typeof gatewaysStatusApiV1GatewaysStatusGet>>,
|
||||
TError = HTTPValidationError,
|
||||
>(
|
||||
gatewayResolveQuery: GatewayResolveQuery,
|
||||
params: undefined | GatewaysStatusApiV1GatewaysStatusGetParams,
|
||||
options: {
|
||||
query: Partial<
|
||||
UseQueryOptions<
|
||||
@@ -173,7 +182,7 @@ export function useGatewaysStatusApiV1GatewaysStatusGet<
|
||||
TData = Awaited<ReturnType<typeof gatewaysStatusApiV1GatewaysStatusGet>>,
|
||||
TError = HTTPValidationError,
|
||||
>(
|
||||
gatewayResolveQuery: GatewayResolveQuery,
|
||||
params?: GatewaysStatusApiV1GatewaysStatusGetParams,
|
||||
options?: {
|
||||
query?: Partial<
|
||||
UseQueryOptions<
|
||||
@@ -200,7 +209,7 @@ export function useGatewaysStatusApiV1GatewaysStatusGet<
|
||||
TData = Awaited<ReturnType<typeof gatewaysStatusApiV1GatewaysStatusGet>>,
|
||||
TError = HTTPValidationError,
|
||||
>(
|
||||
gatewayResolveQuery: GatewayResolveQuery,
|
||||
params?: GatewaysStatusApiV1GatewaysStatusGetParams,
|
||||
options?: {
|
||||
query?: Partial<
|
||||
UseQueryOptions<
|
||||
@@ -223,7 +232,7 @@ export function useGatewaysStatusApiV1GatewaysStatusGet<
|
||||
TData = Awaited<ReturnType<typeof gatewaysStatusApiV1GatewaysStatusGet>>,
|
||||
TError = HTTPValidationError,
|
||||
>(
|
||||
gatewayResolveQuery: GatewayResolveQuery,
|
||||
params?: GatewaysStatusApiV1GatewaysStatusGetParams,
|
||||
options?: {
|
||||
query?: Partial<
|
||||
UseQueryOptions<
|
||||
@@ -239,7 +248,7 @@ export function useGatewaysStatusApiV1GatewaysStatusGet<
|
||||
queryKey: DataTag<QueryKey, TData, TError>;
|
||||
} {
|
||||
const queryOptions = getGatewaysStatusApiV1GatewaysStatusGetQueryOptions(
|
||||
gatewayResolveQuery,
|
||||
params,
|
||||
options,
|
||||
);
|
||||
|
||||
|
||||
@@ -11,7 +11,6 @@
|
||||
export interface GatewayCreate {
|
||||
name: string;
|
||||
url: string;
|
||||
main_session_key: string;
|
||||
workspace_root: string;
|
||||
token?: string | null;
|
||||
}
|
||||
|
||||
@@ -11,11 +11,11 @@
|
||||
export interface GatewayRead {
|
||||
name: string;
|
||||
url: string;
|
||||
main_session_key: string;
|
||||
workspace_root: string;
|
||||
id: string;
|
||||
organization_id: string;
|
||||
token?: string | null;
|
||||
main_session_key: string;
|
||||
created_at: string;
|
||||
updated_at: string;
|
||||
}
|
||||
|
||||
@@ -12,5 +12,4 @@ export interface GatewayResolveQuery {
|
||||
board_id?: string | null;
|
||||
gateway_url?: string | null;
|
||||
gateway_token?: string | null;
|
||||
gateway_main_session_key?: string | null;
|
||||
}
|
||||
|
||||
@@ -12,6 +12,5 @@ export interface GatewayUpdate {
|
||||
name?: string | null;
|
||||
url?: string | null;
|
||||
token?: string | null;
|
||||
main_session_key?: string | null;
|
||||
workspace_root?: string | null;
|
||||
}
|
||||
|
||||
@@ -9,5 +9,4 @@ export type GatewaysStatusApiV1GatewaysStatusGetParams = {
|
||||
board_id?: string | null;
|
||||
gateway_url?: string | null;
|
||||
gateway_token?: string | null;
|
||||
gateway_main_session_key?: string | null;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user