Browse Source

merge: 合并代码

master
Senor-Liu 1 month ago
parent
commit
9873b942a8
  1. 10
      web/client/src/jsonRender/catalog.js
  2. 20
      web/client/src/jsonRender/registry.jsx
  3. 1
      web/client/src/jsonRender/render-ui.md
  4. 10
      web/client/src/sections/superAgent/container/index.jsx
  5. 30
      web/client/src/sections/superAgent/hooks/useSuperAgentStream.js

10
web/client/src/jsonRender/catalog.js

@ -242,6 +242,16 @@ const catalog = defineCatalog(schema, {
}), }),
description: "日期选择器,支持 $bindState 双向绑定到 value", description: "日期选择器,支持 $bindState 双向绑定到 value",
}, },
DateTimePicker: {
props: z.object({
value: z.string().nullish(),
placeholder: z.string().nullish(),
label: z.string().nullish(),
format: z.string().nullish(),
disabled: z.boolean().nullish(),
}),
description: "日期时间选择器,支持 $bindState 双向绑定到 value",
},
StructuredEditor: { StructuredEditor: {
props: z.object({ props: z.object({
value: z.array(z.record(z.unknown())).nullish(), value: z.array(z.record(z.unknown())).nullish(),

20
web/client/src/jsonRender/registry.jsx

@ -26,6 +26,7 @@ const SIZE_ALIASES = {
lg: "large", lg: "large",
default: "middle", default: "middle",
}; };
const DEFAULT_DATETIME_FORMAT = "YYYY-MM-DD HH:mm:ss";
const EMPTY_MULTI_VALUE = []; const EMPTY_MULTI_VALUE = [];
//[validateStatePath][校验状态路径并阻止原型链字段写入] //[validateStatePath][校验状态路径并阻止原型链字段写入]
@ -718,6 +719,25 @@ const { registry, handlers, executeAction } = defineRegistry(catalog, {
return renderFormControl(props.label, control); return renderFormControl(props.label, control);
}, },
DateTimePicker: ({ props, bindings }) => {
const [value, setValue] = useEditableProp(
props.value,
bindings?.value,
undefined
);
const control = (
<antd.DatePicker
value={value ? dayjs(value) : undefined}
onChange={(_, dateString) => setValue(dateString)}
placeholder={props.placeholder}
format={props.format || DEFAULT_DATETIME_FORMAT}
disabled={props.disabled}
showTime
/>
);
return renderFormControl(props.label, control);
},
StructuredEditor: ({ props, bindings }) => { StructuredEditor: ({ props, bindings }) => {
const [value, setValue] = useEditableProp( const [value, setValue] = useEditableProp(
props.value, props.value,

1
web/client/src/jsonRender/render-ui.md

@ -103,6 +103,7 @@
| **RadioGroup** | `value` | `options[{label,value}]`, `optionType` | | **RadioGroup** | `value` | `options[{label,value}]`, `optionType` |
| **NumberInput** | `value` | `min`, `max`, `step`, `precision`, `prefix`, `suffix` | | **NumberInput** | `value` | `min`, `max`, `step`, `precision`, `prefix`, `suffix` |
| **DatePicker** | `value` | `format`, `picker` (date/week/month/quarter/year) | | **DatePicker** | `value` | `format`, `picker` (date/week/month/quarter/year) |
| **DateTimePicker** | `value` | `format`(默认 `YYYY-MM-DD HH:mm:ss`) |
| **Slider** | `value` | `min`, `max`, `step`, `range` | | **Slider** | `value` | `min`, `max`, `step`, `range` |
#### 4.4 操作类 #### 4.4 操作类

10
web/client/src/sections/superAgent/container/index.jsx

@ -902,6 +902,14 @@ const SuperAgent = () => {
(taskStatus === "suspended" || runtimeSessionStatus === "suspended"); (taskStatus === "suspended" || runtimeSessionStatus === "suspended");
const hasPersistedRunningThread = const hasPersistedRunningThread =
hasPersistedActiveThread && !hasSuspendedRuntimeStatus && !isFailedTask; hasPersistedActiveThread && !hasSuspendedRuntimeStatus && !isFailedTask;
const hasTerminalStreamRunPhase = [
"completed",
"failed",
"cancelled",
"canceled",
"aborted",
"stopped",
].includes(stream.runPhase);
const isTerminalRuntimeSession = [ const isTerminalRuntimeSession = [
"failed", "failed",
"completed", "completed",
@ -914,6 +922,7 @@ const SuperAgent = () => {
runtimeTaskType === "artifact_build" || runtimeTaskType === "artifact_build" ||
(taskStage === TASK_STAGE.CONTENT && runtimeTaskTotal > 0); (taskStage === TASK_STAGE.CONTENT && runtimeTaskTotal > 0);
const isBodyGenerationRuntimeActive = const isBodyGenerationRuntimeActive =
!hasTerminalStreamRunPhase &&
runtimeBodyTaskShape && runtimeBodyTaskShape &&
[ [
"queued", "queued",
@ -990,6 +999,7 @@ const SuperAgent = () => {
["running", "awaiting_interrupt", "resuming"].includes(stream.runPhase) && ["running", "awaiting_interrupt", "resuming"].includes(stream.runPhase) &&
(!isTerminalTask || stream.isLocalRunActive); (!isTerminalTask || stream.isLocalRunActive);
const isStreamRunning = const isStreamRunning =
!hasTerminalStreamRunPhase &&
!isFailedTask && !isFailedTask &&
(hasPersistedRunningThread || (hasPersistedRunningThread ||
isBodyGenerationRuntimeActive || isBodyGenerationRuntimeActive ||

30
web/client/src/sections/superAgent/hooks/useSuperAgentStream.js

@ -1172,16 +1172,22 @@ const useSuperAgentStream = ({
"cancelled", "cancelled",
"canceled", "canceled",
].includes(runPhase); ].includes(runPhase);
const isPersistedExecutionActiveForUi =
isPersistedExecutionActive && !isTerminalRunPhase;
const effectiveRunPhase = const effectiveRunPhase =
isPersistedSuspended isPersistedSuspended
? "idle" ? "idle"
: shouldResetStaleWaitingPhase : shouldResetStaleWaitingPhase
? "running" ? "running"
: isPersistedExecutionActive && (runPhase === "idle" || isTerminalRunPhase) : isPersistedExecutionActive && runPhase === "idle"
? "running" ? "running"
: runPhase; : runPhase;
const effectiveIsLocalRunActive = isPersistedSuspended ? false : isLocalRunActive; const isPersistedThreadActiveForUi =
const effectiveIsBusinessRunning = isPersistedSuspended ? false : isBusinessRunning; isPersistedThreadActive && !isTerminalRunPhase;
const effectiveIsLocalRunActive =
isPersistedSuspended || isTerminalRunPhase ? false : isLocalRunActive;
const effectiveIsBusinessRunning =
isPersistedSuspended || isTerminalRunPhase ? false : isBusinessRunning;
const visibleInterrupts = useMemo(() => { const visibleInterrupts = useMemo(() => {
if (!isStreamProjectionReady && !isInterruptProjectionReady) return []; if (!isStreamProjectionReady && !isInterruptProjectionReady) return [];
@ -1230,13 +1236,15 @@ const useSuperAgentStream = ({
effectiveRunPhase effectiveRunPhase
); );
const effectiveIsLoading = const effectiveIsLoading =
isPersistedSuspended isTerminalRunPhase
? isRespondingInterrupt ? false
: stream.isLoading || : isPersistedSuspended
isRespondingInterrupt || ? isRespondingInterrupt
isBusinessRunning || : stream.isLoading ||
isRunPhaseActive || isRespondingInterrupt ||
isPersistedExecutionActive; isBusinessRunning ||
isRunPhaseActive ||
isPersistedExecutionActiveForUi;
return { return {
messages: streamMessages, messages: streamMessages,
@ -1250,7 +1258,7 @@ const useSuperAgentStream = ({
isLoading: effectiveIsLoading, isLoading: effectiveIsLoading,
isLocalRunActive: effectiveIsLocalRunActive, isLocalRunActive: effectiveIsLocalRunActive,
runPhase: effectiveRunPhase, runPhase: effectiveRunPhase,
isPersistedThreadActive, isPersistedThreadActive: isPersistedThreadActiveForUi,
currentInterruptId: currentInterruptId:
hydratedState && hydratedState &&
pendingHydratedInterrupts.length === 0 && pendingHydratedInterrupts.length === 0 &&

Loading…
Cancel
Save