feat(控制台): 去掉待处理中心,问题回到发生处
- 侧栏与命令面板没有「待处理」;/console/inbox?kind= 按问题类型跳到整理记录「需要处理」、下载面板、运行状态或订阅 - 整理记录加「需要处理」筛选,行内写原因与推荐动作(指定作品 / 重新整理 / 让智能体识别 / 替换·保留两者·跳过 / 忽略), 详情页同样可处理;处理按钮从原待处理页抽成 components/decisions/decision-actions.tsx 复用 - 铃铛只放等你批准的智能体操作与系统健康;首页「要我处理」与运行状态「需要关注」放汇总计数,运行状态加智能体用量 - 设置 → 智能体:预算卡改为「用量与限制」(只剩单次工具调用与时长,附花费统计),自动调查卡加「整理识别不到作品时叫智能体识别」 - 集数待确认的原因显示在作品页集数映射(可确认建议规则 / 智能体建议)与订阅详情;未识别资源在媒体库「未识别」里直接选候选或指定 - 下载、站点、任务里指向待处理的链接改到对应页面 Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Cxwgnn2pbzQ7rXv3rq7fei
This commit is contained in:
1 parent
1c1a954703
commit
fa76d7563c
36 files changed
+1209
-921
No files matched your search
@@ -0,0 +1,37 @@
|
||||
import { useQuery, useQueryClient } from "@tanstack/react-query";
|
||||
import { AgentSpend, AttentionSummary } from "@umt/contracts";
|
||||
import { useRef } from "react";
|
||||
import { useSse } from "~/lib/sse.ts";
|
||||
import { apiParsed } from "./parse.ts";
|
||||
|
||||
// 需要关注的汇总(2026-10-06 去掉待处理中心后):铃铛只放等你批准的智能体操作与系统健康,
|
||||
// 首页 / 运行状态放汇总计数(整理需要处理的条数等),点进去到对应页面。
|
||||
|
||||
export const attentionKeys = { all: ["attention"] as const, spend: ["attention", "agent-spend"] as const };
|
||||
|
||||
/** 事项、整理记录变化时(节流)刷新;另有 60 秒兜底轮询 */
|
||||
export function useAttention() {
|
||||
const qc = useQueryClient();
|
||||
const timer = useRef<ReturnType<typeof setTimeout> | null>(null);
|
||||
useSse(["decision.created", "decision.updated", "organization.changed"], () => {
|
||||
if (timer.current) return;
|
||||
timer.current = setTimeout(() => {
|
||||
timer.current = null;
|
||||
void qc.invalidateQueries({ queryKey: attentionKeys.all });
|
||||
}, 800);
|
||||
});
|
||||
return useQuery({
|
||||
queryKey: attentionKeys.all,
|
||||
queryFn: ({ signal }) => apiParsed(AttentionSummary, "/api/v1/attention", { signal }),
|
||||
refetchInterval: 60_000,
|
||||
});
|
||||
}
|
||||
|
||||
/** 智能体用量:今天与最近 7 天按会话类型的次数、token 与费用(不设上限,只展示) */
|
||||
export function useAgentSpend() {
|
||||
return useQuery({
|
||||
queryKey: attentionKeys.spend,
|
||||
queryFn: ({ signal }) => apiParsed(AgentSpend, "/api/v1/agent/usage", { signal }),
|
||||
refetchInterval: 5 * 60_000,
|
||||
});
|
||||
}
|
||||
@@ -4,6 +4,7 @@ import {
|
||||
cursorPage,
|
||||
LibraryItem,
|
||||
LibraryRoot,
|
||||
OrganizationAgentIdentifyResult,
|
||||
type OrganizationDeleteRequest,
|
||||
OrganizationDeleteResult,
|
||||
OrganizationStats,
|
||||
@@ -31,6 +32,8 @@ export type RecordFilters = {
|
||||
/** ISO 时间:只看之后创建的 */
|
||||
since?: string;
|
||||
organizeOnly?: boolean;
|
||||
/** 只看需要处理的(失败 / 部分完成没被取代、没被忽略,或有未关闭的事项) */
|
||||
attention?: boolean;
|
||||
};
|
||||
|
||||
export const recordKeys = {
|
||||
@@ -51,6 +54,33 @@ export function useRecordStats(f: Omit<RecordFilters, "status">) {
|
||||
});
|
||||
}
|
||||
|
||||
/** 需要处理的记录:忽略(不再算需要处理,关联事项一并关闭) */
|
||||
export function useDismissRecordAttention() {
|
||||
const qc = useQueryClient();
|
||||
return useMutation({
|
||||
mutationFn: (id: string) =>
|
||||
apiMutate(`/api/v1/organization-records/${id}/dismiss-attention`, { body: {} }).then((d) =>
|
||||
PublicOrganizationRecord.parse(d),
|
||||
),
|
||||
onSuccess: () => {
|
||||
void qc.invalidateQueries({ queryKey: recordKeys.all });
|
||||
void qc.invalidateQueries({ queryKey: ["attention"] });
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
/** 没识别出作品的记录:让智能体识别(认出来自动重新整理) */
|
||||
export function useAgentIdentifyRecord() {
|
||||
const qc = useQueryClient();
|
||||
return useMutation({
|
||||
mutationFn: (id: string) =>
|
||||
apiMutate(`/api/v1/organization-records/${id}/agent-identify`, { body: {} }).then((d) =>
|
||||
OrganizationAgentIdentifyResult.parse(d),
|
||||
),
|
||||
onSuccess: () => void qc.invalidateQueries({ queryKey: recordKeys.all }),
|
||||
});
|
||||
}
|
||||
|
||||
/** HIS-1:删除整理记录(dryRun 只核对会删什么) */
|
||||
export function useDeleteRecords() {
|
||||
const qc = useQueryClient();
|
||||
|
||||
Reference in new issue
Block a user