open-swarm 0.1.1743070217__py3-none-any.whl → 0.1.1743362777__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- open_swarm-0.1.1743362777.dist-info/METADATA +217 -0
- open_swarm-0.1.1743362777.dist-info/RECORD +260 -0
- {open_swarm-0.1.1743070217.dist-info → open_swarm-0.1.1743362777.dist-info}/WHEEL +1 -2
- open_swarm-0.1.1743362777.dist-info/entry_points.txt +2 -0
- swarm/__init__.py +0 -2
- swarm/auth.py +53 -49
- swarm/blueprints/README.md +67 -0
- swarm/blueprints/burnt_noodles/blueprint_burnt_noodles.py +412 -0
- swarm/blueprints/chatbot/blueprint_chatbot.py +98 -0
- swarm/blueprints/chatbot/templates/chatbot/chatbot.html +33 -0
- swarm/blueprints/digitalbutlers/blueprint_digitalbutlers.py +183 -0
- swarm/blueprints/dilbot_universe/blueprint_dilbot_universe.py +285 -0
- swarm/blueprints/divine_code/__init__.py +0 -0
- swarm/blueprints/divine_code/apps.py +11 -0
- swarm/blueprints/divine_code/blueprint_divine_code.py +219 -0
- swarm/blueprints/django_chat/apps.py +6 -0
- swarm/blueprints/django_chat/blueprint_django_chat.py +84 -0
- swarm/blueprints/django_chat/templates/django_chat/django_chat_webpage.html +37 -0
- swarm/blueprints/django_chat/urls.py +8 -0
- swarm/blueprints/django_chat/views.py +32 -0
- swarm/blueprints/echocraft/blueprint_echocraft.py +44 -0
- swarm/blueprints/family_ties/apps.py +11 -0
- swarm/blueprints/family_ties/blueprint_family_ties.py +152 -0
- swarm/blueprints/family_ties/models.py +19 -0
- swarm/blueprints/family_ties/serializers.py +7 -0
- swarm/blueprints/family_ties/settings.py +16 -0
- swarm/blueprints/family_ties/urls.py +10 -0
- swarm/blueprints/family_ties/views.py +26 -0
- swarm/blueprints/flock/__init__.py +0 -0
- swarm/blueprints/gaggle/blueprint_gaggle.py +184 -0
- swarm/blueprints/gotchaman/blueprint_gotchaman.py +232 -0
- swarm/blueprints/mcp_demo/blueprint_mcp_demo.py +133 -0
- swarm/blueprints/messenger/templates/messenger/messenger.html +46 -0
- swarm/blueprints/mission_improbable/blueprint_mission_improbable.py +234 -0
- swarm/blueprints/monkai_magic/blueprint_monkai_magic.py +248 -0
- swarm/blueprints/nebula_shellz/blueprint_nebula_shellz.py +156 -0
- swarm/blueprints/omniplex/blueprint_omniplex.py +221 -0
- swarm/blueprints/rue_code/__init__.py +0 -0
- swarm/blueprints/rue_code/blueprint_rue_code.py +291 -0
- swarm/blueprints/suggestion/blueprint_suggestion.py +110 -0
- swarm/blueprints/unapologetic_press/blueprint_unapologetic_press.py +298 -0
- swarm/blueprints/whiskeytango_foxtrot/__init__.py +0 -0
- swarm/blueprints/whiskeytango_foxtrot/apps.py +11 -0
- swarm/blueprints/whiskeytango_foxtrot/blueprint_whiskeytango_foxtrot.py +256 -0
- swarm/extensions/blueprint/__init__.py +30 -15
- swarm/extensions/blueprint/agent_utils.py +16 -40
- swarm/extensions/blueprint/blueprint_base.py +141 -543
- swarm/extensions/blueprint/blueprint_discovery.py +112 -98
- swarm/extensions/blueprint/cli_handler.py +185 -0
- swarm/extensions/blueprint/config_loader.py +122 -0
- swarm/extensions/blueprint/django_utils.py +181 -79
- swarm/extensions/blueprint/interactive_mode.py +1 -1
- swarm/extensions/config/config_loader.py +83 -200
- swarm/extensions/launchers/build_swarm_wrapper.py +0 -0
- swarm/extensions/launchers/swarm_cli.py +199 -287
- swarm/llm/chat_completion.py +26 -55
- swarm/management/__init__.py +0 -0
- swarm/management/commands/__init__.py +0 -0
- swarm/management/commands/runserver.py +58 -0
- swarm/permissions.py +38 -0
- swarm/serializers.py +96 -5
- swarm/settings.py +95 -110
- swarm/static/contrib/fonts/fontawesome-webfont.ttf +7 -0
- swarm/static/contrib/fonts/fontawesome-webfont.woff +7 -0
- swarm/static/contrib/fonts/fontawesome-webfont.woff2 +7 -0
- swarm/static/contrib/markedjs/marked.min.js +6 -0
- swarm/static/contrib/tabler-icons/adjustments-horizontal.svg +27 -0
- swarm/static/contrib/tabler-icons/alert-triangle.svg +21 -0
- swarm/static/contrib/tabler-icons/archive.svg +21 -0
- swarm/static/contrib/tabler-icons/artboard.svg +27 -0
- swarm/static/contrib/tabler-icons/automatic-gearbox.svg +23 -0
- swarm/static/contrib/tabler-icons/box-multiple.svg +19 -0
- swarm/static/contrib/tabler-icons/carambola.svg +19 -0
- swarm/static/contrib/tabler-icons/copy.svg +20 -0
- swarm/static/contrib/tabler-icons/download.svg +21 -0
- swarm/static/contrib/tabler-icons/edit.svg +21 -0
- swarm/static/contrib/tabler-icons/filled/carambola.svg +13 -0
- swarm/static/contrib/tabler-icons/filled/paint.svg +13 -0
- swarm/static/contrib/tabler-icons/headset.svg +22 -0
- swarm/static/contrib/tabler-icons/layout-sidebar-left-collapse.svg +21 -0
- swarm/static/contrib/tabler-icons/layout-sidebar-left-expand.svg +21 -0
- swarm/static/contrib/tabler-icons/layout-sidebar-right-collapse.svg +21 -0
- swarm/static/contrib/tabler-icons/layout-sidebar-right-expand.svg +21 -0
- swarm/static/contrib/tabler-icons/message-chatbot.svg +22 -0
- swarm/static/contrib/tabler-icons/message-star.svg +22 -0
- swarm/static/contrib/tabler-icons/message-x.svg +23 -0
- swarm/static/contrib/tabler-icons/message.svg +21 -0
- swarm/static/contrib/tabler-icons/paperclip.svg +18 -0
- swarm/static/contrib/tabler-icons/playlist-add.svg +22 -0
- swarm/static/contrib/tabler-icons/robot.svg +26 -0
- swarm/static/contrib/tabler-icons/search.svg +19 -0
- swarm/static/contrib/tabler-icons/settings.svg +20 -0
- swarm/static/contrib/tabler-icons/thumb-down.svg +19 -0
- swarm/static/contrib/tabler-icons/thumb-up.svg +19 -0
- swarm/static/css/dropdown.css +22 -0
- swarm/static/htmx/htmx.min.js +0 -0
- swarm/static/js/dropdown.js +23 -0
- swarm/static/rest_mode/css/base.css +470 -0
- swarm/static/rest_mode/css/chat-history.css +286 -0
- swarm/static/rest_mode/css/chat.css +251 -0
- swarm/static/rest_mode/css/chatbot.css +74 -0
- swarm/static/rest_mode/css/chatgpt.css +62 -0
- swarm/static/rest_mode/css/colors/corporate.css +74 -0
- swarm/static/rest_mode/css/colors/pastel.css +81 -0
- swarm/static/rest_mode/css/colors/tropical.css +82 -0
- swarm/static/rest_mode/css/general.css +142 -0
- swarm/static/rest_mode/css/layout.css +167 -0
- swarm/static/rest_mode/css/layouts/messenger-layout.css +17 -0
- swarm/static/rest_mode/css/layouts/minimalist-layout.css +57 -0
- swarm/static/rest_mode/css/layouts/mobile-layout.css +8 -0
- swarm/static/rest_mode/css/messages.css +84 -0
- swarm/static/rest_mode/css/messenger.css +135 -0
- swarm/static/rest_mode/css/settings.css +91 -0
- swarm/static/rest_mode/css/simple.css +44 -0
- swarm/static/rest_mode/css/slack.css +58 -0
- swarm/static/rest_mode/css/style.css +156 -0
- swarm/static/rest_mode/css/theme.css +30 -0
- swarm/static/rest_mode/css/toast.css +40 -0
- swarm/static/rest_mode/js/auth.js +9 -0
- swarm/static/rest_mode/js/blueprint.js +41 -0
- swarm/static/rest_mode/js/blueprintUtils.js +12 -0
- swarm/static/rest_mode/js/chatLogic.js +79 -0
- swarm/static/rest_mode/js/debug.js +63 -0
- swarm/static/rest_mode/js/events.js +98 -0
- swarm/static/rest_mode/js/main.js +19 -0
- swarm/static/rest_mode/js/messages.js +264 -0
- swarm/static/rest_mode/js/messengerLogic.js +355 -0
- swarm/static/rest_mode/js/modules/apiService.js +84 -0
- swarm/static/rest_mode/js/modules/blueprintManager.js +162 -0
- swarm/static/rest_mode/js/modules/chatHistory.js +110 -0
- swarm/static/rest_mode/js/modules/debugLogger.js +14 -0
- swarm/static/rest_mode/js/modules/eventHandlers.js +107 -0
- swarm/static/rest_mode/js/modules/messageProcessor.js +120 -0
- swarm/static/rest_mode/js/modules/state.js +7 -0
- swarm/static/rest_mode/js/modules/userInteractions.js +29 -0
- swarm/static/rest_mode/js/modules/validation.js +23 -0
- swarm/static/rest_mode/js/rendering.js +119 -0
- swarm/static/rest_mode/js/settings.js +130 -0
- swarm/static/rest_mode/js/sidebar.js +94 -0
- swarm/static/rest_mode/js/simpleLogic.js +37 -0
- swarm/static/rest_mode/js/slackLogic.js +66 -0
- swarm/static/rest_mode/js/splash.js +76 -0
- swarm/static/rest_mode/js/theme.js +111 -0
- swarm/static/rest_mode/js/toast.js +36 -0
- swarm/static/rest_mode/js/ui.js +265 -0
- swarm/static/rest_mode/js/validation.js +57 -0
- swarm/static/rest_mode/svg/animated_spinner.svg +12 -0
- swarm/static/rest_mode/svg/arrow_down.svg +5 -0
- swarm/static/rest_mode/svg/arrow_left.svg +5 -0
- swarm/static/rest_mode/svg/arrow_right.svg +5 -0
- swarm/static/rest_mode/svg/arrow_up.svg +5 -0
- swarm/static/rest_mode/svg/attach.svg +8 -0
- swarm/static/rest_mode/svg/avatar.svg +7 -0
- swarm/static/rest_mode/svg/canvas.svg +6 -0
- swarm/static/rest_mode/svg/chat_history.svg +4 -0
- swarm/static/rest_mode/svg/close.svg +5 -0
- swarm/static/rest_mode/svg/copy.svg +4 -0
- swarm/static/rest_mode/svg/dark_mode.svg +3 -0
- swarm/static/rest_mode/svg/edit.svg +5 -0
- swarm/static/rest_mode/svg/layout.svg +9 -0
- swarm/static/rest_mode/svg/logo.svg +29 -0
- swarm/static/rest_mode/svg/logout.svg +5 -0
- swarm/static/rest_mode/svg/mobile.svg +5 -0
- swarm/static/rest_mode/svg/new_chat.svg +4 -0
- swarm/static/rest_mode/svg/not_visible.svg +5 -0
- swarm/static/rest_mode/svg/plus.svg +7 -0
- swarm/static/rest_mode/svg/run_code.svg +6 -0
- swarm/static/rest_mode/svg/save.svg +4 -0
- swarm/static/rest_mode/svg/search.svg +6 -0
- swarm/static/rest_mode/svg/settings.svg +4 -0
- swarm/static/rest_mode/svg/speaker.svg +5 -0
- swarm/static/rest_mode/svg/stop.svg +6 -0
- swarm/static/rest_mode/svg/thumbs_down.svg +3 -0
- swarm/static/rest_mode/svg/thumbs_up.svg +3 -0
- swarm/static/rest_mode/svg/toggle_off.svg +6 -0
- swarm/static/rest_mode/svg/toggle_on.svg +6 -0
- swarm/static/rest_mode/svg/trash.svg +10 -0
- swarm/static/rest_mode/svg/undo.svg +3 -0
- swarm/static/rest_mode/svg/visible.svg +8 -0
- swarm/static/rest_mode/svg/voice.svg +10 -0
- swarm/templates/account/login.html +22 -0
- swarm/templates/account/signup.html +32 -0
- swarm/templates/base.html +30 -0
- swarm/templates/chat.html +43 -0
- swarm/templates/index.html +35 -0
- swarm/templates/rest_mode/components/chat_sidebar.html +55 -0
- swarm/templates/rest_mode/components/header.html +45 -0
- swarm/templates/rest_mode/components/main_chat_pane.html +41 -0
- swarm/templates/rest_mode/components/settings_dialog.html +97 -0
- swarm/templates/rest_mode/components/splash_screen.html +7 -0
- swarm/templates/rest_mode/components/top_bar.html +28 -0
- swarm/templates/rest_mode/message_ui.html +50 -0
- swarm/templates/rest_mode/slackbot.html +30 -0
- swarm/templates/simple_blueprint_page.html +24 -0
- swarm/templates/websocket_partials/final_system_message.html +3 -0
- swarm/templates/websocket_partials/system_message.html +4 -0
- swarm/templates/websocket_partials/user_message.html +5 -0
- swarm/urls.py +57 -74
- swarm/utils/log_utils.py +63 -0
- swarm/views/api_views.py +48 -39
- swarm/views/chat_views.py +156 -70
- swarm/views/core_views.py +85 -90
- swarm/views/model_views.py +64 -121
- swarm/views/utils.py +65 -441
- open_swarm-0.1.1743070217.dist-info/METADATA +0 -258
- open_swarm-0.1.1743070217.dist-info/RECORD +0 -89
- open_swarm-0.1.1743070217.dist-info/entry_points.txt +0 -3
- open_swarm-0.1.1743070217.dist-info/top_level.txt +0 -1
- swarm/agent/agent.py +0 -49
- swarm/core.py +0 -326
- swarm/extensions/mcp/__init__.py +0 -1
- swarm/extensions/mcp/cache_utils.py +0 -36
- swarm/extensions/mcp/mcp_client.py +0 -341
- swarm/extensions/mcp/mcp_constants.py +0 -7
- swarm/extensions/mcp/mcp_tool_provider.py +0 -110
- swarm/types.py +0 -126
- {open_swarm-0.1.1743070217.dist-info → open_swarm-0.1.1743362777.dist-info}/licenses/LICENSE +0 -0
@@ -0,0 +1,45 @@
|
|
1
|
+
{% load static %}
|
2
|
+
<!DOCTYPE html>
|
3
|
+
<html lang="en">
|
4
|
+
<head>
|
5
|
+
<meta charset="UTF-8" />
|
6
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
7
|
+
<title>Open-Swarm Chat</title>
|
8
|
+
|
9
|
+
<!-- CSRF Token -->
|
10
|
+
<meta name="csrf-token" content="{{ csrf_token }}">
|
11
|
+
|
12
|
+
<!-- Base CSS -->
|
13
|
+
<link rel="stylesheet" href="{% static 'rest_mode/css/base.css' %}">
|
14
|
+
<link id="colorThemeLink" rel="stylesheet" href="{% static 'rest_mode/css/colors/corporate.css' %}">
|
15
|
+
<link id="layoutThemeLink" rel="stylesheet" href="{% static 'rest_mode/css/layouts/messenger-layout.css' %}">
|
16
|
+
<link rel="stylesheet" href="{% static 'rest_mode/css/style.css' %}">
|
17
|
+
<link rel="stylesheet" href="{% static 'rest_mode/css/chat-history.css' %}">
|
18
|
+
<link rel="stylesheet" href="{% static 'rest_mode/css/chat.css' %}">
|
19
|
+
<link rel="stylesheet" href="{% static 'rest_mode/css/general.css' %}">
|
20
|
+
<link rel="stylesheet" href="{% static 'rest_mode/css/messages.css' %}">
|
21
|
+
<link rel="stylesheet" href="{% static 'rest_mode/css/settings.css' %}">
|
22
|
+
|
23
|
+
<!-- Inline Script to Apply Settings from localStorage -->
|
24
|
+
<script>
|
25
|
+
(function () {
|
26
|
+
// Default values
|
27
|
+
const defaultSettings = {
|
28
|
+
colorTheme: 'corporate',
|
29
|
+
layoutTheme: 'messenger-layout',
|
30
|
+
darkMode: true,
|
31
|
+
mobileLayout: false
|
32
|
+
};
|
33
|
+
|
34
|
+
// Load settings from localStorage or use defaults
|
35
|
+
const colorTheme = localStorage.getItem('selectedColor') || defaultSettings.colorTheme;
|
36
|
+
const layoutTheme = localStorage.getItem('selectedLayout') || defaultSettings.layoutTheme;
|
37
|
+
const darkMode = localStorage.getItem('darkMode') === 'true' || defaultSettings.darkMode;
|
38
|
+
|
39
|
+
// Apply settings
|
40
|
+
document.documentElement.setAttribute('data-theme-color', colorTheme);
|
41
|
+
document.documentElement.setAttribute('data-theme-layout', layoutTheme);
|
42
|
+
document.documentElement.setAttribute('data-theme-dark', darkMode);
|
43
|
+
})();
|
44
|
+
</script>
|
45
|
+
</head>
|
@@ -0,0 +1,41 @@
|
|
1
|
+
{% load static %}
|
2
|
+
<div class="main-pane">
|
3
|
+
<div class="button-row">
|
4
|
+
<button class="input-button-subtle" aria-label="Toggle Chat History" id="chatHistoryToggleButtonVisible" style="display: none;">
|
5
|
+
<img src="{% static 'contrib/tabler-icons/layout-sidebar-left-expand.svg' %}" alt="Chat History">
|
6
|
+
</button>
|
7
|
+
<button class="input-button-subtle" aria-label="Settings" id="settingsButton-main" style="display: none;">
|
8
|
+
<img src="{% static 'contrib/tabler-icons/settings.svg' %}" alt="Settings">
|
9
|
+
</button>
|
10
|
+
<button class="input-button-subtle" aria-label="Search" id="searchButton-main" style="display: none;">
|
11
|
+
<img src="{% static 'contrib/tabler-icons/search.svg' %}" alt="Search">
|
12
|
+
</button>
|
13
|
+
<button class="input-button-subtle" aria-label="New Chat" id="newChatButton-main" style="display: none;">
|
14
|
+
<img src="{% static 'contrib/tabler-icons/message-chatbot.svg' %}" alt="New Chat"> New Chat
|
15
|
+
</button>
|
16
|
+
</div>
|
17
|
+
<div id="quickPromptsContainer" class="quick-prompts-container"></div>
|
18
|
+
<div id="messageHistory" class="message-container"></div>
|
19
|
+
<div id="loadingIndicator" class="loading-indicator"></div>
|
20
|
+
<div class="form-container">
|
21
|
+
<div class="dropdown-buttons-container">
|
22
|
+
<select class="blueprint-dropdown" id="blueprintDropdown" aria-label="Select Blueprint"></select>
|
23
|
+
<button class="input-button upload-button" id="uploadButton" aria-label="Upload">
|
24
|
+
<img src="{% static 'contrib/tabler-icons/paperclip.svg' %}" alt="Upload">
|
25
|
+
</button>
|
26
|
+
<button class="input-button upload-button" id="canvasToggleButton" aria-label="Toggle Canvas">
|
27
|
+
<img src="{% static 'contrib/tabler-icons/artboard.svg' %}" alt="Canvas">
|
28
|
+
</button>
|
29
|
+
<button class="input-button" id="voiceRecordButton" aria-label="Record Voice">
|
30
|
+
<img src="{% static 'contrib/tabler-icons/headset.svg' %}" alt="Record Voice">
|
31
|
+
</button>
|
32
|
+
<button class="input-button upload-button" id="avatarToggleButton" aria-label="Toggle Avatar">
|
33
|
+
<img src="{% static 'contrib/tabler-icons/robot.svg' %}" alt="Avatar">
|
34
|
+
</button>
|
35
|
+
</div>
|
36
|
+
<div class="send-container">
|
37
|
+
<input type="text" id="userInput" class="rounded-input" placeholder="Type your message here...">
|
38
|
+
<button class="half-cut-button">Send</button>
|
39
|
+
</div>
|
40
|
+
</div>
|
41
|
+
</div>
|
@@ -0,0 +1,97 @@
|
|
1
|
+
{% load static %}
|
2
|
+
<div class="settings-dialog" id="settingsDialog">
|
3
|
+
<button class="dialog-close-btn" id="closeSettingsDialog">
|
4
|
+
<img src="{% static 'rest_mode/svg/close.svg' %}" alt="Close Settings Dialog">
|
5
|
+
</button>
|
6
|
+
<div class="settings-container scrollable-container">
|
7
|
+
<h2>⚙️ Settings</h2>
|
8
|
+
|
9
|
+
<!-- User Interface Section -->
|
10
|
+
<div class="settings-container-section">
|
11
|
+
<h3 id="uiConfigToggle" class="collapsible-toggle">🖌️ User Interface <span>▼</span></h3>
|
12
|
+
<div id="uiConfiguration" class="collapsible-content hidden">
|
13
|
+
<!-- Dark Mode -->
|
14
|
+
<div class="toggle-title">
|
15
|
+
<label for="darkModeToggle">🌙 Dark Mode:</label>
|
16
|
+
<div id="darkModeToggle" class="svg-toggle" data-state="off">
|
17
|
+
<img src="{% static 'rest_mode/svg/toggle_off.svg' %}" alt="Toggle Off">
|
18
|
+
</div>
|
19
|
+
</div>
|
20
|
+
|
21
|
+
<!-- Colour -->
|
22
|
+
<div class="theme-dropdown">
|
23
|
+
<label for="colorSelect">🎨 Colour:</label><select id="colorSelect">
|
24
|
+
<option value="corporate">Corporate</option>
|
25
|
+
<option value="pastel">Pastel</option>
|
26
|
+
<option value="tropical">Tropical</option>
|
27
|
+
</select>
|
28
|
+
</div>
|
29
|
+
|
30
|
+
<!-- Layout -->
|
31
|
+
<div class="theme-dropdown">
|
32
|
+
<label for="layoutSelect">🖥️ Layout:</label>
|
33
|
+
<select id="layoutSelect">
|
34
|
+
<option value="messenger-layout">Messenger</option>
|
35
|
+
<option value="mobile-layout">Mobile</option>
|
36
|
+
<option value="minimalist-layout">Minimalist</option>
|
37
|
+
</select>
|
38
|
+
</div>
|
39
|
+
|
40
|
+
<!-- Mobile UI Master Toggle -->
|
41
|
+
<div class="settings-container-section">
|
42
|
+
<h4 id="mobileUIToggleTitle" class="collapsible-toggle">📱 Mobile UI <span>▼</span></h4>
|
43
|
+
<div id="mobileUIConfiguration" class="collapsible-content hidden">
|
44
|
+
<!-- Master Toggle -->
|
45
|
+
<div class="toggle-title">
|
46
|
+
<label for="mobileUIToggle">Enable Mobile UI:</label>
|
47
|
+
<div id="mobileUIToggle" class="svg-toggle" data-state="off">
|
48
|
+
<img src="{% static 'rest_mode/svg/toggle_off.svg' %}" alt="Toggle Off">
|
49
|
+
</div>
|
50
|
+
</div>
|
51
|
+
<!-- Nested Toggles -->
|
52
|
+
<div id="mobileUIOptions" class="nested-container">
|
53
|
+
<div class="nested-toggle">
|
54
|
+
<label for="alwaysVisibleButtonsToggle">Always Visible Buttons:</label>
|
55
|
+
<div id="alwaysVisibleButtonsToggle" class="svg-toggle" data-state="off">
|
56
|
+
<img src="{% static 'rest_mode/svg/toggle_off.svg' %}" alt="Toggle Off">
|
57
|
+
</div>
|
58
|
+
</div>
|
59
|
+
<div class="nested-toggle">
|
60
|
+
<label for="revealTopBarToggle">Reveal Top Bar When Up Scroll:</label>
|
61
|
+
<div id="revealTopBarToggle" class="svg-toggle" data-state="off">
|
62
|
+
<img src="{% static 'rest_mode/svg/toggle_off.svg' %}" alt="Toggle Off">
|
63
|
+
</div>
|
64
|
+
</div>
|
65
|
+
<div class="nested-toggle">
|
66
|
+
<label for="swipeLeftSettingsToggle">Swipe Left for Settings:</label>
|
67
|
+
<div id="swipeLeftSettingsToggle" class="svg-toggle" data-state="off">
|
68
|
+
<img src="{% static 'rest_mode/svg/toggle_off.svg' %}" alt="Toggle Off">
|
69
|
+
</div>
|
70
|
+
</div>
|
71
|
+
<div class="nested-toggle">
|
72
|
+
<label for="swipeRightChatHistoryToggle">Swipe Right for Chat History:</label>
|
73
|
+
<div id="swipeRightChatHistoryToggle" class="svg-toggle" data-state="off">
|
74
|
+
<img src="{% static 'rest_mode/svg/toggle_off.svg' %}" alt="Toggle Off">
|
75
|
+
</div>
|
76
|
+
</div>
|
77
|
+
<div class="nested-toggle">
|
78
|
+
<label for="swipeDownControlsToggle">Swipe Down for Controls:</label>
|
79
|
+
<div id="swipeDownControlsToggle" class="svg-toggle" data-state="off">
|
80
|
+
<img src="{% static 'rest_mode/svg/toggle_off.svg' %}" alt="Toggle Off">
|
81
|
+
</div>
|
82
|
+
</div>
|
83
|
+
</div>
|
84
|
+
</div>
|
85
|
+
</div>
|
86
|
+
</div>
|
87
|
+
</div>
|
88
|
+
|
89
|
+
<!-- LLM Configuration -->
|
90
|
+
<div class="settings-container-section">
|
91
|
+
<h3 id="llmConfigToggle" class="collapsible-toggle">🧠 LLM Configuration <span>▼</span></h3>
|
92
|
+
<div id="llmConfiguration" class="collapsible-content hidden">
|
93
|
+
<p>Loading LLM configurations...</p>
|
94
|
+
</div>
|
95
|
+
</div>
|
96
|
+
</div>
|
97
|
+
</div>
|
@@ -0,0 +1,7 @@
|
|
1
|
+
{% load static %}
|
2
|
+
<div id="splashScreen" class="splash-screen">
|
3
|
+
<div class="splash-content">
|
4
|
+
<h1 id="splashText">Connecting to the AI...</h1>
|
5
|
+
<small>... trouble connecting? Check the <a href="https://github.com/matthewhand/open-swarm/TROUBLESHOOTING.md">Troubleshooting Guide</a></small>
|
6
|
+
</div>
|
7
|
+
</div>
|
@@ -0,0 +1,28 @@
|
|
1
|
+
{% load static %}
|
2
|
+
<div class="top-bar">
|
3
|
+
|
4
|
+
|
5
|
+
<!-- Persistent Message Area -->
|
6
|
+
<div id="firstUserMessage" class="first-user-message"></div>
|
7
|
+
|
8
|
+
<!-- Settings (Right) -->
|
9
|
+
<div class="top-bar-right">
|
10
|
+
|
11
|
+
<!-- Blueprint Name and Dropdown -->
|
12
|
+
<div class="blueprint-container">
|
13
|
+
<h2 id="blueprintTitle" class="blueprint-title"></h2>
|
14
|
+
|
15
|
+
<!-- Hidden Blueprint Metadata -->
|
16
|
+
<div id="blueprintMetadata" class="hidden">
|
17
|
+
<h2>Metadata</h2>
|
18
|
+
<p>Metadata content will be dynamically updated...</p>
|
19
|
+
</div>
|
20
|
+
|
21
|
+
<!-- Blueprint Dialog -->
|
22
|
+
<div id="blueprintDialog" class="blueprint-dialog hidden">
|
23
|
+
<!-- Blueprint options will be injected dynamically -->
|
24
|
+
</div>
|
25
|
+
</div>
|
26
|
+
|
27
|
+
</div>
|
28
|
+
</div>
|
@@ -0,0 +1,50 @@
|
|
1
|
+
<div class="message-container">
|
2
|
+
<!-- Persistent Message Area -->
|
3
|
+
<div id="persistentMessage" class="persistent-message">
|
4
|
+
<div class="message assistant">
|
5
|
+
<span>Welcome to Open-Swarm Chat!</span>
|
6
|
+
</div>
|
7
|
+
<div id="firstUserMessage">
|
8
|
+
<!-- Placeholder for dynamically updated persistent message -->
|
9
|
+
</div>
|
10
|
+
<div class="message-toolbar">
|
11
|
+
<button class="toolbar-btn" aria-label="Edit Persistent Message" title="Edit">
|
12
|
+
<img src="{% static 'rest_mode/svg/edit.svg' %}" alt="Edit Icon" class="icon-svg" />
|
13
|
+
</button>
|
14
|
+
<button class="toolbar-btn" aria-label="Copy Persistent Message" title="Copy">
|
15
|
+
<img src="{% static 'rest_mode/svg/copy.svg' %}" alt="Copy Icon" class="icon-svg" />
|
16
|
+
</button>
|
17
|
+
<button class="toolbar-btn" aria-label="Delete Persistent Message" title="Delete">
|
18
|
+
<img src="{% static 'rest_mode/svg/trash.svg' %}" alt="Trash Icon" class="icon-svg" />
|
19
|
+
</button>
|
20
|
+
</div>
|
21
|
+
</div>
|
22
|
+
|
23
|
+
<!-- Messages -->
|
24
|
+
<div id="messageHistory" class="message-history">
|
25
|
+
<!-- Example of a user message -->
|
26
|
+
<div class="message user">
|
27
|
+
<span>Hello, how are you?</span>
|
28
|
+
<div class="message-toolbar">
|
29
|
+
<button class="toolbar-btn" aria-label="Append to Persistent Message" title="Append">
|
30
|
+
<img src="{% static 'rest_mode/svg/plus.svg' %}" alt="Plus Icon" class="icon-svg" />
|
31
|
+
</button>
|
32
|
+
<button class="toolbar-btn" aria-label="Edit Message" title="Edit">
|
33
|
+
<img src="{% static 'rest_mode/svg/edit.svg' %}" alt="Edit Icon" class="icon-svg" />
|
34
|
+
</button>
|
35
|
+
<button class="toolbar-btn" aria-label="Copy Message" title="Copy">
|
36
|
+
<img src="{% static 'rest_mode/svg/copy.svg' %}" alt="Copy Icon" class="icon-svg" />
|
37
|
+
</button>
|
38
|
+
<button class="toolbar-btn" aria-label="Delete Message" title="Delete">
|
39
|
+
<img src="{% static 'rest_mode/svg/trash.svg' %}" alt="Trash Icon" class="icon-svg" />
|
40
|
+
</button>
|
41
|
+
<button class="toolbar-btn" aria-label="Thumbs Up" title="Thumbs Up">
|
42
|
+
<img src="{% static 'rest_mode/svg/thumbs_up.svg' %}" alt="Thumbs Up Icon" class="icon-svg" />
|
43
|
+
</button>
|
44
|
+
<button class="toolbar-btn" aria-label="Thumbs Down" title="Thumbs Down">
|
45
|
+
<img src="{% static 'rest_mode/svg/thumbs_down.svg' %}" alt="Thumbs Down Icon" class="icon-svg" />
|
46
|
+
</button>
|
47
|
+
</div>
|
48
|
+
</div>
|
49
|
+
</div>
|
50
|
+
</div>
|
@@ -0,0 +1,30 @@
|
|
1
|
+
{% load static %}
|
2
|
+
<!DOCTYPE html>
|
3
|
+
<html lang="en">
|
4
|
+
<head>
|
5
|
+
{% include 'rest_mode/components/header.html' %}
|
6
|
+
<link rel="stylesheet" href="{% static 'rest_mode/css/slack.css' %}">
|
7
|
+
<script>
|
8
|
+
window.STATIC_URLS = {
|
9
|
+
layoutSidebarLeftExpand: "{% static 'contrib/tabler-icons/layout-sidebar-left-expand.svg' %}",
|
10
|
+
layoutSidebarLeftCollapse: "{% static 'contrib/tabler-icons/layout-sidebar-left-collapse.svg' %}"
|
11
|
+
};
|
12
|
+
</script>
|
13
|
+
</head>
|
14
|
+
<body>
|
15
|
+
{% include 'rest_mode/components/top_bar.html' %}
|
16
|
+
<div class="container" data-theme-color="corporate" data-theme-dark="false" data-theme-layout="slack-layout">
|
17
|
+
<div class="side-panes channel-pane" id="channelPane">
|
18
|
+
<h2>Channels</h2>
|
19
|
+
<ul id="channelList" class="channel-list"></ul>
|
20
|
+
</div>
|
21
|
+
<div class="vertical-divider" id="divider-left"></div>
|
22
|
+
<div class="main-pane">
|
23
|
+
{% include 'rest_mode/components/main_chat_pane.html' %}
|
24
|
+
</div>
|
25
|
+
<div id="toastContainer"></div>
|
26
|
+
</div>
|
27
|
+
<script type="module" src="{% static 'contrib/markedjs/marked.min.js' %}"></script>
|
28
|
+
<script type="module" src="{% static 'rest_mode/js/slackLogic.js' %}" defer></script>
|
29
|
+
</body>
|
30
|
+
</html>
|
@@ -0,0 +1,24 @@
|
|
1
|
+
{% load static %}
|
2
|
+
<!DOCTYPE html>
|
3
|
+
<html lang="en">
|
4
|
+
<head>
|
5
|
+
{% include 'rest_mode/components/header.html' %}
|
6
|
+
<title>{{ blueprint_name }} Chat</title>
|
7
|
+
<meta name="csrf-token" content="{{ csrf_token }}">
|
8
|
+
<link rel="stylesheet" href="{% static 'rest_mode/css/style.css' %}">
|
9
|
+
</head>
|
10
|
+
<body>
|
11
|
+
<div class="container" data-theme-color="corporate" data-theme-dark="false" data-theme-layout="minimal-layout">
|
12
|
+
<div class="main-pane">
|
13
|
+
<h2 id="blueprintTitle">{{ blueprint_name }}</h2>
|
14
|
+
<div id="messageHistory" class="message-container"></div>
|
15
|
+
<div class="send-container">
|
16
|
+
<input type="text" id="userInput" class="rounded-input" placeholder="Type your message here...">
|
17
|
+
<button class="half-cut-button" id="sendButton">Send</button>
|
18
|
+
</div>
|
19
|
+
</div>
|
20
|
+
</div>
|
21
|
+
<script type="module" src="{% static 'contrib/markedjs/marked.min.js' %}"></script>
|
22
|
+
<script type="module" src="{% static 'rest_mode/js/simpleLogic.js' %}" defer></script>
|
23
|
+
</body>
|
24
|
+
</html>
|
swarm/urls.py
CHANGED
@@ -1,89 +1,72 @@
|
|
1
|
+
"""
|
2
|
+
Swarm URL Configuration
|
3
|
+
"""
|
4
|
+
import logging
|
1
5
|
from django.contrib import admin
|
2
|
-
from django.urls import path,
|
3
|
-
from django.http import HttpResponse
|
6
|
+
from django.urls import path, include, reverse_lazy
|
4
7
|
from django.conf import settings
|
5
|
-
from django.
|
6
|
-
import
|
7
|
-
import logging
|
8
|
+
from django.views.generic import RedirectView
|
9
|
+
from django.contrib.auth import views as auth_views
|
8
10
|
|
9
|
-
|
10
|
-
|
11
|
-
from swarm.views.chat_views import
|
12
|
-
|
13
|
-
from swarm.views.
|
14
|
-
from
|
15
|
-
from rest_framework.routers import DefaultRouter
|
11
|
+
from drf_spectacular.views import SpectacularAPIView, SpectacularRedocView, SpectacularSwaggerView
|
12
|
+
|
13
|
+
from swarm.views.chat_views import ChatCompletionsView, HealthCheckView
|
14
|
+
# *** Uncomment and correct the import path ***
|
15
|
+
from swarm.views.api_views import ModelsListView
|
16
|
+
# from swarm.views.webui_views import index as webui_index # Rename to avoid conflict
|
16
17
|
|
17
18
|
logger = logging.getLogger(__name__)
|
18
19
|
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
20
|
+
# ==============================================================================
|
21
|
+
# API URL Patterns (v1)
|
22
|
+
# ==============================================================================
|
23
|
+
api_urlpatterns = [
|
24
|
+
path('chat/completions', ChatCompletionsView.as_view(), name='chat_completions'),
|
25
|
+
# *** Uncomment this URL pattern ***
|
26
|
+
path('models', ModelsListView.as_view(), name='list_models'),
|
27
|
+
path('health', HealthCheckView.as_view(), name='health_check'),
|
28
|
+
# Add other v1 API endpoints here
|
29
|
+
]
|
30
|
+
|
31
|
+
# ==============================================================================
|
32
|
+
# Schema URL Patterns
|
33
|
+
# ==============================================================================
|
34
|
+
schema_urlpatterns = [
|
35
|
+
path('schema/', SpectacularAPIView.as_view(), name='schema'),
|
36
|
+
path('schema/swagger-ui/', SpectacularSwaggerView.as_view(url_name='schema'), name='swagger-ui'),
|
37
|
+
path('schema/redoc/', SpectacularRedocView.as_view(url_name='schema'), name='redoc'),
|
38
|
+
]
|
28
39
|
|
29
|
-
|
30
|
-
|
40
|
+
# ==============================================================================
|
41
|
+
# Main URL Patterns
|
42
|
+
# ==============================================================================
|
43
|
+
urlpatterns = [
|
44
|
+
# Redirect root based on DEBUG setting
|
45
|
+
path('', RedirectView.as_view(pattern_name='swagger-ui', permanent=False) if settings.DEBUG else RedirectView.as_view(pattern_name='login', permanent=False)),
|
31
46
|
|
32
|
-
|
33
|
-
|
47
|
+
# API v1 endpoints
|
48
|
+
path('v1/', include(api_urlpatterns)),
|
34
49
|
|
35
|
-
|
36
|
-
|
37
|
-
if ChatMessageViewSet:
|
38
|
-
router.register(r'v1/chat/messages', ChatMessageViewSet, basename='chatmessage')
|
39
|
-
else:
|
40
|
-
logger.warning("ChatMessageViewSet not imported correctly, skipping API registration.")
|
50
|
+
# Schema endpoints
|
51
|
+
path('api/', include(schema_urlpatterns)),
|
41
52
|
|
42
|
-
#
|
43
|
-
|
44
|
-
base_urlpatterns = [
|
45
|
-
re_path(r'^health/?$', lambda request: HttpResponse("OK"), name='health_check'),
|
46
|
-
re_path(r'^v1/chat/completions/?$', chat_completions, name='chat_completions'),
|
47
|
-
re_path(r'^v1/models/?$', list_models, name='list_models'),
|
48
|
-
re_path(r'^schema/?$', HiddenSpectacularAPIView.as_view(), name='schema'),
|
49
|
-
re_path(r'^swagger-ui/?$', SpectacularSwaggerView.as_view(url_name='schema'), name='swagger-ui'),
|
50
|
-
]
|
53
|
+
# Django Admin (Optional)
|
54
|
+
path('admin/', admin.site.urls) if getattr(settings, 'ENABLE_ADMIN', False) else path('admin/', RedirectView.as_view(url=reverse_lazy('login'))),
|
51
55
|
|
52
|
-
#
|
53
|
-
|
56
|
+
# Authentication Views (Django Built-in)
|
57
|
+
path('login/', auth_views.LoginView.as_view(template_name='swarm/login.html'), name='login'),
|
58
|
+
path('logout/', auth_views.LogoutView.as_view(next_page=reverse_lazy('login')), name='logout'),
|
54
59
|
|
55
|
-
#
|
56
|
-
|
57
|
-
if ENABLE_WEBUI
|
58
|
-
|
59
|
-
path('', core_index_view, name='index'),
|
60
|
-
path('favicon.ico', favicon, name='favicon'),
|
61
|
-
path('config/swarm_config.json', serve_swarm_config, name='serve_swarm_config'),
|
62
|
-
path('accounts/login/', custom_login, name='custom_login'),
|
63
|
-
]
|
64
|
-
if settings.DEBUG:
|
65
|
-
if settings.STATIC_URL and settings.STATIC_ROOT:
|
66
|
-
webui_urlpatterns += static(settings.STATIC_URL, document_root=settings.STATIC_ROOT)
|
67
|
-
else:
|
68
|
-
logger.warning("STATIC_URL or STATIC_ROOT not configured, static files may not serve correctly in DEBUG mode.")
|
60
|
+
# Web UI (Optional) - Conditionally include based on settings
|
61
|
+
# *** Ensure this line remains commented out or removed if webui_index is not defined ***
|
62
|
+
# path('webui/', webui_index, name='webui_index') if getattr(settings, 'ENABLE_WEBUI', False) else path('webui/', RedirectView.as_view(url=reverse_lazy('login'))),
|
63
|
+
]
|
69
64
|
|
70
|
-
#
|
71
|
-
|
65
|
+
# Debug logging (optional)
|
66
|
+
logger.debug(f"ENABLE_ADMIN={getattr(settings, 'ENABLE_ADMIN', False)}")
|
67
|
+
logger.debug(f"ENABLE_WEBUI={getattr(settings, 'ENABLE_WEBUI', False)}")
|
72
68
|
|
73
|
-
#
|
74
|
-
|
69
|
+
# Example of how to conditionally add URLs based on settings
|
70
|
+
# if getattr(settings, 'ENABLE_SOMETHING', False):
|
71
|
+
# urlpatterns.append(path('something/', include('something.urls')))
|
75
72
|
|
76
|
-
# Log final URL patterns (consider moving this to where patterns are finalized if issues persist)
|
77
|
-
if settings.DEBUG:
|
78
|
-
try:
|
79
|
-
from django.urls import get_resolver
|
80
|
-
# Note: get_resolver(None) might not reflect dynamically added URLs perfectly here.
|
81
|
-
# Logging within django_utils might be more accurate for dynamic additions.
|
82
|
-
final_patterns = get_resolver(None).url_patterns
|
83
|
-
logger.debug(f"Initial resolved URL patterns ({len(final_patterns)} total):")
|
84
|
-
# for pattern in final_patterns:
|
85
|
-
# try: pattern_repr = str(pattern)
|
86
|
-
# except: pattern_repr = f"[Pattern for {getattr(pattern, 'name', 'unnamed')}]"
|
87
|
-
# logger.debug(f" {pattern_repr}")
|
88
|
-
except Exception as e:
|
89
|
-
logger.error(f"Could not log initial URL patterns: {e}")
|
swarm/utils/log_utils.py
ADDED
@@ -0,0 +1,63 @@
|
|
1
|
+
import logging
|
2
|
+
import sys
|
3
|
+
from swarm.settings import Settings, LogFormat
|
4
|
+
|
5
|
+
# Cache for initialized loggers to avoid adding handlers multiple times
|
6
|
+
_initialized_loggers = set()
|
7
|
+
|
8
|
+
def setup_logging(logger_name: str | None = None, level: str | int = Settings().log_level, force_reconfigure: bool = False) -> logging.Logger:
|
9
|
+
"""
|
10
|
+
Configures and returns a logger instance. Ensures handlers are not duplicated
|
11
|
+
and prevents propagation to avoid duplicate messages from parent loggers.
|
12
|
+
|
13
|
+
Args:
|
14
|
+
logger_name: Name of the logger. If None, configures the root logger.
|
15
|
+
level: Logging level (e.g., 'DEBUG', 'INFO', logging.DEBUG).
|
16
|
+
force_reconfigure: If True, remove existing handlers before adding new ones.
|
17
|
+
|
18
|
+
Returns:
|
19
|
+
Configured logger instance.
|
20
|
+
"""
|
21
|
+
log_level = logging.getLevelName(level.upper()) if isinstance(level, str) else level
|
22
|
+
|
23
|
+
logger = logging.getLogger(logger_name)
|
24
|
+
logger_id = logger_name if logger_name is not None else "root"
|
25
|
+
|
26
|
+
# Check if logger (by name) is already initialized and reconfiguration is not forced
|
27
|
+
if logger_id in _initialized_loggers and not force_reconfigure:
|
28
|
+
if logger.level != log_level:
|
29
|
+
logger.setLevel(log_level)
|
30
|
+
return logger
|
31
|
+
|
32
|
+
# If forcing reconfigure or first time, remove existing handlers
|
33
|
+
if force_reconfigure or logger_id not in _initialized_loggers:
|
34
|
+
for handler in logger.handlers[:]:
|
35
|
+
logger.removeHandler(handler)
|
36
|
+
if logger_name is None:
|
37
|
+
root_logger = logging.getLogger()
|
38
|
+
for handler in root_logger.handlers[:]:
|
39
|
+
root_logger.removeHandler(handler)
|
40
|
+
|
41
|
+
# Set the desired level on the logger
|
42
|
+
logger.setLevel(log_level)
|
43
|
+
|
44
|
+
# Prevent propagation for non-root loggers
|
45
|
+
if logger_name is not None:
|
46
|
+
logger.propagate = False
|
47
|
+
else:
|
48
|
+
logger.propagate = True # Root logger should propagate if needed by other libraries
|
49
|
+
|
50
|
+
# Add the stream handler if no handlers exist after potential removal
|
51
|
+
if not logger.handlers:
|
52
|
+
handler = logging.StreamHandler(sys.stdout)
|
53
|
+
log_format_enum = Settings().log_format
|
54
|
+
formatter = logging.Formatter(log_format_enum.value)
|
55
|
+
handler.setFormatter(formatter)
|
56
|
+
logger.addHandler(handler)
|
57
|
+
|
58
|
+
_initialized_loggers.add(logger_id)
|
59
|
+
|
60
|
+
# --- Lower level for specific noisy loggers ---
|
61
|
+
logging.getLogger('swarm.extensions.config.config_loader').setLevel(logging.ERROR) # Make config loader quieter by default
|
62
|
+
|
63
|
+
return logger
|