mirror of
https://github.com/open-webui/open-webui.git
synced 2026-07-23 09:10:55 -05:00
refac
This commit is contained in:
@@ -13,6 +13,9 @@ OPENAI_API_KEY=''
|
|||||||
# CORS_ALLOW_ORIGIN='http://localhost:5173;http://localhost:8080'
|
# CORS_ALLOW_ORIGIN='http://localhost:5173;http://localhost:8080'
|
||||||
CORS_ALLOW_ORIGIN='*'
|
CORS_ALLOW_ORIGIN='*'
|
||||||
|
|
||||||
|
# Set to false to keep memory tools enabled without adding memory context to the system context.
|
||||||
|
ENABLE_MEMORY_SYSTEM_CONTEXT=true
|
||||||
|
|
||||||
# For production you should set this to match the proxy configuration (127.0.0.1)
|
# For production you should set this to match the proxy configuration (127.0.0.1)
|
||||||
FORWARDED_ALLOW_IPS='*'
|
FORWARDED_ALLOW_IPS='*'
|
||||||
|
|
||||||
|
|||||||
@@ -394,6 +394,7 @@ CODE_EXECUTION_JUPYTER_TIMEOUT = int(os.getenv('CODE_EXECUTION_JUPYTER_TIMEOUT',
|
|||||||
ENABLE_CODE_INTERPRETER = os.getenv('ENABLE_CODE_INTERPRETER', 'True').lower() == 'true'
|
ENABLE_CODE_INTERPRETER = os.getenv('ENABLE_CODE_INTERPRETER', 'True').lower() == 'true'
|
||||||
|
|
||||||
ENABLE_MEMORIES = os.getenv('ENABLE_MEMORIES', 'True').lower() == 'true'
|
ENABLE_MEMORIES = os.getenv('ENABLE_MEMORIES', 'True').lower() == 'true'
|
||||||
|
ENABLE_MEMORY_SYSTEM_CONTEXT = os.getenv('ENABLE_MEMORY_SYSTEM_CONTEXT', 'True').lower() == 'true'
|
||||||
ENABLE_MEMORY_BACKGROUND_REVIEW = os.getenv('ENABLE_MEMORY_BACKGROUND_REVIEW', 'False').lower() == 'true'
|
ENABLE_MEMORY_BACKGROUND_REVIEW = os.getenv('ENABLE_MEMORY_BACKGROUND_REVIEW', 'False').lower() == 'true'
|
||||||
MEMORIES_REVIEW_INTERVAL_TURNS = int(os.getenv('MEMORIES_REVIEW_INTERVAL_TURNS', '10'))
|
MEMORIES_REVIEW_INTERVAL_TURNS = int(os.getenv('MEMORIES_REVIEW_INTERVAL_TURNS', '10'))
|
||||||
MEMORIES_USER_CHAR_LIMIT = int(os.getenv('MEMORIES_USER_CHAR_LIMIT', '2000'))
|
MEMORIES_USER_CHAR_LIMIT = int(os.getenv('MEMORIES_USER_CHAR_LIMIT', '2000'))
|
||||||
@@ -2741,6 +2742,7 @@ DEFAULT_CONFIG = {
|
|||||||
'code_execution.jupyter.timeout': CODE_EXECUTION_JUPYTER_TIMEOUT,
|
'code_execution.jupyter.timeout': CODE_EXECUTION_JUPYTER_TIMEOUT,
|
||||||
'code_interpreter.enable': ENABLE_CODE_INTERPRETER,
|
'code_interpreter.enable': ENABLE_CODE_INTERPRETER,
|
||||||
'memories.enable': ENABLE_MEMORIES,
|
'memories.enable': ENABLE_MEMORIES,
|
||||||
|
'memories.system_context.enable': ENABLE_MEMORY_SYSTEM_CONTEXT,
|
||||||
'memories.background_review.enable': ENABLE_MEMORY_BACKGROUND_REVIEW,
|
'memories.background_review.enable': ENABLE_MEMORY_BACKGROUND_REVIEW,
|
||||||
'memories.review_interval_turns': MEMORIES_REVIEW_INTERVAL_TURNS,
|
'memories.review_interval_turns': MEMORIES_REVIEW_INTERVAL_TURNS,
|
||||||
'memories.user_char_limit': MEMORIES_USER_CHAR_LIMIT,
|
'memories.user_char_limit': MEMORIES_USER_CHAR_LIMIT,
|
||||||
|
|||||||
@@ -105,6 +105,7 @@ ADMIN_CONFIG_KEYS = {
|
|||||||
'ENABLE_CHANNELS': 'channels.enable',
|
'ENABLE_CHANNELS': 'channels.enable',
|
||||||
'ENABLE_CALENDAR': 'calendar.enable',
|
'ENABLE_CALENDAR': 'calendar.enable',
|
||||||
'ENABLE_MEMORIES': 'memories.enable',
|
'ENABLE_MEMORIES': 'memories.enable',
|
||||||
|
'ENABLE_MEMORY_SYSTEM_CONTEXT': 'memories.system_context.enable',
|
||||||
'ENABLE_NOTES': 'notes.enable',
|
'ENABLE_NOTES': 'notes.enable',
|
||||||
'ENABLE_USER_WEBHOOKS': 'ui.enable_user_webhooks',
|
'ENABLE_USER_WEBHOOKS': 'ui.enable_user_webhooks',
|
||||||
'ENABLE_USER_STATUS': 'users.enable_status',
|
'ENABLE_USER_STATUS': 'users.enable_status',
|
||||||
@@ -1142,6 +1143,7 @@ class AdminConfig(BaseModel):
|
|||||||
ENABLE_CHANNELS: bool
|
ENABLE_CHANNELS: bool
|
||||||
ENABLE_CALENDAR: bool
|
ENABLE_CALENDAR: bool
|
||||||
ENABLE_MEMORIES: bool
|
ENABLE_MEMORIES: bool
|
||||||
|
ENABLE_MEMORY_SYSTEM_CONTEXT: bool
|
||||||
ENABLE_NOTES: bool
|
ENABLE_NOTES: bool
|
||||||
ENABLE_USER_WEBHOOKS: bool
|
ENABLE_USER_WEBHOOKS: bool
|
||||||
ENABLE_USER_STATUS: bool
|
ENABLE_USER_STATUS: bool
|
||||||
|
|||||||
@@ -2427,7 +2427,7 @@ async def process_chat_payload(request, form_data, user, metadata, model):
|
|||||||
form_data['messages'],
|
form_data['messages'],
|
||||||
)
|
)
|
||||||
|
|
||||||
if 'memory' in features and features['memory']:
|
if 'memory' in features and features['memory'] and await Config.get('memories.system_context.enable'):
|
||||||
form_data = await add_memory_context(request, form_data, user, model)
|
form_data = await add_memory_context(request, form_data, user, model)
|
||||||
|
|
||||||
if 'web_search' in features and features['web_search']:
|
if 'web_search' in features and features['web_search']:
|
||||||
|
|||||||
@@ -297,6 +297,16 @@
|
|||||||
<Switch bind:state={adminConfig.ENABLE_MEMORIES} />
|
<Switch bind:state={adminConfig.ENABLE_MEMORIES} />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
{#if adminConfig.ENABLE_MEMORIES}
|
||||||
|
<div class="mb-2.5 flex w-full items-center justify-between pr-2 pl-4">
|
||||||
|
<div class=" self-center text-xs font-medium text-gray-500 dark:text-gray-400">
|
||||||
|
{$i18n.t('Memory System Context')}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<Switch bind:state={adminConfig.ENABLE_MEMORY_SYSTEM_CONTEXT} />
|
||||||
|
</div>
|
||||||
|
{/if}
|
||||||
|
|
||||||
<div class="mb-2.5 flex w-full items-center justify-between pr-2">
|
<div class="mb-2.5 flex w-full items-center justify-between pr-2">
|
||||||
<div class=" self-center text-xs font-medium">
|
<div class=" self-center text-xs font-medium">
|
||||||
{$i18n.t('Notes')}
|
{$i18n.t('Notes')}
|
||||||
|
|||||||
Reference in New Issue
Block a user