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. 20
      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",
},
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: {
props: z.object({
value: z.array(z.record(z.unknown())).nullish(),

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

@ -26,6 +26,7 @@ const SIZE_ALIASES = {
lg: "large",
default: "middle",
};
const DEFAULT_DATETIME_FORMAT = "YYYY-MM-DD HH:mm:ss";
const EMPTY_MULTI_VALUE = [];
//[validateStatePath][校验状态路径并阻止原型链字段写入]
@ -718,6 +719,25 @@ const { registry, handlers, executeAction } = defineRegistry(catalog, {
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 }) => {
const [value, setValue] = useEditableProp(
props.value,

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

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

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

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

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

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

Loading…
Cancel
Save