mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-24 04:59:13 +00:00
feat(editor): Improve how we show default Agent prompt and Memory session parameters (#11491)
This commit is contained in:
@@ -21,7 +21,7 @@ import { sqlAgentAgentProperties } from './agents/SqlAgent/description';
|
||||
import { sqlAgentAgentExecute } from './agents/SqlAgent/execute';
|
||||
import { toolsAgentProperties } from './agents/ToolsAgent/description';
|
||||
import { toolsAgentExecute } from './agents/ToolsAgent/execute';
|
||||
import { promptTypeOptions, textInput } from '../../../utils/descriptions';
|
||||
import { promptTypeOptions, textFromPreviousNode, textInput } from '../../../utils/descriptions';
|
||||
|
||||
// Function used in the inputs expression to figure out which inputs to
|
||||
// display based on the agent type
|
||||
@@ -341,6 +341,17 @@ export class Agent implements INodeType {
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
...textFromPreviousNode,
|
||||
displayOptions: {
|
||||
show: { promptType: ['auto'], '@version': [{ _cnd: { gte: 1.7 } }] },
|
||||
// SQL Agent has data source and credentials parameters so we need to include this input there manually
|
||||
// to preserve the order
|
||||
hide: {
|
||||
agent: ['sqlAgent'],
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
...textInput,
|
||||
displayOptions: {
|
||||
|
||||
@@ -1,6 +1,11 @@
|
||||
import type { INodeProperties } from 'n8n-workflow';
|
||||
import { promptTypeOptions, textInput } from '../../../../../utils/descriptions';
|
||||
|
||||
import { SQL_PREFIX, SQL_SUFFIX } from './other/prompts';
|
||||
import {
|
||||
promptTypeOptions,
|
||||
textFromPreviousNode,
|
||||
textInput,
|
||||
} from '../../../../../utils/descriptions';
|
||||
|
||||
const dataSourceOptions: INodeProperties = {
|
||||
displayName: 'Data Source',
|
||||
@@ -114,6 +119,12 @@ export const sqlAgentAgentProperties: INodeProperties[] = [
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
...textFromPreviousNode,
|
||||
displayOptions: {
|
||||
show: { promptType: ['auto'], '@version': [{ _cnd: { gte: 1.7 } }], agent: ['sqlAgent'] },
|
||||
},
|
||||
},
|
||||
{
|
||||
...textInput,
|
||||
displayOptions: {
|
||||
|
||||
@@ -1,3 +1,9 @@
|
||||
import type { BaseChatMemory } from '@langchain/community/memory/chat_memory';
|
||||
import type { BaseLanguageModel } from '@langchain/core/language_models/base';
|
||||
import type { DataSource } from '@n8n/typeorm';
|
||||
import type { SqlCreatePromptArgs } from 'langchain/agents/toolkits/sql';
|
||||
import { SqlToolkit, createSqlAgent } from 'langchain/agents/toolkits/sql';
|
||||
import { SqlDatabase } from 'langchain/sql_db';
|
||||
import {
|
||||
type IExecuteFunctions,
|
||||
type INodeExecutionData,
|
||||
@@ -6,19 +12,12 @@ import {
|
||||
type IDataObject,
|
||||
} from 'n8n-workflow';
|
||||
|
||||
import { SqlDatabase } from 'langchain/sql_db';
|
||||
import type { SqlCreatePromptArgs } from 'langchain/agents/toolkits/sql';
|
||||
import { SqlToolkit, createSqlAgent } from 'langchain/agents/toolkits/sql';
|
||||
import type { BaseLanguageModel } from '@langchain/core/language_models/base';
|
||||
import type { BaseChatMemory } from '@langchain/community/memory/chat_memory';
|
||||
import type { DataSource } from '@n8n/typeorm';
|
||||
|
||||
import { getMysqlDataSource } from './other/handlers/mysql';
|
||||
import { getPostgresDataSource } from './other/handlers/postgres';
|
||||
import { getSqliteDataSource } from './other/handlers/sqlite';
|
||||
import { SQL_PREFIX, SQL_SUFFIX } from './other/prompts';
|
||||
import { getPromptInputByType, serializeChatHistory } from '../../../../../utils/helpers';
|
||||
import { getTracingConfig } from '../../../../../utils/tracing';
|
||||
import { getSqliteDataSource } from './other/handlers/sqlite';
|
||||
import { getPostgresDataSource } from './other/handlers/postgres';
|
||||
import { SQL_PREFIX, SQL_SUFFIX } from './other/prompts';
|
||||
import { getMysqlDataSource } from './other/handlers/mysql';
|
||||
|
||||
const parseTablesString = (tablesString: string) =>
|
||||
tablesString
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { AgentExecutor } from 'langchain/agents';
|
||||
import { OpenAI as OpenAIClient } from 'openai';
|
||||
import type { OpenAIToolType } from 'langchain/dist/experimental/openai_assistant/schema';
|
||||
import { OpenAIAssistantRunnable } from 'langchain/experimental/openai_assistant';
|
||||
import { NodeConnectionType, NodeOperationError } from 'n8n-workflow';
|
||||
import type {
|
||||
@@ -8,10 +8,11 @@ import type {
|
||||
INodeType,
|
||||
INodeTypeDescription,
|
||||
} from 'n8n-workflow';
|
||||
import type { OpenAIToolType } from 'langchain/dist/experimental/openai_assistant/schema';
|
||||
import { OpenAI as OpenAIClient } from 'openai';
|
||||
|
||||
import { formatToOpenAIAssistantTool } from './utils';
|
||||
import { getConnectedTools } from '../../../utils/helpers';
|
||||
import { getTracingConfig } from '../../../utils/tracing';
|
||||
import { formatToOpenAIAssistantTool } from './utils';
|
||||
|
||||
export class OpenAiAssistant implements INodeType {
|
||||
description: INodeTypeDescription = {
|
||||
|
||||
Reference in New Issue
Block a user