feat: refactoring rendering

This commit is contained in:
2026-03-12 16:56:53 +01:00
parent 79e4586ed1
commit 084863909a
15 changed files with 327 additions and 196 deletions

View File

@@ -20,5 +20,6 @@ export function getAgentNodeDescriptor(): NodeTypeDescriptor {
.connectionLabel('prompt/context')
.withFullscreen()
.sourceRenderingLogic(agentRenderingLogic)
.outputMenuContent(() => null)
.build()
}

View File

@@ -1,10 +1,11 @@
/**
* Agent node rendering logic: when the Rendering node runs, it calls the agent API
* and updates the agent node's output. Update mode is manual (user clicks Run on the renderer).
* Agent node rendering logic: implements the "Resolve" step for agent sources.
* Calls the agent API and updates the agent node's output. Update mode is manual.
* See lib/graph/rendering.ts (IRenderingSource).
*/
import { getConfigContent } from '@/lib/graph/configTypes'
import type { ResolvedContentResult, SourceRenderingLogicContext } from '@/lib/graph/sourceRenderingLogic'
import { getConfigContent } from '@/lib/graph/rendering'
import type { ResolvedContentResult, SourceRenderingLogicContext } from '@/lib/graph/rendering'
import type { AiConnection } from '@/app/kosmos/KosmosContext'
function serializeNodeForContext(
@@ -69,7 +70,6 @@ function parseReasoningAndOutput(fullMarkdown: string): { reasoning?: string; ou
export const agentRenderingLogic = {
defaultUpdateMode: 'manual' as const,
getOutputMenuDescriptor: (): null => null,
getResolvedContent: async (context: SourceRenderingLogicContext): Promise<ResolvedContentResult> => {
const { nodes, sourceNodeId, setNodes, aiConnection, onStreamingStart, onStreamingChunk } = context
const sourceNode = nodes.find((n) => n.id === sourceNodeId)