diff --git a/src/lib/components/chat/Chat.svelte b/src/lib/components/chat/Chat.svelte index 877a5a1e7a..d6b96d2348 100644 --- a/src/lib/components/chat/Chat.svelte +++ b/src/lib/components/chat/Chat.svelte @@ -14,7 +14,7 @@ import type { i18n as i18nType } from 'i18next'; import { WEBUI_BASE_URL } from '$lib/constants'; - import { iterativeAnalysis, graphChat } from './Agents/iterative_analysis'; + import * as graphDataSet from './Agents/iterative_analysis'; import { chatId, @@ -1850,7 +1850,8 @@ ); // Add chat data to the graph - const graphData = JSON.parse(JSON.stringify(iterativeAnalysis)); + const graphData = graphDataSet[history.graphId ?? "iterativeAnalysis"]; + // console.log(history.graphId); // const graphData = JSON.parse(JSON.stringify(graphChat)); let lastNodeId: string | null = null; @@ -1931,7 +1932,9 @@ return { role, content }; }); graphai.injectValue("chatHistory", messages); - graphai.injectValue("llmEngine", llmEngine); + if (graphai.nodes["llmEngine"]) { + graphai.injectValue("llmEngine", llmEngine); + } // graphai.injectValue("llmEngine", "anthropicAgent"); graphai.onLogCallback = ({ nodeId, agentId, state, inputs, result, errorMessage }) => { if (result) { @@ -2848,12 +2851,15 @@ } }} on:submit={async (e) => { - if (e.detail) { + if (e.detail) { + const { prompt, graphId } = e.detail; + history.graphId = graphId; + console.log(prompt, graphId); await tick(); submitPrompt( ($settings?.richTextInput ?? true) - ? e.detail.replaceAll('\n\n', '\n') - : e.detail + ? prompt.replaceAll('\n\n', '\n') + : prompt ); } }} diff --git a/src/lib/components/chat/Placeholder.svelte b/src/lib/components/chat/Placeholder.svelte index 6782ea628b..02e25b7b78 100644 --- a/src/lib/components/chat/Placeholder.svelte +++ b/src/lib/components/chat/Placeholder.svelte @@ -16,6 +16,8 @@ import EyeSlash from '$lib/components/icons/EyeSlash.svelte'; import MessageInput from './MessageInput.svelte'; + import * as graphDataSet from './Agents/iterative_analysis'; + const i18n = getContext('i18n'); export let transparentBackground = false; @@ -36,6 +38,9 @@ export let selectedToolIds = []; export let webSearchEnabled = false; + export let selectedGraph = "graphChat"; + const graphNames = Object.keys(graphDataSet); + let models = []; const selectSuggestionPrompt = async (p) => { @@ -142,7 +147,6 @@ {/if} -