From 827521356a0fe16b3ca8c3e6318252170950aa64 Mon Sep 17 00:00:00 2001 From: Tom Szendrey Date: Fri, 4 Oct 2024 10:28:10 -0400 Subject: [PATCH 1/3] Use new section for llmThoughts --- .../src/components/llm/tera-notebook-jupyter-input.vue | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/packages/client/hmi-client/src/components/llm/tera-notebook-jupyter-input.vue b/packages/client/hmi-client/src/components/llm/tera-notebook-jupyter-input.vue index 82cc7f4c49..9248500194 100644 --- a/packages/client/hmi-client/src/components/llm/tera-notebook-jupyter-input.vue +++ b/packages/client/hmi-client/src/components/llm/tera-notebook-jupyter-input.vue @@ -110,12 +110,18 @@ const submitQuestion = () => { }); message.register('llm_thought', (data) => { thoughts.value = data; - llmThoughts.value = []; + llmThoughts.value = []; // TODO Should this reset on thought? Or just response? llmThoughts.value.push(data); llmQuery.value = questionString.value; emit('llm-thought-output', data); }); message.register('llm_response', (data) => { + // Check if our llm_response is providing a response text to a user's question + if (data.content.name === 'response_text') { + llmThoughts.value = []; + llmThoughts.value.push(data); + emit('llm-thought-output', data); + } thoughts.value = data; emit('llm-thought-output', data); }); From 8f520080386313de9db8b3c9eb07fc045ebd37fa Mon Sep 17 00:00:00 2001 From: Tom Szendrey Date: Fri, 4 Oct 2024 10:38:41 -0400 Subject: [PATCH 2/3] no need for double emit... --- .../src/components/llm/tera-notebook-jupyter-input.vue | 1 - 1 file changed, 1 deletion(-) diff --git a/packages/client/hmi-client/src/components/llm/tera-notebook-jupyter-input.vue b/packages/client/hmi-client/src/components/llm/tera-notebook-jupyter-input.vue index 9248500194..8d62202ada 100644 --- a/packages/client/hmi-client/src/components/llm/tera-notebook-jupyter-input.vue +++ b/packages/client/hmi-client/src/components/llm/tera-notebook-jupyter-input.vue @@ -120,7 +120,6 @@ const submitQuestion = () => { if (data.content.name === 'response_text') { llmThoughts.value = []; llmThoughts.value.push(data); - emit('llm-thought-output', data); } thoughts.value = data; emit('llm-thought-output', data); From 992c76c6965ae0996d24246d4d6468dafd8e15d3 Mon Sep 17 00:00:00 2001 From: Tom Szendrey Date: Fri, 4 Oct 2024 10:39:39 -0400 Subject: [PATCH 3/3] reset thoughts on question asked + response. --- .../src/components/llm/tera-notebook-jupyter-input.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/client/hmi-client/src/components/llm/tera-notebook-jupyter-input.vue b/packages/client/hmi-client/src/components/llm/tera-notebook-jupyter-input.vue index 8d62202ada..41ea72b991 100644 --- a/packages/client/hmi-client/src/components/llm/tera-notebook-jupyter-input.vue +++ b/packages/client/hmi-client/src/components/llm/tera-notebook-jupyter-input.vue @@ -98,6 +98,7 @@ const submitQuestion = () => { const message = props.kernelManager.sendMessage('llm_request', { request: questionString.value }); + llmThoughts.value = []; emit('question-asked', questionString.value); // May prefer to use a manual status rather than following this. TBD. Both options work for now @@ -110,7 +111,6 @@ const submitQuestion = () => { }); message.register('llm_thought', (data) => { thoughts.value = data; - llmThoughts.value = []; // TODO Should this reset on thought? Or just response? llmThoughts.value.push(data); llmQuery.value = questionString.value; emit('llm-thought-output', data);