Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
toyamarinyon committed Oct 24, 2024
1 parent ea2d031 commit 3939aff
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion app/(playground)/p/[agentId]/beta-proto/flow/server-action.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import {
webSearchItemStatus,
webSearchStatus,
} from "../web-search/types";
import { type FlowActionId, flowStatuses } from "./types";

type Source = Artifact | TextContent | StructuredData | WebSearchItem;
interface GatherInstructionSourcesInput {
Expand Down Expand Up @@ -99,7 +100,7 @@ async function gatherInstructionSources(input: GatherInstructionSourcesInput) {

interface RunActionInput {
agentId: AgentId;
nodeId: GiselleNodeId;
actionId: FlowActionId;
}
export async function runAction(input: RunActionInput) {
const agent = await db.query.agents.findFirst({
Expand All @@ -109,6 +110,9 @@ export async function runAction(input: RunActionInput) {
throw new Error(`Agent with id ${input.agentId} not found`);
}
const graph = agent.graphv2;
if (graph.flow?.status !== flowStatuses.running) {
throw new Error(`Agent with id ${input.agentId} is not running`);
}

const instructionConnector = graph.connectors.find(
(connector) =>
Expand Down Expand Up @@ -146,6 +150,11 @@ export async function runAction(input: RunActionInput) {
await webSearch();
break;
}
await db.update(agents).set({
graphv2: {
...graph,
},
});
}

async function generateText() {
Expand Down

0 comments on commit 3939aff

Please sign in to comment.