This commit is contained in:
Timothy Jaeryang Baek committed 2026-11-18 18:55:30 +04:00
1 parent f8a5186480
commit 43d7281f4e
5 files changed
+32

No files matched your search

+5
View File
@@ -2088,6 +2088,10 @@ VIEW_CHAT_MAX_CHARS = int(os.environ['VIEW_CHAT_MAX_CHARS']) if os.getenv('VIEW_
if VIEW_CHAT_MAX_CHARS is not None and VIEW_CHAT_MAX_CHARS <= 0:
raise ValueError('VIEW_CHAT_MAX_CHARS must be a positive integer or unset')
TOOL_OUTPUT_MAX_CHARS = int(os.environ['TOOL_OUTPUT_MAX_CHARS']) if os.getenv('TOOL_OUTPUT_MAX_CHARS') else None
if TOOL_OUTPUT_MAX_CHARS is not None and TOOL_OUTPUT_MAX_CHARS <= 0:
raise ValueError('TOOL_OUTPUT_MAX_CHARS must be a positive integer or unset')
ENABLE_CHANNELS = os.getenv('ENABLE_CHANNELS', 'False').lower() == 'true'
ENABLE_ENCRYPTED_CHANNELS = os.getenv('ENABLE_ENCRYPTED_CHANNELS', 'False').lower() == 'true'
@@ -2971,6 +2975,7 @@ DEFAULT_CONFIG = {
'skills.content_max_chars': SKILL_CONTENT_MAX_CHARS,
'skills.preview_max_chars': SKILL_PREVIEW_MAX_CHARS,
'chats.view_max_chars': VIEW_CHAT_MAX_CHARS,
'tools.output_max_chars': TOOL_OUTPUT_MAX_CHARS,
'ollama.enable': ENABLE_OLLAMA_API,
'ollama.base_urls': OLLAMA_BASE_URLS,
'ollama.api_configs': OLLAMA_API_CONFIGS,
+4
View File
@@ -144,6 +144,7 @@ ADMIN_CONFIG_KEYS = {
'SKILL_CONTENT_MAX_CHARS': 'skills.content_max_chars',
'SKILL_PREVIEW_MAX_CHARS': 'skills.preview_max_chars',
'VIEW_CHAT_MAX_CHARS': 'chats.view_max_chars',
'TOOL_OUTPUT_MAX_CHARS': 'tools.output_max_chars',
'ENABLE_NOTES': 'notes.enable',
'ENABLE_USER_WEBHOOKS': 'ui.enable_user_webhooks',
'ENABLE_USER_STATUS': 'users.enable_status',
@@ -1196,6 +1197,7 @@ class AdminConfig(MfaConfigForm):
SKILL_CONTENT_MAX_CHARS: int | None = Field(default=None, gt=0, strict=True)
SKILL_PREVIEW_MAX_CHARS: int | None = Field(default=None, gt=0, strict=True)
VIEW_CHAT_MAX_CHARS: int | None = Field(default=None, gt=0, strict=True)
TOOL_OUTPUT_MAX_CHARS: int | None = Field(default=None, gt=0, strict=True)
ENABLE_NOTES: bool
ENABLE_USER_WEBHOOKS: bool
ENABLE_USER_STATUS: bool
@@ -1256,6 +1258,8 @@ async def update_admin_config(request: Request, form_data: AdminConfig, user=Dep
updates.pop('skills.preview_max_chars', None)
if 'VIEW_CHAT_MAX_CHARS' not in form_data.model_fields_set:
updates.pop('chats.view_max_chars', None)
if 'TOOL_OUTPUT_MAX_CHARS' not in form_data.model_fields_set:
updates.pop('tools.output_max_chars', None)
updates['ui.default_interface_settings'] = form_data.DEFAULT_INTERFACE_SETTINGS or {}
updates['folders.max_file_count'] = int(form_data.FOLDER_MAX_FILE_COUNT) if form_data.FOLDER_MAX_FILE_COUNT else ''
updates['automations.max_count'] = int(form_data.AUTOMATION_MAX_COUNT) if form_data.AUTOMATION_MAX_COUNT else ''
+4
View File
@@ -947,6 +947,10 @@ async def process_tool_result(
else:
tool_result = str(tool_result)
max_chars = await Config.get('tools.output_max_chars')
if max_chars and tool_result and len(tool_result) > max_chars:
tool_result = f'{tool_result[:max_chars]}\n\n[Truncated: {len(tool_result)} characters, limit {max_chars}]'
return tool_result, tool_result_files, tool_result_embeds
@@ -65,6 +65,7 @@
SKILL_CONTENT_MAX_CHARS: $i18n.t('settings.admin.general.skillContentMaxChars.label'),
SKILL_PREVIEW_MAX_CHARS: $i18n.t('settings.admin.general.skillPreviewMaxChars.label'),
VIEW_CHAT_MAX_CHARS: $i18n.t('settings.admin.general.viewChatMaxChars.label'),
TOOL_OUTPUT_MAX_CHARS: $i18n.t('settings.admin.general.toolOutputMaxChars.label'),
ENABLE_NOTES: $i18n.t('settings.admin.general.notes.label'),
ENABLE_COMMENTS: $i18n.t('settings.admin.general.comments.label'),
ENABLE_NOTIFICATIONS: $i18n.t('settings.admin.general.notifications.label'),
@@ -124,6 +125,7 @@
SKILL_CONTENT_MAX_CHARS: adminConfig.SKILL_CONTENT_MAX_CHARS ?? null,
SKILL_PREVIEW_MAX_CHARS: adminConfig.SKILL_PREVIEW_MAX_CHARS ?? null,
VIEW_CHAT_MAX_CHARS: adminConfig.VIEW_CHAT_MAX_CHARS ?? null,
TOOL_OUTPUT_MAX_CHARS: adminConfig.TOOL_OUTPUT_MAX_CHARS ?? null,
DEFAULT_INTERFACE_SETTINGS: defaultInterfaceSettings,
I18N: cleaned
});
@@ -435,6 +437,21 @@
bind:value={adminConfig.VIEW_CHAT_MAX_CHARS}
/>
</AdminSettingField>
<AdminSettingField
forId="tool-output-max-chars"
label={$i18n.t('settings.admin.general.toolOutputMaxChars.label')}
description={$i18n.t('settings.admin.general.toolOutputMaxChars.description')}
>
<input
id="tool-output-max-chars"
class={inputClass}
type="number"
min="1"
step="1"
placeholder={$i18n.t('No limit')}
bind:value={adminConfig.TOOL_OUTPUT_MAX_CHARS}
/>
</AdminSettingField>
<AdminSettingRow
label={$i18n.t('settings.admin.general.notes.label')}
description={$i18n.t('settings.admin.general.notes.description')}
@@ -3444,6 +3444,8 @@
"settings.admin.general.skillPreviewMaxChars.description": "Characters shown when instructions exceed the read limit. Cannot exceed that limit. Leave empty to use the default.",
"settings.admin.general.skillPreviewMaxChars.label": "Skill Preview Length",
"settings.admin.general.title": "General",
"settings.admin.general.toolOutputMaxChars.description": "Maximum characters of a tool result sent to the model. Longer results are cut off. Leave empty for no limit.",
"settings.admin.general.toolOutputMaxChars.label": "Tool Output Limit",
"settings.admin.general.translations.addTranslation.label": "Add translation",
"settings.admin.general.translations.uiTranslations.label": "UI Translations",
"settings.admin.general.userStatus.description": "Show user status information in the app.",