θΏ™ζ˜―indexlocζδΎ›ηš„ζœεŠ‘οΌŒδΈθ¦θΎ“ε…₯任何密码
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion frontend/src/pages/Admin/AgentBuilder/BlockList/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,6 @@ const BLOCK_INFO = {
description: "Process data using LLM instructions",
defaultConfig: {
instruction: "",
inputVariable: "",
resultVariable: "",
},
getSummary: (config) => config.instruction || "No instruction",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,6 @@ export default function LLMInstructionNode({
}) {
return (
<div className="space-y-4">
<div>
<label className="block text-sm font-medium text-theme-text-primary mb-2">
Input Variable
</label>
{renderVariableSelect(
config.inputVariable,
(value) => onConfigChange({ ...config, inputVariable: value }),
"Select input variable"
)}
</div>

<div>
<label className="block text-sm font-medium text-theme-text-primary mb-2">
Instruction
Expand Down
19 changes: 4 additions & 15 deletions server/utils/agentFlows/executors/llm-instruction.js
Original file line number Diff line number Diff line change
@@ -1,41 +1,30 @@
/**
* Execute an LLM instruction flow step
* @param {Object} config Flow step configuration
* @param {{introspect: Function, variables: Object, logger: Function}} context Execution context with introspect function
* @param {{introspect: Function, logger: Function}} context Execution context with introspect function
* @returns {Promise<string>} Processed result
*/
async function executeLLMInstruction(config, context) {
const { instruction, inputVariable, resultVariable } = config;
const { introspect, variables, logger, aibitat } = context;
const { instruction, resultVariable } = config;
const { introspect, logger, aibitat } = context;
logger(
`\x1b[43m[AgentFlowToolExecutor]\x1b[0m - executing LLM Instruction block`
);
introspect(`Processing data with LLM instruction...`);

if (!variables[inputVariable]) {
logger(`Input variable ${inputVariable} (${inputVariable}) not found`);
throw new Error(
`Input variable ${inputVariable} (${inputVariable}) not found`
);
}

try {
logger(
`Sending request to LLM (${aibitat.defaultProvider.provider}::${aibitat.defaultProvider.model})`
);
introspect(`Sending request to LLM...`);

// Ensure the input is a string since we are sending it to the LLM direct as a message
let input = variables[inputVariable];
let input = instruction;
if (typeof input === "object") input = JSON.stringify(input);
if (typeof input !== "string") input = String(input);

const provider = aibitat.getProviderForConfig(aibitat.defaultProvider);
const completion = await provider.complete([
{
role: "system",
content: `Follow these instructions carefully: ${instruction}`,
},
{
role: "user",
content: input,
Expand Down
4 changes: 0 additions & 4 deletions server/utils/agentFlows/flowTypes.js
Original file line number Diff line number Diff line change
Expand Up @@ -104,10 +104,6 @@ const FLOW_TYPES = {
type: "string",
description: "The instruction for the LLM to follow",
},
inputVariable: {
type: "string",
description: "Variable containing the input data to process",
},
resultVariable: {
type: "string",
description: "Variable to store the processed result",
Expand Down