Skip to content

Speakr is a personal, self-hosted web application designed for transcribing audio recordings

Python

width fix

Murtaza Nasir738c3e5905e1
diff --git a/docker-compose.example.yml b/docker-compose.example.yml
index fb44d8f3..c7207625 100644
--- a/docker-compose.example.yml
+++ b/docker-compose.example.yml
@@ -1,38 +1,65 @@
services:
app:
- build:
- context: . # This uses your current directory as the build context
- dockerfile: Dockerfile # If your Dockerfile has a different name, specify it here
+ image: learnedmachine/speakr:latest
container_name: speakr
restart: unless-stopped
ports:
- "8899:8899"
+ # VOLUME CONFIGURATION OPTIONS:
+ # Uncomment ONE of the following volume configurations:
- # --- Configuration ---
- # Environment variables are loaded from the .env file.
- #
- # To get started:
- # 1. Choose your desired transcription method.
- # 2. Copy the corresponding example file to .env:
- #
- # For standard Whisper API:
- # cp env.whisper.example .env
- #
- # For a custom ASR endpoint:
- # cp env.asr.example .env
- #
- # 3. Edit the .env file to add your API keys and settings.
- env_file:
- - .env
-
- # --- Volume Configuration ---
- # Choose ONE of the following volume configurations.
- # Option 1 (Recommended): Bind mounts to local folders.
+ # Option 1: Using specific host paths for both volumes
volumes:
- - ./uploads:/data/uploads
- - ./instance:/data/instance
-
- # Option 2: Docker-managed volumes.
+ - /path/to/uploads:/data/uploads # Replace with your custom path
+ - /path/to/instance:/data/instance # Replace with your custom path
+
+ # Option 2: Using Docker-managed volumes for both
# volumes:
- # - speakr-uploads:/data/uploads
- # - speakr-instance:/data/instance
\ No newline at end of file
+ # - speakr-uploads:/data/uploads # Docker will manage this volume
+ # - speakr-instance:/data/instance # Docker will manage this volume
+
+ # Option 3: Mixed approach - custom path for uploads, Docker-managed for instance
+ # volumes:
+ # - /path/to/uploads:/data/uploads # Replace with your custom path
+ # - speakr-instance:/data/instance # Docker will manage this volume
+
+ environment:
+ # Database and upload folder configuration
+ - SQLALCHEMY_DATABASE_URI=sqlite:////data/instance/transcriptions.db
+ - UPLOAD_FOLDER=/data/uploads
+
+ # Text model configuration
+ - TEXT_MODEL_BASE_URL=https://openrouter.ai/api/v1
+ - TEXT_MODEL_API_KEY=your_text_model_api_key_here
+ - TEXT_MODEL_NAME=openai/gpt-4o-mini
+
+ # Whisper model configuration
+ - TRANSCRIPTION_BASE_URL=http://your_local_api_url:port/v1/
+ - TRANSCRIPTION_API_KEY=your_transcription_api_key_here
+ - WHISPER_MODEL=Systran/faster-distil-whisper-large-v3
+
+ # Application settings
+ # Transcription and Output languages are now per-user settings, configurable on the Account page in the app.
+ - ALLOW_REGISTRATION=false
+ - SUMMARY_MAX_TOKENS=8000 # Optional: Max tokens for title/summary generation (default: 3000)
+ - CHAT_MAX_TOKENS=5000 # Optional: Max tokens for chat responses (default: 2000)
+
+ # Admin user creation
+ - ADMIN_USERNAME=admin
+ - ADMIN_PASSWORD=securepassword
+
+# IMPORTANT: Uncomment this section if you're using any Docker-managed volumes
+# (required for Options 2 and 3 above)
+# volumes:
+# speakr-uploads:
+# # This defines the Docker-managed volume
+# speakr-instance:
+# # This defines the Docker-managed volume
+#
+# For custom volume names, use:
+# volumes:
+# speakr-uploads:
+# name: custom-speakr-uploads-name
+# speakr-instance:
+# name: custom-speakr-instance-name
diff --git a/static/css/styles.css b/static/css/styles.css
index c7071086..4b52d783 100644
--- a/static/css/styles.css
+++ b/static/css/styles.css
@@ -571,14 +571,57 @@ div[v-if="!editingNotes"] {
overflow-y: auto; /* Allow scrolling */
}
-/* Ensure the lg:col-span-3 container can grow properly and scroll */
-.lg\:col-span-3.bg-\[var\(--bg-secondary\)\].p-6.rounded-lg.shadow-md.flex.flex-col.max-h-85vh {
+/* Ensure the main content container can grow properly and scroll - works for both col-span-3 and col-span-4 */
+.lg\:col-span-3.bg-\[var\(--bg-secondary\)\].p-6.rounded-lg.shadow-md.flex.flex-col.max-h-85vh,
+.lg\:col-span-4.bg-\[var\(--bg-secondary\)\].p-6.rounded-lg.shadow-md.flex.flex-col.max-h-85vh {
/* max-height: none !important; /* Let Tailwind class 'max-h-85vh' apply */
height: 100%; /* Occupy the height of its grid cell */
flex: 1; /* For its own children, as it's a flex container */
overflow-y: auto; /* Allow its own content to scroll if it exceeds its height (max 85vh) */
}
+/* Ensure the main content area maintains its internal layout regardless of sidebar state */
+.main-content-area {
+ display: flex;
+ flex-direction: column;
+ height: 100%;
+ min-height: 0;
+}
+
+/* Ensure the main content columns container maintains consistent behavior */
+#mainContentColumns {
+ display: flex;
+ flex-direction: row;
+ flex: 1;
+ min-height: 0;
+ overflow: hidden;
+ width: 100%; /* Ensure full width usage */
+}
+
+/* Ensure left and right columns maintain their proportional widths */
+#leftMainColumn {
+ display: flex;
+ flex-direction: column;
+ min-height: 0;
+ overflow: hidden;
+ flex-shrink: 0; /* Prevent shrinking */
+ /* Width is controlled by inline style */
+}
+
+#rightMainColumn {
+ display: flex;
+ flex-direction: column;
+ flex: 1;
+ min-width: 0;
+ overflow: hidden;
+ /* Width will be calculated as remaining space */
+}
+
+/* Ensure the main column resizer remains functional */
+#mainColumnResizer {
+ flex-shrink: 0;
+}
+
/* Modern toast notification styles */
.toast-container {
position: fixed;
@@ -1675,6 +1718,7 @@ body {
align-items: center !important;
justify-content: center !important;
padding: 0 !important;
+ flex-shrink: 0 !important; /* Prevent resizer from shrinking */
}
#mainColumnResizer .w-1 {
@@ -1689,6 +1733,65 @@ body {
background-color: var(--border-accent) !important;
}
+/* Ensure consistent layout behavior when sidebar is collapsed */
+.sidebar-container.lg\:col-span-1 {
+ transition: all 0.3s ease;
+}
+
+/* Smooth transition for main content area when sidebar toggles */
+.main-content-area {
+ transition: all 0.3s ease;
+}
+
+/* Preserve column widths during sidebar transitions */
+.content-column {
+ transition: none !important; /* Disable transitions on content columns to prevent layout shifts */
+}
+
+/* Ensure the grid container adapts smoothly */
+.grid.grid-cols-1.lg\:grid-cols-4.gap-6.flex-grow {
+ transition: all 0.3s ease;
+}
+
+/* Force consistent internal layout regardless of parent grid span */
+.main-content-area #mainContentColumns {
+ width: 100% !important;
+ max-width: none !important;
+ min-width: 0 !important;
+}
+
+/* Ensure left column maintains its set width - respect inline styles */
+.main-content-area #leftMainColumn {
+ flex-shrink: 0 !important;
+ min-width: 0 !important;
+ /* Don't override width - let inline style control it */
+}
+
+/* Ensure right column fills remaining space */
+.main-content-area #rightMainColumn {
+ flex: 1 !important;
+ min-width: 0 !important;
+ width: auto !important;
+}
+
+/* Specific rule to ensure inline width styles are respected */
+#leftMainColumn[style*="width"] {
+ flex-basis: auto !important;
+ flex-grow: 0 !important;
+ flex-shrink: 0 !important;
+}
+
+/* Prevent layout shifts when grid span changes */
+.main-content-area .recording-header,
+.main-content-area .participants-section,
+.main-content-area .transcription-section,
+.main-content-area .tab-section,
+.main-content-area .audio-section,
+.main-content-area .chat-section {
+ width: 100% !important;
+ max-width: none !important;
+}
+
/* Discrete vertical resize divider */
.resize-handle {
height: 12px !important;
diff --git a/static/js/app.js b/static/js/app.js
index 00ea620b..ea879877 100644
--- a/static/js/app.js
+++ b/static/js/app.js
@@ -91,8 +91,9 @@ document.addEventListener('DOMContentLoaded', () => {
const isResizingMainColumns = ref(false);
let initialMainColumnResizeX = 0;
let initialLeftMainColumnWidthPx = 0;
- const MIN_MAIN_COLUMN_WIDTH_PERCENT = 20; // Min width for left column
- const MAX_MAIN_COLUMN_WIDTH_PERCENT = 75; // Max width for left column
+ const MIN_MAIN_COLUMN_WIDTH_PERCENT = 30; // Min width for left column
+ const MAX_MAIN_COLUMN_WIDTH_PERCENT = 70; // Max width for left column (ensures right column gets at least 20%)
+ const ABSOLUTE_MIN_COLUMN_PX = 50; // Absolute minimum pixel width for either column
// --- Vertical Resize State ---
const transcriptionSection = ref(null);
@@ -418,6 +419,19 @@ document.addEventListener('DOMContentLoaded', () => {
if (!isMobileScreen.value) {
isSidebarCollapsed.value = !isSidebarCollapsed.value;
// localStorage.setItem('sidebarCollapsed', isSidebarCollapsed.value);
+
+ // Ensure main content layout is preserved after sidebar toggle
+ nextTick(() => {
+ // Re-initialize layout if needed to maintain column widths
+ if (leftMainColumn.value && mainContentColumns.value) {
+ // Preserve the current column width percentage
+ const currentWidth = leftMainColumn.value.style.width;
+ if (currentWidth) {
+ // Force a layout recalculation to ensure the resizer still works
+ leftMainColumn.value.style.width = currentWidth;
+ }
+ }
+ });
}
};
@@ -1190,17 +1204,19 @@ document.addEventListener('DOMContentLoaded', () => {
const savedLeftWidthPercent = localStorage.getItem('mainColumnLeftWidthPercent');
if (savedLeftWidthPercent) {
const percent = parseFloat(savedLeftWidthPercent);
+ // Validate against the new percentage-based constraints
if (percent >= MIN_MAIN_COLUMN_WIDTH_PERCENT && percent <= MAX_MAIN_COLUMN_WIDTH_PERCENT) {
leftMainColumn.value.style.width = `${percent}%`;
} else {
- // If stored value is out of bounds, apply default
- leftMainColumn.value.style.width = '40%'; // Default
+ // If stored value is out of bounds, apply default within valid range
+ const defaultPercent = Math.max(MIN_MAIN_COLUMN_WIDTH_PERCENT, Math.min(40, MAX_MAIN_COLUMN_WIDTH_PERCENT));
+ leftMainColumn.value.style.width = `${defaultPercent}%`;
localStorage.removeItem('mainColumnLeftWidthPercent'); // Clear invalid stored value
}
} else if (leftMainColumn.value.style.width === '') {
- // If no saved width and no inline style, set default.
- // HTML already has 40%, but this is a fallback.
- leftMainColumn.value.style.width = '40%';
+ // If no saved width and no inline style, set default within valid range
+ const defaultPercent = Math.max(MIN_MAIN_COLUMN_WIDTH_PERCENT, Math.min(40, MAX_MAIN_COLUMN_WIDTH_PERCENT));
+ leftMainColumn.value.style.width = `${defaultPercent}%`;
}
};
@@ -1233,25 +1249,34 @@ document.addEventListener('DOMContentLoaded', () => {
if (!isResizingMainColumns.value || !leftMainColumn.value || !mainContentColumns.value || !mainColumnResizer.value) return;
const dx = event.clientX - initialMainColumnResizeX;
- let newLeftWidthPx = initialLeftMainColumnWidthPx + dx;
-
- const parentWidthPx = mainContentColumns.value.offsetWidth;
+
+ // Get CURRENT parent width (not cached) to handle sidebar state changes
+ const currentParentWidthPx = mainContentColumns.value.offsetWidth;
const resizerActualWidth = mainColumnResizer.value.offsetWidth;
- const resizerMarginLeft = parseFloat(getComputedStyle(mainColumnResizer.value).marginLeft);
- const resizerMarginRight = parseFloat(getComputedStyle(mainColumnResizer.value).marginRight);
+ const resizerMarginLeft = parseFloat(getComputedStyle(mainColumnResizer.value).marginLeft) || 0;
+ const resizerMarginRight = parseFloat(getComputedStyle(mainColumnResizer.value).marginRight) || 0;
const resizerTotalSpacePx = resizerActualWidth + resizerMarginLeft + resizerMarginRight;
- const effectiveParentWidthPx = parentWidthPx - resizerTotalSpacePx;
+ const currentEffectiveParentWidthPx = currentParentWidthPx - resizerTotalSpacePx;
- if (effectiveParentWidthPx <= 0) return; // Guard against division by zero or invalid state
+ if (currentEffectiveParentWidthPx <= 0) return; // Guard against division by zero or invalid state
- // Calculate pixel constraints
- const minLeftPx = (MIN_MAIN_COLUMN_WIDTH_PERCENT / 100) * effectiveParentWidthPx;
- const maxLeftPx = (MAX_MAIN_COLUMN_WIDTH_PERCENT / 100) * effectiveParentWidthPx;
+ // Calculate new width based on mouse movement
+ let newLeftWidthPx = initialLeftMainColumnWidthPx + dx;
+
+ // Apply constraints smoothly - use pixel-based constraints for better control
+ const minLeftPx = Math.max(ABSOLUTE_MIN_COLUMN_PX, (MIN_MAIN_COLUMN_WIDTH_PERCENT / 100) * currentEffectiveParentWidthPx);
+ const maxLeftPx = Math.min(currentEffectiveParentWidthPx - ABSOLUTE_MIN_COLUMN_PX, (MAX_MAIN_COLUMN_WIDTH_PERCENT / 100) * currentEffectiveParentWidthPx);
- newLeftWidthPx = Math.max(minLeftPx, Math.min(maxLeftPx, newLeftWidthPx));
+ // Smooth constraint application - don't snap to limits immediately
+ if (newLeftWidthPx < minLeftPx) {
+ newLeftWidthPx = minLeftPx;
+ } else if (newLeftWidthPx > maxLeftPx) {
+ newLeftWidthPx = maxLeftPx;
+ }
- const newLeftWidthPercent = (newLeftWidthPx / effectiveParentWidthPx) * 100;
+ // Calculate percentage based on CURRENT effective width
+ const newLeftWidthPercent = (newLeftWidthPx / currentEffectiveParentWidthPx) * 100;
leftMainColumn.value.style.width = `${newLeftWidthPercent.toFixed(2)}%`;
};
diff --git a/templates/index.html b/templates/index.html
index 74b38068..b1518a71 100644
--- a/templates/index.html
+++ b/templates/index.html
@@ -891,7 +891,7 @@
<!-- Main content area with flex layout -->
<div id="mainContentColumns" class="flex flex-col md:flex-row flex-grow overflow-y-auto" style="max-height: 75vh;">
<!-- Left Column: Participants, Transcription, Summary & Notes -->
- <div id="leftMainColumn" class="content-column left-content md:flex-shrink-0" style="width: 40%;">
+ <div id="leftMainColumn" class="content-column left-content" style="width: 40%;">
<!-- Participants Section -->
<div class="participants-section">
<div class="flex justify-between items-center mb-1">