From 1b80a7f9a28b5f2e367fe5cb9fdc73c369649c39 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?th=E1=BB=8Bnh?= Date: Sat, 16 Nov 2024 15:27:59 +0700 Subject: [PATCH] Fix metor01's context param --- backend/utils/llm.py | 1 + backend/utils/plugins.py | 2 +- plugins/example/basic/mentor.py | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/backend/utils/llm.py b/backend/utils/llm.py index e44c758ce..352412889 100644 --- a/backend/utils/llm.py +++ b/backend/utils/llm.py @@ -879,5 +879,6 @@ def get_proactive_message(uid: str, plugin_prompt: str, params: [str], context: prompt = prompt.replace("{{user_context}}", context if context else "") continue prompt = prompt.replace(' ', '').strip() + #print(prompt) return llm_mini.invoke(prompt).content diff --git a/backend/utils/plugins.py b/backend/utils/plugins.py index f46b4939a..2e5cee24c 100644 --- a/backend/utils/plugins.py +++ b/backend/utils/plugins.py @@ -264,7 +264,7 @@ def _process_proactive_notification(uid: str, token: str, plugin: App, data): if len(memories) > 0: context = Memory.memories_to_string(memories, True) - print(f'_process_proactive_notification context {context[100] if context else "empty"}') + print(f'_process_proactive_notification context {context[:100] if context else "empty"}') # retrive message message = get_proactive_message(uid, prompt, filter_scopes, context) diff --git a/plugins/example/basic/mentor.py b/plugins/example/basic/mentor.py index 36b601c3c..0ebd1509d 100644 --- a/plugins/example/basic/mentor.py +++ b/plugins/example/basic/mentor.py @@ -13,7 +13,7 @@ # ************ Basic Proactive Notification Plugin ************ # ******************************************************* -@router.post('/mentor', tags=['mentor', 'basic', 'realtime', 'proactive_notification'], response_model=ProactiveNotificationEndpointResponse) +@router.post('/mentor', tags=['mentor', 'basic', 'realtime', 'proactive_notification'], response_model=ProactiveNotificationEndpointResponse, response_model_exclude_none=True) def mentoring(data: RealtimePluginRequest): def normalize(text): return re.sub(r' +', ' ',re.sub(r'[,?.!]', ' ', text)).lower().strip()