wip commit

This commit is contained in:
Charlie Kolb 2024-11-08 13:17:03 +01:00
parent 0db658c6d0
commit 65d50f8ad6
No known key found for this signature in database
5 changed files with 61 additions and 9 deletions

View file

@ -115,6 +115,7 @@ export async function toolsAgentExecute(this: IExecuteFunctions): Promise<INodeE
| undefined;
const tools = (await getConnectedTools(this, true, false)) as Array<DynamicStructuredTool | Tool>;
console.log('tools', tools);
const outputParser = (await getOptionalOutputParsers(this))?.[0];
let structuredOutputParserTool: DynamicStructuredTool | undefined;
/**

View file

@ -1,6 +1,13 @@
<script setup lang="ts">
import { ref, computed, onMounted, watch } from 'vue';
import type { IRunData, IRunExecutionData, NodeError, Workflow } from 'n8n-workflow';
import {
NodeConnectionType,
NodeHelpers,
type IRunData,
type IRunExecutionData,
type NodeError,
type Workflow,
} from 'n8n-workflow';
import RunData from './RunData.vue';
import RunInfo from './RunInfo.vue';
import { storeToRefs } from 'pinia';
@ -15,7 +22,9 @@ import { usePinnedData } from '@/composables/usePinnedData';
import { useTelemetry } from '@/composables/useTelemetry';
import { useI18n } from '@/composables/useI18n';
import { waitingNodeTooltip } from '@/utils/executionUtils';
import { N8nRadioButtons, N8nText } from 'n8n-design-system';
import { N8nCallout, N8nRadioButtons, N8nText } from 'n8n-design-system';
import { useNodeHelpers } from '@/composables/useNodeHelpers';
import { getExecutionData } from '@/api/workflows';
// Types
@ -277,6 +286,14 @@ watch(defaultOutputMode, (newValue: OutputType, oldValue: OutputType) => {
const activatePane = () => {
emit('activatePane');
};
const shouldShowWarning = computed(() => {
if (!node.value) return false;
const parents = props.workflow.getParentNodes(node.value.name, NodeConnectionType.AiTool, 1);
const active = parents.filter((x) => !!workflowRunData.value?.[x]?.[props.runIndex]);
return parents.length > 0 && active.length === 0;
});
</script>
<template>
@ -370,6 +387,23 @@ const activatePane = () => {
<RunDataAi :node="node" :run-index="runIndex" :workflow="workflow" />
</template>
<template v-if="shouldShowWarning" #table-user-info>
<div :class="$style.noToolsUsedAlert">
<!-- <N8nAlert
:title="i18n.baseText('ndv.output.noToolUsedInfo.title')"
:description="i18n.baseText('ndv.output.noToolUsedInfo.description')"
type="info"
/> -->
<N8nCallout theme="secondary">
{{
i18n.baseText('ndv.output.noToolUsedInfo.title') +
'. ' +
i18n.baseText('ndv.output.noToolUsedInfo.description')
}}
</N8nCallout>
</div>
</template>
<template #recovered-artificial-output-data>
<div :class="$style.recoveredOutputData">
<N8nText tag="div" :bold="true" color="text-dark" size="large">{{
@ -436,4 +470,10 @@ const activatePane = () => {
margin-bottom: var(--spacing-m);
}
}
.noToolsUsedAlert {
padding-left: var(--spacing-s);
padding-right: var(--spacing-s);
padding-bottom: var(--spacing-xs);
}
</style>

View file

@ -1355,7 +1355,9 @@ defineExpose({ enterEditMode });
>
<N8nText v-n8n-html="hint.message" size="small"></N8nText>
</N8nCallout>
<div v-if="hasNodeRun">
<slot name="table-user-info"></slot>
</div>
<div
v-if="maxOutputIndex > 0 && branches.length > 1 && !displaysMultipleNodes"
:class="$style.outputs"
@ -1591,7 +1593,11 @@ defineExpose({ enterEditMode });
@mounted="emit('tableMounted', $event)"
@active-row-changed="onItemHover"
@display-mode-change="onDisplayModeChange"
/>
>
<!-- <template #table-user-info>
<slot name="table-user-info"></slot>
</template> -->
</LazyRunDataTable>
</Suspense>
<Suspense v-else-if="hasNodeRun && displayMode === 'json' && node">

View file

@ -6,7 +6,12 @@ import { useWorkflowsStore } from '@/stores/workflows.store';
import { getMappedExpression } from '@/utils/mappingUtils';
import { getPairedItemId } from '@/utils/pairedItemUtils';
import { shorten } from '@/utils/typesUtils';
import type { GenericValue, IDataObject, INodeExecutionData } from 'n8n-workflow';
import {
NodeHelpers,
type GenericValue,
type IDataObject,
type INodeExecutionData,
} from 'n8n-workflow';
import { computed, onMounted, ref, watch } from 'vue';
import Draggable from './Draggable.vue';
import MappingPill from './MappingPill.vue';
@ -387,11 +392,11 @@ watch(focusedMappableInput, (curr) => {
<template>
<div :class="[$style.dataDisplay, { [$style.highlight]: highlight }]">
<slot name="table-user-info"></slot>
<table v-if="tableData.columns && tableData.columns.length === 0" :class="$style.table">
<thead>
<tr>
<th :class="$style.emptyCell"></th>
<th :class="$style.tableRightMargin"></th>
</tr>
</thead>
<tbody>
@ -408,7 +413,6 @@ watch(focusedMappableInput, (curr) => {
>
<N8nInfoTip>{{ i18n.baseText('runData.emptyItemHint') }}</N8nInfoTip>
</td>
<td :class="$style.tableRightMargin"></td>
</tr>
</tbody>
</table>
@ -478,7 +482,6 @@ watch(focusedMappableInput, (curr) => {
</span>
</N8nTooltip>
</th>
<th :class="$style.tableRightMargin"></th>
</tr>
</thead>
<Draggable
@ -546,7 +549,6 @@ watch(focusedMappableInput, (curr) => {
</N8nTree>
</td>
<td v-if="columnLimitExceeded"></td>
<td :class="$style.tableRightMargin"></td>
</tr>
</Draggable>
</table>
@ -565,6 +567,7 @@ watch(focusedMappableInput, (curr) => {
word-break: normal;
height: 100%;
padding-bottom: var(--spacing-3xl);
padding-inline: var(--spacing-l);
}
.table {

View file

@ -978,6 +978,8 @@
"ndv.output.tooMuchData.showDataAnyway": "Show data",
"ndv.output.tooMuchData.title": "Display data?",
"ndv.output.waitingToRun": "Waiting to execute...",
"ndv.output.noToolUsedInfo.title": "None of your tools were used in this run",
"ndv.output.noToolUsedInfo.description": "Try giving your tools clearer names and descriptions to help the AI",
"ndv.title.cancel": "Cancel",
"ndv.title.rename": "Rename",
"ndv.title.renameNode": "Rename node",