Speakr is a personal, self-hosted web application designed for transcribing audio recordings
Python
fixed context length issues
Murtaza Nasirfa9c9add99ff
diff --git a/.env.example b/.env.exampleindex e010d738..ea0f5505 100644--- a/.env.example+++ b/.env.example@@ -15,6 +15,10 @@ WHISPER_MODEL="Systran/faster-distil-whisper-large-v3"# Set to "false" to disable new account registrationALLOW_REGISTRATION="false"+# Max tokens for LLM responses (optional, defaults are set in app.py)+SUMMARY_MAX_TOKENS="8000"+CHAT_MAX_TOKENS="5000"+# Models# openai/gpt-4o-mini# google/gemma-3-27b-itdiff --git a/.gitignore b/.gitignoreindex 3d9d256c..cba066d5 100644--- a/.gitignore+++ b/.gitignore@@ -12,4 +12,5 @@ __pycache__/project_files.md*.mdnotes.md-docker-compose.yml\ No newline at end of file+docker-compose.yml+changes.txtdiff --git a/app.py b/app.pyindex 9478d41c..048a5ff7 100644--- a/app.py+++ b/app.py@@ -390,7 +390,7 @@ JSON Response:"""{"role": "user", "content": prompt_text}],temperature=0.5, # Adjust temperature as needed- max_tokens=300, # Adjust based on expected title+summary length+ max_tokens=int(os.environ.get("SUMMARY_MAX_TOKENS", "3000")), # Adjust based on expected title+summary lengthresponse_format={"type": "json_object"} # Request JSON output)@@ -565,7 +565,7 @@ Additional context and notes about the meeting:model=TEXT_MODEL_NAME,messages=messages,temperature=0.7,- max_tokens=1000+ max_tokens=int(os.environ.get("CHAT_MAX_TOKENS", "2000")))response_content = completion.choices[0].message.contentdiff --git a/docker-compose.example.yml b/docker-compose.example.ymlindex 361d9716..c7207625 100644--- a/docker-compose.example.yml+++ b/docker-compose.example.yml@@ -41,6 +41,8 @@ services:# 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=admindiff --git a/readme.md b/readme.mdindex 47538274..ef6efe08 100644--- a/readme.md+++ b/readme.md@@ -364,6 +364,8 @@ Configuration is primarily handled through environment variables in the `docker-* `TRANSCRIPTION_BASE_URL`: **Required.** The base URL for your transcription API endpoint (e.g., `http://localhost:8787/v1/`).* `TRANSCRIPTION_API_KEY`: **Required.** Your API key for the transcription endpoint. For local endpoints, this might be a specific string like "none" or "NA". Check your endpoint's documentation.* `WHISPER_MODEL`: *Optional.* The specific model name your transcription endpoint uses/expects (e.g., `Systran/faster-distil-whisper-large-v3`). Check your endpoint's requirements.+* `SUMMARY_MAX_TOKENS`: *Optional.* The maximum number of tokens for the title and summary generation. Defaults to `3000`.+* `CHAT_MAX_TOKENS`: *Optional.* The maximum number of tokens for chat responses. Defaults to `2000`.* `SECRET_KEY`: **Required.** A long, random string used by Flask for session security. The `setup.sh` script generates one if it's missing.* `ALLOW_REGISTRATION`: *Optional.* Set to `false` to prevent new users from registering via the web UI. Defaults to `true`.