From cc6a7fdc309d55480984d83bef828949b0158b39 Mon Sep 17 00:00:00 2001 From: Alexandre Rousseau Date: Fri, 15 Nov 2024 23:26:59 +0100 Subject: [PATCH] remove "pending" field on backend --- .../core/content/CoreChatBot/CoreChatbotMessage.vue | 6 +++--- .../content/CoreChatBot/ThoughtProcess/ThoughtProcess.vue | 4 +--- src/ui/src/components/core/content/CoreChatbot.vue | 4 ++++ src/writer/ai.py | 3 --- 4 files changed, 8 insertions(+), 9 deletions(-) diff --git a/src/ui/src/components/core/content/CoreChatBot/CoreChatbotMessage.vue b/src/ui/src/components/core/content/CoreChatBot/CoreChatbotMessage.vue index 5c50d323c..78c27fe1b 100644 --- a/src/ui/src/components/core/content/CoreChatBot/CoreChatbotMessage.vue +++ b/src/ui/src/components/core/content/CoreChatBot/CoreChatbotMessage.vue @@ -10,7 +10,7 @@
@@ -55,7 +55,6 @@ type NestedStringArray = ValueOrArray; export type Message = { role: string; - pending: boolean; content?: NestedStringArray; actions?: Action[]; }; @@ -86,6 +85,7 @@ const props = defineProps({ }, assistantRoleColor: { type: String, required: false, default: "" }, isLoading: { type: Boolean, required: false }, + pending: { type: Boolean }, }); defineEmits({ @@ -110,7 +110,7 @@ const isThoughtProcess = computed( const displayInitials = computed(() => { if (!isThoughtProcess.value) return true; - return !!props.message?.pending; + return !!props.pending; }); const content = computed(() => { diff --git a/src/ui/src/components/core/content/CoreChatBot/ThoughtProcess/ThoughtProcess.vue b/src/ui/src/components/core/content/CoreChatBot/ThoughtProcess/ThoughtProcess.vue index af7ddc043..7d896e663 100644 --- a/src/ui/src/components/core/content/CoreChatBot/ThoughtProcess/ThoughtProcess.vue +++ b/src/ui/src/components/core/content/CoreChatBot/ThoughtProcess/ThoughtProcess.vue @@ -40,9 +40,7 @@ const props = defineProps({ type: [String, Array] as PropType, required: true, }, - pending: { - type: Boolean, - }, + pending: { type: Boolean }, }); const isExpanded = ref(false); diff --git a/src/ui/src/components/core/content/CoreChatbot.vue b/src/ui/src/components/core/content/CoreChatbot.vue index 70064df84..73069bc83 100644 --- a/src/ui/src/components/core/content/CoreChatbot.vue +++ b/src/ui/src/components/core/content/CoreChatbot.vue @@ -15,6 +15,10 @@ See the stubs for more details. :message="message" :use-markdown="fields.useMarkdown.value == 'yes'" :assistant-role-color="fields.assistantRoleColor.value" + :pending=" + message.role === 'thought_process' && + messageId + 1 === messages.length + " :initials=" message.role === 'assistant' ? fields.assistantInitials.value diff --git a/src/writer/ai.py b/src/writer/ai.py index 2df94e38b..eba74348d 100644 --- a/src/writer/ai.py +++ b/src/writer/ai.py @@ -882,7 +882,6 @@ class Message(TypedDict, total=False): name: Optional[str] tool_call_id: Optional[str] tool_calls: Optional[List[Dict[str, Union[int, Dict]]]] - pending: Optional[bool] @classmethod def validate_message(cls, message): @@ -1316,7 +1315,6 @@ def __add__(self, chunk_or_message: Union['Conversation.Message', dict]): "role": message["role"], "content": message["content"], "actions": message.get("actions"), - "pending": message.get("pending") } if "tool_calls" in message: message_to_append["tool_calls"] = message["tool_calls"] @@ -1839,7 +1837,6 @@ def _serialize_message(self, message: 'Conversation.Message'): "role": message["role"], "content": message["content"], "actions": message["actions"], - "pending": message.get("pending"), } @property