mirror of
https://github.com/sudoxreboot/groqd
synced 2026-04-14 11:36:49 +00:00
Fallback memory scope when device/user id missing
This commit is contained in:
parent
ac18969018
commit
ab9bd057e8
1 changed files with 12 additions and 4 deletions
|
|
@ -190,10 +190,18 @@ class GroqdConversationEntity(
|
|||
|
||||
memory_scope = options.get(CONF_MEMORY_SCOPE, DEFAULT_MEMORY_SCOPE)
|
||||
memory_key = None
|
||||
if memory_scope == "device" and user_input.device_id:
|
||||
if memory_scope == "device":
|
||||
if user_input.device_id:
|
||||
memory_key = f"device:{user_input.device_id}"
|
||||
elif memory_scope == "user" and user_input.context and user_input.context.user_id:
|
||||
elif user_input.context and user_input.context.user_id:
|
||||
memory_key = f"user:{user_input.context.user_id}"
|
||||
else:
|
||||
memory_key = "global"
|
||||
elif memory_scope == "user":
|
||||
if user_input.context and user_input.context.user_id:
|
||||
memory_key = f"user:{user_input.context.user_id}"
|
||||
else:
|
||||
memory_key = "global"
|
||||
elif memory_scope == "global":
|
||||
memory_key = "global"
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue