mirror of
https://github.com/RuoJi6/ARTEX.git
synced 2026-11-12 05:33:50 +08:00
fix: separate btw fallback copy and keep synthetic snapshot overridable
This commit is contained in:
1 parent
eabdf85558
commit
62dca14821
9 files changed
+189
-20
No files matched your search
@@ -760,7 +760,13 @@ function ChatView({
|
||||
}
|
||||
|
||||
return (
|
||||
<SideQuestionWorkspace side={side} label={agent?.name ?? conv.agent_key} composerLayout="inline">
|
||||
<SideQuestionWorkspace
|
||||
side={side}
|
||||
label={agent?.name ?? conv.agent_key}
|
||||
composerLayout="inline"
|
||||
noSnapshotHint="主 Agent 首次运行后即可提问"
|
||||
emptyDescription="根据当前 Agent 的上下文回答,主任务继续运行。"
|
||||
>
|
||||
{/* header: which agent + live + token meta */}
|
||||
<div className="flex min-w-0 flex-wrap items-center gap-2 border-b px-4 py-2.5">
|
||||
<Bot className="text-muted-foreground size-4 shrink-0" />
|
||||
|
||||
@@ -1757,6 +1757,15 @@ export function SessionsTab({ taskId, requestedSession = "" }: { taskId: string;
|
||||
<SideQuestionWorkspace
|
||||
side={side}
|
||||
label={active.role === "worker" ? `Worker #${active.intent_id} · ${activeDisplayTitle}` : activeDisplayTitle}
|
||||
noSnapshotHint={
|
||||
isMain ? "有任务描述、Planner/Worker 结果或发现记录后即可提问" : "对应 Worker 首次运行后即可提问"
|
||||
}
|
||||
emptyDescription={
|
||||
isMain
|
||||
? "根据当前任务上下文回答,主任务继续运行;暂停或尚未运行主 Agent 也可以提问。"
|
||||
: "根据当前 Worker 的上下文回答,旁路问答不会执行工具。"
|
||||
}
|
||||
placeholder={isMain ? "询问当前任务上下文…" : "询问当前 Worker 上下文…"}
|
||||
>
|
||||
<div className="flex min-h-0 flex-1 min-w-0 flex-col overflow-hidden rounded-lg border bg-card">
|
||||
<div className="flex min-w-0 flex-wrap items-center gap-x-2 gap-y-1 border-b px-3 py-2 sm:px-4 sm:py-2.5">
|
||||
|
||||
@@ -459,6 +459,8 @@ export function ApprovalDetail({
|
||||
label={`审批 #${row.id} · ${row.tool_name}`}
|
||||
composerLayout="stacked"
|
||||
placeholder="询问此审批中的脚本或审查理由…"
|
||||
noSnapshotHint="当前审批材料准备好后即可提问"
|
||||
emptyDescription="根据当前审批材料回答,旁路问答不会执行脚本。"
|
||||
suggestions={[
|
||||
"此脚本的作用是什么?",
|
||||
"脚本会修改哪些文件或数据?",
|
||||
|
||||
@@ -53,12 +53,16 @@ function SidePanel({
|
||||
composerLayout,
|
||||
suggestions,
|
||||
placeholder,
|
||||
noSnapshotHint,
|
||||
emptyDescription,
|
||||
}: {
|
||||
side: SideQuestions;
|
||||
label: string;
|
||||
composerLayout: ComposerLayout;
|
||||
suggestions?: string[];
|
||||
placeholder?: string;
|
||||
noSnapshotHint?: string;
|
||||
emptyDescription?: string;
|
||||
}) {
|
||||
const inlineComposer = composerLayout === "inline";
|
||||
const [confirm, setConfirm] = useState(false);
|
||||
@@ -93,13 +97,13 @@ function SidePanel({
|
||||
</Button>
|
||||
</div>
|
||||
<div className="border-b px-3 py-2 text-muted-foreground text-xs">
|
||||
{side.snapshot ? (
|
||||
{side.snapshot?.available ? (
|
||||
<>
|
||||
<p>{side.snapshot.model.model}</p>
|
||||
<p>上下文更新于 {new Date(side.snapshot.captured_at).toLocaleString()}</p>
|
||||
</>
|
||||
) : (
|
||||
"有任务描述、Planner/Worker 结果或发现记录后即可提问"
|
||||
noSnapshotHint ?? "主 Agent 首次运行后即可提问"
|
||||
)}
|
||||
</div>
|
||||
<div
|
||||
@@ -120,7 +124,7 @@ function SidePanel({
|
||||
<Empty>
|
||||
<EmptyHeader>
|
||||
<EmptyTitle>随时问一个问题</EmptyTitle>
|
||||
<EmptyDescription>根据当前任务上下文回答,主任务继续运行;暂停或尚未运行主 Agent 也可以提问。</EmptyDescription>
|
||||
<EmptyDescription>{emptyDescription ?? "根据当前 Agent 的上下文回答,主任务继续运行。"}</EmptyDescription>
|
||||
</EmptyHeader>
|
||||
</Empty>
|
||||
)}
|
||||
@@ -158,9 +162,9 @@ function SidePanel({
|
||||
</div>
|
||||
</div>
|
||||
<div className="shrink-0 border-t p-3">
|
||||
{(side.error || side.snapshot?.reason) && (
|
||||
{(side.error || side.snapshotError || side.snapshot?.reason) && (
|
||||
<Alert variant="destructive" className="mb-2">
|
||||
<AlertDescription>{side.error || side.snapshot?.reason}</AlertDescription>
|
||||
<AlertDescription>{side.error || side.snapshotError || side.snapshot?.reason}</AlertDescription>
|
||||
</Alert>
|
||||
)}
|
||||
<InputGroup className={inlineComposer ? "min-h-10" : "min-h-9"}>
|
||||
@@ -252,6 +256,8 @@ export function SideQuestionWorkspace({
|
||||
composerLayout = "stacked",
|
||||
suggestions,
|
||||
placeholder,
|
||||
noSnapshotHint,
|
||||
emptyDescription,
|
||||
className,
|
||||
mainClassName,
|
||||
}: {
|
||||
@@ -262,6 +268,8 @@ export function SideQuestionWorkspace({
|
||||
composerLayout?: ComposerLayout;
|
||||
suggestions?: string[];
|
||||
placeholder?: string;
|
||||
noSnapshotHint?: string;
|
||||
emptyDescription?: string;
|
||||
className?: string;
|
||||
mainClassName?: string;
|
||||
}) {
|
||||
@@ -281,6 +289,8 @@ export function SideQuestionWorkspace({
|
||||
composerLayout={composerLayout}
|
||||
suggestions={suggestions}
|
||||
placeholder={placeholder}
|
||||
noSnapshotHint={noSnapshotHint}
|
||||
emptyDescription={emptyDescription}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
@@ -302,6 +312,8 @@ export function SideQuestionWorkspace({
|
||||
composerLayout={composerLayout}
|
||||
suggestions={suggestions}
|
||||
placeholder={placeholder}
|
||||
noSnapshotHint={noSnapshotHint}
|
||||
emptyDescription={emptyDescription}
|
||||
/>
|
||||
</ResizablePanel>
|
||||
</ResizablePanelGroup>
|
||||
@@ -320,6 +332,8 @@ export function SideQuestionWorkspace({
|
||||
composerLayout={composerLayout}
|
||||
suggestions={suggestions}
|
||||
placeholder={placeholder}
|
||||
noSnapshotHint={noSnapshotHint}
|
||||
emptyDescription={emptyDescription}
|
||||
/>
|
||||
</DrawerContent>
|
||||
</Drawer>
|
||||
|
||||
@@ -28,6 +28,7 @@ export function useSideQuestions(parent: string | null) {
|
||||
const [open, setOpen] = useState(false);
|
||||
const [items, setItems] = useState<SideExchange[]>([]);
|
||||
const [snapshot, setSnapshot] = useState<SideHistory["snapshot"]>(null);
|
||||
const [snapshotError, setSnapshotError] = useState("");
|
||||
const [draft, setDraft] = useState("");
|
||||
const [busy, setBusy] = useState(false);
|
||||
const [loading, setLoading] = useState(false);
|
||||
@@ -64,6 +65,7 @@ export function useSideQuestions(parent: string | null) {
|
||||
setItems((old) => merge(old, data.items));
|
||||
restoreFailedDraft(data.items);
|
||||
setSnapshot(data.snapshot);
|
||||
setSnapshotError(data.snapshot_error ?? "");
|
||||
setLoadError("");
|
||||
if (before || !cursor.current) {
|
||||
cursor.current = data.next_cursor;
|
||||
@@ -81,6 +83,7 @@ export function useSideQuestions(parent: string | null) {
|
||||
setStateParent(parent);
|
||||
setItems([]);
|
||||
setSnapshot(null);
|
||||
setSnapshotError("");
|
||||
setNextCursor(0);
|
||||
setDraft("");
|
||||
setError("");
|
||||
@@ -103,6 +106,7 @@ export function useSideQuestions(parent: string | null) {
|
||||
if (version !== epoch.current) return;
|
||||
setItems((old) => merge(old, data.items));
|
||||
setSnapshot(data.snapshot);
|
||||
setSnapshotError(data.snapshot_error ?? "");
|
||||
setNextCursor(data.next_cursor);
|
||||
cursor.current = data.next_cursor;
|
||||
})
|
||||
@@ -231,6 +235,7 @@ export function useSideQuestions(parent: string | null) {
|
||||
setOpen,
|
||||
items: current ? items : [],
|
||||
snapshot: current ? snapshot : null,
|
||||
snapshotError: current ? snapshotError : "",
|
||||
draft: current ? draft : "",
|
||||
setDraft,
|
||||
busy: current && busy,
|
||||
|
||||
@@ -34,6 +34,7 @@ export interface SideHistory {
|
||||
current: SideExchange | null;
|
||||
next_cursor: number;
|
||||
snapshot: { captured_at: string; model: SideModel; available: boolean; reason: string } | null;
|
||||
snapshot_error?: string;
|
||||
}
|
||||
|
||||
async function request<T>(path: string, method = "GET", body?: unknown): Promise<T> {
|
||||
@@ -61,6 +62,7 @@ export const sideAPI = {
|
||||
current: data?.current ?? null,
|
||||
next_cursor: Number(data?.next_cursor) || 0,
|
||||
snapshot: data?.snapshot ?? null,
|
||||
snapshot_error: data?.snapshot_error ?? "",
|
||||
} satisfies SideHistory;
|
||||
},
|
||||
ask: (parent: string, question: string, client_request_id: string) =>
|
||||
|
||||
Reference in new issue
Block a user