mirror of
https://github.com/Nikhil-Doye/workflow-builder.git
synced 2026-07-22 02:01:56 +02:00
Remove obsolete workflow and test result files
- Deleted multiple workflow JSON files and a test results JSON file to clean up the project structure and remove unused resources. - This includes the removal of firecrawl_workflow_test.json, Workflow_2.json, Workflow_1760486472779.json, and workflow_test_results_1.json. - The deletion helps streamline the project and focuses on maintaining only relevant workflows and test results.
This commit is contained in:
@@ -1,95 +0,0 @@
|
||||
{
|
||||
"id": "1b3ef20c-a215-4a5f-9335-8af8f38ca217",
|
||||
"name": "Workflow 1760486472779",
|
||||
"nodes": [
|
||||
{
|
||||
"id": "0a7533bc-93ce-4518-8a6d-c2464a4dacb7",
|
||||
"type": "dataInput",
|
||||
"position": {
|
||||
"x": 312,
|
||||
"y": 123
|
||||
},
|
||||
"data": {
|
||||
"id": "059759e0-b679-4548-8a35-2731e9c73ace",
|
||||
"type": "dataInput",
|
||||
"label": "Data input 1 node",
|
||||
"status": "success",
|
||||
"config": {
|
||||
"dataType": "text",
|
||||
"defaultValue": "Hello, World!"
|
||||
},
|
||||
"inputs": [],
|
||||
"outputs": [
|
||||
{
|
||||
"output": "Processed by dataInput node"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "e079bfb8-3072-498b-9496-4b8b0e9294c4",
|
||||
"type": "llmTask",
|
||||
"position": {
|
||||
"x": 328.7735002880589,
|
||||
"y": 152.50072375126544
|
||||
},
|
||||
"data": {
|
||||
"id": "b66b2368-90fb-4c1d-b05d-e484db4e951a",
|
||||
"type": "llmTask",
|
||||
"label": "GPT-3.5 Turbo Node",
|
||||
"status": "success",
|
||||
"config": {
|
||||
"model": "gpt-3.5-turbo",
|
||||
"prompt": "Analyze the following text and provide insights: {{input}}",
|
||||
"temperature": 0.7
|
||||
},
|
||||
"inputs": [],
|
||||
"outputs": [
|
||||
{
|
||||
"output": "Processed by llmTask node"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "30168ae1-7488-4e42-8f5b-e76cfe57d8d8",
|
||||
"type": "dataOutput",
|
||||
"position": {
|
||||
"x": 281.69657941317894,
|
||||
"y": 319.4905562885754
|
||||
},
|
||||
"data": {
|
||||
"id": "033a40f0-a1f9-4666-ba2a-4c594a6d37de",
|
||||
"type": "dataOutput",
|
||||
"label": "Output Node",
|
||||
"status": "success",
|
||||
"config": {
|
||||
"format": "text",
|
||||
"filename": "analysis.txt"
|
||||
},
|
||||
"inputs": [],
|
||||
"outputs": [
|
||||
{
|
||||
"output": "Processed by dataOutput node"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
],
|
||||
"edges": [
|
||||
{
|
||||
"id": "b104d78f-8b80-473e-a632-4dab8dcceb64",
|
||||
"source": "0a7533bc-93ce-4518-8a6d-c2464a4dacb7",
|
||||
"target": "e079bfb8-3072-498b-9496-4b8b0e9294c4"
|
||||
},
|
||||
{
|
||||
"id": "b576ba30-9423-41d3-be4e-de6511137d53",
|
||||
"source": "e079bfb8-3072-498b-9496-4b8b0e9294c4",
|
||||
"target": "30168ae1-7488-4e42-8f5b-e76cfe57d8d8"
|
||||
}
|
||||
],
|
||||
"createdAt": "2025-10-15T00:01:12.780Z",
|
||||
"updatedAt": "2025-10-15T00:04:26.466Z",
|
||||
"exportedAt": "2025-10-15T00:06:35.402Z",
|
||||
"version": "1.0.0"
|
||||
}
|
||||
@@ -1,99 +0,0 @@
|
||||
{
|
||||
"id": "c69ca19c-4174-4ec5-b2f8-6f941d1cd796",
|
||||
"name": "Workflow 1760487469928",
|
||||
"nodes": [
|
||||
{
|
||||
"id": "57861f51-a1ed-4efe-8646-3564de2cac10",
|
||||
"type": "dataInput",
|
||||
"position": {
|
||||
"x": 372,
|
||||
"y": 87
|
||||
},
|
||||
"data": {
|
||||
"id": "960e2857-f602-46a9-af43-ec932d77153e",
|
||||
"type": "dataInput",
|
||||
"label": "dataInput Node",
|
||||
"status": "success",
|
||||
"config": {
|
||||
"defaultValue": "Hello World!",
|
||||
"dataType": "text"
|
||||
},
|
||||
"inputs": [],
|
||||
"outputs": [
|
||||
{
|
||||
"output": "What is today's date?"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "d11a7455-c591-4606-9e7f-11b002e8c20d",
|
||||
"type": "llmTask",
|
||||
"position": {
|
||||
"x": 436.75,
|
||||
"y": 118.75
|
||||
},
|
||||
"data": {
|
||||
"id": "d52f145f-1fa6-415c-aca7-ca11895f3991",
|
||||
"type": "llmTask",
|
||||
"label": "llmTask Node",
|
||||
"status": "success",
|
||||
"config": {
|
||||
"model": "gpt-3.5-turbo",
|
||||
"temperature": 0.7,
|
||||
"prompt": "Analyze the following text and provide insights: {{input}}"
|
||||
},
|
||||
"inputs": [],
|
||||
"outputs": [
|
||||
{
|
||||
"output": "LLM Response (gpt-3.5-turbo): Analyze the following text and provide insights: What is today's date?",
|
||||
"prompt": "Analyze the following text and provide insights: What is today's date?",
|
||||
"model": "gpt-3.5-turbo"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "40d139ed-8290-4d14-8c1a-940c2927105a",
|
||||
"type": "dataOutput",
|
||||
"position": {
|
||||
"x": 504.5575564762356,
|
||||
"y": 309.2556953849361
|
||||
},
|
||||
"data": {
|
||||
"id": "9b38825f-ae74-491f-b088-36969d87385d",
|
||||
"type": "dataOutput",
|
||||
"label": "dataOutput Node",
|
||||
"status": "success",
|
||||
"config": {
|
||||
"format": "text",
|
||||
"filename": "analysis.txt"
|
||||
},
|
||||
"inputs": [],
|
||||
"outputs": [
|
||||
{
|
||||
"output": "What is today's date?",
|
||||
"format": "text",
|
||||
"filename": "analysis.txt"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
],
|
||||
"edges": [
|
||||
{
|
||||
"id": "0e841dba-cdb5-4738-8311-2ec1c426c0a5",
|
||||
"source": "57861f51-a1ed-4efe-8646-3564de2cac10",
|
||||
"target": "d11a7455-c591-4606-9e7f-11b002e8c20d"
|
||||
},
|
||||
{
|
||||
"id": "5447100b-4949-406f-a3e8-9f8dd336eeef",
|
||||
"source": "d11a7455-c591-4606-9e7f-11b002e8c20d",
|
||||
"target": "40d139ed-8290-4d14-8c1a-940c2927105a"
|
||||
}
|
||||
],
|
||||
"createdAt": "2025-10-15T00:17:49.928Z",
|
||||
"updatedAt": "2025-10-15T00:20:17.205Z",
|
||||
"exportedAt": "2025-10-15T00:22:18.078Z",
|
||||
"version": "1.0.0"
|
||||
}
|
||||
@@ -1,141 +0,0 @@
|
||||
{
|
||||
"id": "b2020ae4-e010-49af-8673-36c128438ec4",
|
||||
"name": "Workflow 1760727761212",
|
||||
"nodes": [
|
||||
{
|
||||
"id": "4747e8b4-c1cb-4c56-9ca8-cab73543c909",
|
||||
"type": "dataInput",
|
||||
"position": {
|
||||
"x": 353,
|
||||
"y": 63
|
||||
},
|
||||
"data": {
|
||||
"id": "5fa3cdfe-9c5a-4b78-95d8-dc1e74b627bb",
|
||||
"type": "dataInput",
|
||||
"label": "dataInput Node",
|
||||
"status": "success",
|
||||
"config": {
|
||||
"dataType": "url",
|
||||
"defaultValue": "https://www.example.com"
|
||||
},
|
||||
"inputs": [],
|
||||
"outputs": [
|
||||
{
|
||||
"output": "https://vesterai.com/"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "3d26cd62-8f6b-449e-beaa-864683d5ccb4",
|
||||
"type": "webScraping",
|
||||
"position": {
|
||||
"x": 425.8264547480898,
|
||||
"y": 123.15899777101305
|
||||
},
|
||||
"data": {
|
||||
"id": "38dcf0c1-a1e8-432b-ac38-479cc2e60150",
|
||||
"type": "webScraping",
|
||||
"label": "webScraping Node",
|
||||
"status": "success",
|
||||
"config": {
|
||||
"formats": [
|
||||
"text",
|
||||
"html"
|
||||
],
|
||||
"url": "{{input-1.output}}",
|
||||
"onlyMainContent": false
|
||||
},
|
||||
"inputs": [],
|
||||
"outputs": [
|
||||
{
|
||||
"output": "Error scraping https://vesterai.com/: Bad Request. Please check your Firecrawl API key and try again.",
|
||||
"url": "https://vesterai.com/",
|
||||
"error": "Bad Request"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "d33f8686-55c4-44e0-86a9-45290d6f6d2f",
|
||||
"type": "llmTask",
|
||||
"position": {
|
||||
"x": 614.6608564428151,
|
||||
"y": 226.6299028092187
|
||||
},
|
||||
"data": {
|
||||
"id": "7666152a-79d7-44e3-b5c5-c312b9adf82d",
|
||||
"type": "llmTask",
|
||||
"label": "llmTask Node",
|
||||
"status": "success",
|
||||
"config": {
|
||||
"prompt": "Summarize: {{scraper-1.output}}",
|
||||
"model": "deepseek-chat",
|
||||
"temperature": 0.7
|
||||
},
|
||||
"inputs": [],
|
||||
"outputs": [
|
||||
{
|
||||
"output": "Based on the error message, here is a summary:\n\nAn attempt to automatically extract data (scrape) from the website `vesterai.com` failed because the request was invalid (a \"Bad Request\" error).\n\nThe most likely cause is an issue with the **Firecrawl API key**, such as:\n* The key is missing, incorrect, or invalid.\n* The key has expired.\n* The associated account lacks the necessary permissions or credits.\n\n**The suggested solution is to verify that the Firecrawl API key is correct and properly configured, then try the operation again.**",
|
||||
"prompt": "Summarize: Error scraping https://vesterai.com/: Bad Request. Please check your Firecrawl API key and try again.",
|
||||
"model": "deepseek-chat",
|
||||
"temperature": 0.7,
|
||||
"maxTokens": 1000,
|
||||
"usage": {
|
||||
"promptTokens": 30,
|
||||
"completionTokens": 119,
|
||||
"totalTokens": 149
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "b6fcec2c-e976-4aa6-bca1-adbb61cfc9b9",
|
||||
"type": "dataOutput",
|
||||
"position": {
|
||||
"x": 712.9582162291103,
|
||||
"y": 265.4314921985458
|
||||
},
|
||||
"data": {
|
||||
"id": "94e9b104-f049-40c9-8433-b153ab32065c",
|
||||
"type": "dataOutput",
|
||||
"label": "dataOutput Node",
|
||||
"status": "success",
|
||||
"config": {
|
||||
"format": "json",
|
||||
"filename": "analysis.json"
|
||||
},
|
||||
"inputs": [],
|
||||
"outputs": [
|
||||
{
|
||||
"output": "{\n \"data\": \"Based on the error message, here is a summary:\\n\\nAn attempt to automatically extract data (scrape) from the website `vesterai.com` failed because the request was invalid (a \\\"Bad Request\\\" error).\\n\\nThe most likely cause is an issue with the **Firecrawl API key**, such as:\\n* The key is missing, incorrect, or invalid.\\n* The key has expired.\\n* The associated account lacks the necessary permissions or credits.\\n\\n**The suggested solution is to verify that the Firecrawl API key is correct and properly configured, then try the operation again.**\",\n \"timestamp\": \"2025-10-17T19:19:51.704Z\"\n}",
|
||||
"format": "json",
|
||||
"filename": "analysis.json"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
],
|
||||
"edges": [
|
||||
{
|
||||
"id": "94b044ce-0f92-4f47-981e-d56c348c015b",
|
||||
"source": "4747e8b4-c1cb-4c56-9ca8-cab73543c909",
|
||||
"target": "3d26cd62-8f6b-449e-beaa-864683d5ccb4"
|
||||
},
|
||||
{
|
||||
"id": "1f522c38-18a8-4497-ad35-034e9147c255",
|
||||
"source": "3d26cd62-8f6b-449e-beaa-864683d5ccb4",
|
||||
"target": "d33f8686-55c4-44e0-86a9-45290d6f6d2f"
|
||||
},
|
||||
{
|
||||
"id": "e3c4d985-dcdd-4486-a3ee-325013816d7f",
|
||||
"source": "d33f8686-55c4-44e0-86a9-45290d6f6d2f",
|
||||
"target": "b6fcec2c-e976-4aa6-bca1-adbb61cfc9b9"
|
||||
}
|
||||
],
|
||||
"createdAt": "2025-10-17T19:02:41.212Z",
|
||||
"updatedAt": "2025-10-17T19:19:51.704Z",
|
||||
"exportedAt": "2025-10-17T19:20:30.000Z",
|
||||
"version": "1.0.0"
|
||||
}
|
||||
@@ -1,416 +0,0 @@
|
||||
import {
|
||||
IntentClassification,
|
||||
EntityExtraction,
|
||||
ComplexityAnalysis,
|
||||
} from "../types";
|
||||
|
||||
// Pattern matching for different intent types
|
||||
export const intentPatterns = {
|
||||
WEB_SCRAPING: [
|
||||
/scrape/i,
|
||||
/extract.*website/i,
|
||||
/get.*from.*url/i,
|
||||
/web.*content/i,
|
||||
/html.*content/i,
|
||||
/crawl/i,
|
||||
/fetch.*page/i,
|
||||
/download.*content/i,
|
||||
],
|
||||
AI_ANALYSIS: [
|
||||
/analyze/i,
|
||||
/summarize/i,
|
||||
/classify/i,
|
||||
/sentiment/i,
|
||||
/ai.*process/i,
|
||||
/llm/i,
|
||||
/gpt/i,
|
||||
/artificial.*intelligence/i,
|
||||
/machine.*learning/i,
|
||||
/nlp/i,
|
||||
/natural.*language/i,
|
||||
],
|
||||
DATA_PROCESSING: [
|
||||
/convert/i,
|
||||
/transform/i,
|
||||
/format/i,
|
||||
/parse/i,
|
||||
/json/i,
|
||||
/csv/i,
|
||||
/structure/i,
|
||||
/process.*data/i,
|
||||
/clean.*data/i,
|
||||
/normalize/i,
|
||||
/standardize/i,
|
||||
],
|
||||
SEARCH_AND_RETRIEVAL: [
|
||||
/search/i,
|
||||
/find.*similar/i,
|
||||
/embedding/i,
|
||||
/vector.*search/i,
|
||||
/similarity/i,
|
||||
/match/i,
|
||||
/retrieve/i,
|
||||
/lookup/i,
|
||||
/query/i,
|
||||
],
|
||||
CONTENT_GENERATION: [
|
||||
/generate/i,
|
||||
/create.*content/i,
|
||||
/write/i,
|
||||
/produce/i,
|
||||
/synthesize/i,
|
||||
/compose/i,
|
||||
/draft/i,
|
||||
/author/i,
|
||||
/craft/i,
|
||||
],
|
||||
};
|
||||
|
||||
// Mixed intent patterns
|
||||
export const mixedIntentPatterns = {
|
||||
// Sequential operations
|
||||
sequential: [
|
||||
/first.*then/i,
|
||||
/scrape.*and.*analyze/i,
|
||||
/extract.*then.*process/i,
|
||||
/get.*data.*and.*transform/i,
|
||||
/step.*by.*step/i,
|
||||
/after.*that/i,
|
||||
/then.*also/i,
|
||||
],
|
||||
|
||||
// Parallel operations
|
||||
parallel: [
|
||||
/both.*and/i,
|
||||
/simultaneously/i,
|
||||
/at.*same.*time/i,
|
||||
/while.*also/i,
|
||||
/meanwhile/i,
|
||||
/concurrently/i,
|
||||
],
|
||||
|
||||
// Conditional operations
|
||||
conditional: [
|
||||
/if.*then/i,
|
||||
/depending.*on/i,
|
||||
/based.*on.*result/i,
|
||||
/when.*also/i,
|
||||
/unless/i,
|
||||
/provided.*that/i,
|
||||
],
|
||||
|
||||
// Complex workflows
|
||||
complex: [
|
||||
/pipeline/i,
|
||||
/workflow/i,
|
||||
/process.*through/i,
|
||||
/multiple.*steps/i,
|
||||
/end.*to.*end/i,
|
||||
/automation/i,
|
||||
/orchestration/i,
|
||||
],
|
||||
};
|
||||
|
||||
// Complexity indicators
|
||||
export const complexityIndicators = {
|
||||
// Temporal relationships
|
||||
temporal: {
|
||||
sequential: /first.*then|step.*by.*step|after.*that/i,
|
||||
parallel: /simultaneously|at.*same.*time|while.*also/i,
|
||||
conditional: /if.*then|depending.*on|based.*on/i,
|
||||
},
|
||||
|
||||
// Data flow patterns
|
||||
dataFlow: {
|
||||
linear: /pass.*to|send.*to|forward.*to/i,
|
||||
branching: /split.*into|divide.*by|separate/i,
|
||||
merging: /combine.*with|merge.*into|join.*together/i,
|
||||
},
|
||||
|
||||
// Processing patterns
|
||||
processing: {
|
||||
batch: /batch.*process|all.*at.*once/i,
|
||||
streaming: /real.*time|live.*data|continuous/i,
|
||||
iterative: /repeat.*until|loop.*through|iterate/i,
|
||||
},
|
||||
};
|
||||
|
||||
/**
|
||||
* Quick intent recognition using pattern matching
|
||||
*/
|
||||
export function quickIntentRecognition(userInput: string): string | null {
|
||||
for (const [intent, patterns] of Object.entries(intentPatterns)) {
|
||||
if (patterns.some((pattern) => pattern.test(userInput))) {
|
||||
return intent;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Classify intent with confidence scoring
|
||||
*/
|
||||
export function classifyIntent(userInput: string): IntentClassification {
|
||||
const detectedIntents: string[] = [];
|
||||
const confidenceScores: Record<string, number> = {};
|
||||
|
||||
// Score each intent type
|
||||
Object.entries(intentPatterns).forEach(([intent, patterns]) => {
|
||||
let score = 0;
|
||||
patterns.forEach((pattern) => {
|
||||
const matches = userInput.match(new RegExp(pattern, "gi"));
|
||||
if (matches) {
|
||||
score += matches.length * 0.2; // Weight by number of matches
|
||||
}
|
||||
});
|
||||
|
||||
if (score > 0.3) {
|
||||
// Threshold for detection
|
||||
detectedIntents.push(intent);
|
||||
confidenceScores[intent] = Math.min(score, 1.0);
|
||||
}
|
||||
});
|
||||
|
||||
// Determine primary intent
|
||||
const primaryIntent =
|
||||
detectedIntents.length > 0 ? detectedIntents[0] : "UNKNOWN";
|
||||
const confidence = confidenceScores[primaryIntent] || 0;
|
||||
|
||||
return {
|
||||
intent: primaryIntent,
|
||||
confidence,
|
||||
reasoning: generateIntentReasoning(
|
||||
primaryIntent,
|
||||
detectedIntents,
|
||||
userInput
|
||||
),
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Extract entities from user input
|
||||
*/
|
||||
export function extractEntities(userInput: string): EntityExtraction {
|
||||
const entities: EntityExtraction = {
|
||||
urls: [],
|
||||
dataTypes: [],
|
||||
outputFormats: [],
|
||||
aiTasks: [],
|
||||
processingSteps: [],
|
||||
targetSites: [],
|
||||
dataSources: [],
|
||||
};
|
||||
|
||||
// Extract URLs
|
||||
const urlPattern = /https?:\/\/[^\s]+/gi;
|
||||
const urls = userInput.match(urlPattern);
|
||||
if (urls) {
|
||||
entities.urls = urls;
|
||||
}
|
||||
|
||||
// Extract data types
|
||||
const dataTypePatterns = [
|
||||
{ pattern: /json/i, type: "json" },
|
||||
{ pattern: /csv/i, type: "csv" },
|
||||
{ pattern: /pdf/i, type: "pdf" },
|
||||
{ pattern: /text/i, type: "text" },
|
||||
{ pattern: /xml/i, type: "xml" },
|
||||
{ pattern: /yaml/i, type: "yaml" },
|
||||
];
|
||||
|
||||
dataTypePatterns.forEach(({ pattern, type }) => {
|
||||
if (pattern.test(userInput)) {
|
||||
entities.dataTypes.push(type);
|
||||
}
|
||||
});
|
||||
|
||||
// Extract AI tasks
|
||||
const aiTaskPatterns = [
|
||||
{ pattern: /summarize/i, task: "summarize" },
|
||||
{ pattern: /analyze/i, task: "analyze" },
|
||||
{ pattern: /classify/i, task: "classify" },
|
||||
{ pattern: /translate/i, task: "translate" },
|
||||
{ pattern: /generate/i, task: "generate" },
|
||||
{ pattern: /extract.*key.*points/i, task: "extract_key_points" },
|
||||
{ pattern: /sentiment.*analysis/i, task: "sentiment_analysis" },
|
||||
];
|
||||
|
||||
aiTaskPatterns.forEach(({ pattern, task }) => {
|
||||
if (pattern.test(userInput)) {
|
||||
entities.aiTasks.push(task);
|
||||
}
|
||||
});
|
||||
|
||||
// Extract processing steps
|
||||
const processingStepPatterns = [
|
||||
{ pattern: /scrape/i, step: "scrape" },
|
||||
{ pattern: /extract/i, step: "extract" },
|
||||
{ pattern: /transform/i, step: "transform" },
|
||||
{ pattern: /convert/i, step: "convert" },
|
||||
{ pattern: /filter/i, step: "filter" },
|
||||
{ pattern: /sort/i, step: "sort" },
|
||||
{ pattern: /validate/i, step: "validate" },
|
||||
];
|
||||
|
||||
processingStepPatterns.forEach(({ pattern, step }) => {
|
||||
if (pattern.test(userInput)) {
|
||||
entities.processingSteps.push(step);
|
||||
}
|
||||
});
|
||||
|
||||
return entities;
|
||||
}
|
||||
|
||||
/**
|
||||
* Analyze complexity of mixed workflows
|
||||
*/
|
||||
export function analyzeComplexity(
|
||||
userInput: string,
|
||||
detectedIntents: string[]
|
||||
): ComplexityAnalysis {
|
||||
let complexityScore = 0;
|
||||
const detectedPatterns: string[] = [];
|
||||
|
||||
// Check temporal relationships
|
||||
Object.entries(complexityIndicators.temporal).forEach(([pattern, regex]) => {
|
||||
if (regex.test(userInput)) {
|
||||
complexityScore += 0.1;
|
||||
detectedPatterns.push(`temporal:${pattern}`);
|
||||
}
|
||||
});
|
||||
|
||||
// Check data flow patterns
|
||||
Object.entries(complexityIndicators.dataFlow).forEach(([pattern, regex]) => {
|
||||
if (regex.test(userInput)) {
|
||||
complexityScore += 0.1;
|
||||
detectedPatterns.push(`dataFlow:${pattern}`);
|
||||
}
|
||||
});
|
||||
|
||||
// Check processing patterns
|
||||
Object.entries(complexityIndicators.processing).forEach(
|
||||
([pattern, regex]) => {
|
||||
if (regex.test(userInput)) {
|
||||
complexityScore += 0.1;
|
||||
detectedPatterns.push(`processing:${pattern}`);
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
// Additional complexity from number of intents
|
||||
complexityScore += (detectedIntents.length - 1) * 0.2;
|
||||
|
||||
// Additional complexity from mixed intent patterns
|
||||
Object.entries(mixedIntentPatterns).forEach(([category, patterns]) => {
|
||||
patterns.forEach((pattern) => {
|
||||
if (pattern.test(userInput)) {
|
||||
complexityScore += 0.05;
|
||||
detectedPatterns.push(`mixed:${category}`);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
const level =
|
||||
complexityScore > 0.7 ? "high" : complexityScore > 0.4 ? "medium" : "low";
|
||||
const estimatedNodes = Math.max(
|
||||
3,
|
||||
detectedIntents.length + Math.floor(complexityScore * 3)
|
||||
);
|
||||
|
||||
return {
|
||||
level,
|
||||
score: Math.min(complexityScore, 1.0),
|
||||
patterns: detectedPatterns,
|
||||
estimatedNodes,
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if input indicates mixed intent
|
||||
*/
|
||||
export function isMixedIntent(
|
||||
userInput: string,
|
||||
detectedIntents: string[]
|
||||
): boolean {
|
||||
if (detectedIntents.length <= 1) return false;
|
||||
|
||||
// Check for explicit mixed intent indicators
|
||||
const mixedIndicators = [
|
||||
/and.*also/i,
|
||||
/then.*also/i,
|
||||
/while.*also/i,
|
||||
/pipeline/i,
|
||||
/workflow/i,
|
||||
/multiple.*steps/i,
|
||||
/end.*to.*end/i,
|
||||
];
|
||||
|
||||
return mixedIndicators.some((pattern) => pattern.test(userInput));
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate reasoning for intent classification
|
||||
*/
|
||||
function generateIntentReasoning(
|
||||
primaryIntent: string,
|
||||
detectedIntents: string[],
|
||||
userInput: string
|
||||
): string {
|
||||
if (detectedIntents.length === 0) {
|
||||
return "No clear intent patterns detected in the input";
|
||||
}
|
||||
|
||||
if (detectedIntents.length === 1) {
|
||||
return `Clear ${primaryIntent} intent detected from user input`;
|
||||
}
|
||||
|
||||
if (isMixedIntent(userInput, detectedIntents)) {
|
||||
return `Mixed intent detected: ${detectedIntents.join(
|
||||
", "
|
||||
)}. User wants to perform multiple operations in sequence or parallel`;
|
||||
}
|
||||
|
||||
return `Multiple intents detected: ${detectedIntents.join(
|
||||
", "
|
||||
)}. Primary intent: ${primaryIntent}`;
|
||||
}
|
||||
|
||||
/**
|
||||
* Map intent to node type
|
||||
*/
|
||||
export function mapIntentToNodeType(intent: string): string {
|
||||
const intentToNodeMap: Record<string, string> = {
|
||||
WEB_SCRAPING: "webScraping",
|
||||
AI_ANALYSIS: "llmTask",
|
||||
DATA_PROCESSING: "structuredOutput",
|
||||
SEARCH_AND_RETRIEVAL: "similaritySearch",
|
||||
CONTENT_GENERATION: "llmTask",
|
||||
};
|
||||
|
||||
return intentToNodeMap[intent] || "llmTask";
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate node label based on intent and context
|
||||
*/
|
||||
export function generateNodeLabel(
|
||||
intent: string,
|
||||
index: number,
|
||||
context?: string
|
||||
): string {
|
||||
const labelMap: Record<string, string> = {
|
||||
WEB_SCRAPING: "Web Scraper",
|
||||
AI_ANALYSIS: "AI Analyzer",
|
||||
DATA_PROCESSING: "Data Processor",
|
||||
SEARCH_AND_RETRIEVAL: "Similarity Search",
|
||||
CONTENT_GENERATION: "Content Generator",
|
||||
};
|
||||
|
||||
const baseLabel = labelMap[intent] || "AI Task";
|
||||
|
||||
if (index > 0) {
|
||||
return `${baseLabel} ${index + 1}`;
|
||||
}
|
||||
|
||||
return baseLabel;
|
||||
}
|
||||
@@ -1,37 +0,0 @@
|
||||
[
|
||||
{
|
||||
"nodeId": "629f823b-0ddd-47f9-a1ce-947ca32a08dc",
|
||||
"nodeLabel": "dataInput Node",
|
||||
"status": "success",
|
||||
"data": {
|
||||
"output": "Hello"
|
||||
}
|
||||
},
|
||||
{
|
||||
"nodeId": "b79450d7-12f0-431b-9677-54d9de0b75f3",
|
||||
"nodeLabel": "llmTask Node",
|
||||
"status": "success",
|
||||
"data": {
|
||||
"output": "Hello — straight to the point. \nHow can I help you?",
|
||||
"prompt": "Answer the following question: Hello, straight to the point.",
|
||||
"model": "deepseek-chat",
|
||||
"temperature": 0.7,
|
||||
"maxTokens": 1000,
|
||||
"usage": {
|
||||
"promptTokens": 16,
|
||||
"completionTokens": 14,
|
||||
"totalTokens": 30
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"nodeId": "0c7ed46e-5ed4-4191-bfbd-31a35d9cc46b",
|
||||
"nodeLabel": "dataOutput Node",
|
||||
"status": "success",
|
||||
"data": {
|
||||
"output": "Hello",
|
||||
"format": "text",
|
||||
"filename": "Analysis.txt"
|
||||
}
|
||||
}
|
||||
]
|
||||
Reference in New Issue
Block a user