feat: add is_chat field to board memory and task_id to approvals, update pagination and response models
This commit is contained in:
@@ -116,7 +116,7 @@ export default function EditAgentPage() {
|
||||
const boardsQuery = useListBoardsApiV1BoardsGet<
|
||||
listBoardsApiV1BoardsGetResponse,
|
||||
ApiError
|
||||
>({
|
||||
>(undefined, {
|
||||
query: {
|
||||
enabled: Boolean(isSignedIn),
|
||||
refetchOnMount: "always",
|
||||
@@ -148,7 +148,8 @@ export default function EditAgentPage() {
|
||||
},
|
||||
});
|
||||
|
||||
const boards = boardsQuery.data?.status === 200 ? boardsQuery.data.data : [];
|
||||
const boards =
|
||||
boardsQuery.data?.status === 200 ? boardsQuery.data.data.items ?? [] : [];
|
||||
const loadedAgent: AgentRead | null =
|
||||
agentQuery.data?.status === 200 ? agentQuery.data.data : null;
|
||||
|
||||
|
||||
@@ -106,7 +106,7 @@ export default function AgentDetailPage() {
|
||||
const boardsQuery = useListBoardsApiV1BoardsGet<
|
||||
listBoardsApiV1BoardsGetResponse,
|
||||
ApiError
|
||||
>({
|
||||
>(undefined, {
|
||||
query: {
|
||||
enabled: Boolean(isSignedIn),
|
||||
refetchInterval: 60_000,
|
||||
@@ -118,9 +118,11 @@ export default function AgentDetailPage() {
|
||||
const agent: AgentRead | null =
|
||||
agentQuery.data?.status === 200 ? agentQuery.data.data : null;
|
||||
const events: ActivityEventRead[] =
|
||||
activityQuery.data?.status === 200 ? activityQuery.data.data : [];
|
||||
activityQuery.data?.status === 200
|
||||
? activityQuery.data.data.items ?? []
|
||||
: [];
|
||||
const boards: BoardRead[] =
|
||||
boardsQuery.data?.status === 200 ? boardsQuery.data.data : [];
|
||||
boardsQuery.data?.status === 200 ? boardsQuery.data.data.items ?? [] : [];
|
||||
|
||||
const agentEvents = useMemo(() => {
|
||||
if (!agent) return [];
|
||||
|
||||
@@ -91,7 +91,7 @@ export default function NewAgentPage() {
|
||||
const boardsQuery = useListBoardsApiV1BoardsGet<
|
||||
listBoardsApiV1BoardsGetResponse,
|
||||
ApiError
|
||||
>({
|
||||
>(undefined, {
|
||||
query: {
|
||||
enabled: Boolean(isSignedIn),
|
||||
refetchOnMount: "always",
|
||||
@@ -111,7 +111,8 @@ export default function NewAgentPage() {
|
||||
},
|
||||
});
|
||||
|
||||
const boards = boardsQuery.data?.status === 200 ? boardsQuery.data.data : [];
|
||||
const boards =
|
||||
boardsQuery.data?.status === 200 ? boardsQuery.data.data.items ?? [] : [];
|
||||
const displayBoardId = boardId || boards[0]?.id || "";
|
||||
const isLoading = boardsQuery.isLoading || createAgentMutation.isPending;
|
||||
const errorMessage = error ?? boardsQuery.error?.message ?? null;
|
||||
|
||||
@@ -98,7 +98,7 @@ export default function AgentsPage() {
|
||||
const boardsQuery = useListBoardsApiV1BoardsGet<
|
||||
listBoardsApiV1BoardsGetResponse,
|
||||
ApiError
|
||||
>({
|
||||
>(undefined, {
|
||||
query: {
|
||||
enabled: Boolean(isSignedIn),
|
||||
refetchInterval: 30_000,
|
||||
@@ -109,7 +109,7 @@ export default function AgentsPage() {
|
||||
const agentsQuery = useListAgentsApiV1AgentsGet<
|
||||
listAgentsApiV1AgentsGetResponse,
|
||||
ApiError
|
||||
>({
|
||||
>(undefined, {
|
||||
query: {
|
||||
enabled: Boolean(isSignedIn),
|
||||
refetchInterval: 15_000,
|
||||
@@ -118,10 +118,15 @@ export default function AgentsPage() {
|
||||
});
|
||||
|
||||
const boards = useMemo(
|
||||
() => (boardsQuery.data?.status === 200 ? boardsQuery.data.data : []),
|
||||
() =>
|
||||
boardsQuery.data?.status === 200 ? boardsQuery.data.data.items ?? [] : [],
|
||||
[boardsQuery.data]
|
||||
);
|
||||
const agents = useMemo(() => agentsQuery.data?.data ?? [], [agentsQuery.data]);
|
||||
const agents = useMemo(
|
||||
() =>
|
||||
agentsQuery.data?.status === 200 ? agentsQuery.data.data.items ?? [] : [],
|
||||
[agentsQuery.data]
|
||||
);
|
||||
|
||||
const deleteMutation = useDeleteAgentApiV1AgentsAgentIdDelete<
|
||||
ApiError,
|
||||
@@ -133,10 +138,18 @@ export default function AgentsPage() {
|
||||
await queryClient.cancelQueries({ queryKey: agentsKey });
|
||||
const previous =
|
||||
queryClient.getQueryData<listAgentsApiV1AgentsGetResponse>(agentsKey);
|
||||
if (previous) {
|
||||
if (previous && previous.status === 200) {
|
||||
const nextItems = previous.data.items.filter(
|
||||
(agent) => agent.id !== agentId
|
||||
);
|
||||
const removedCount = previous.data.items.length - nextItems.length;
|
||||
queryClient.setQueryData<listAgentsApiV1AgentsGetResponse>(agentsKey, {
|
||||
...previous,
|
||||
data: previous.data.filter((agent) => agent.id !== agentId),
|
||||
data: {
|
||||
...previous.data,
|
||||
items: nextItems,
|
||||
total: Math.max(0, previous.data.total - removedCount),
|
||||
},
|
||||
});
|
||||
}
|
||||
return { previous };
|
||||
|
||||
Reference in New Issue
Block a user