├── .dockerignore ├── .env.example ├── .github └── workflows │ └── docker-publish.yml ├── .gitignore ├── Dockerfile ├── LICENSE ├── app.py ├── create_admin.py ├── create_docs.py ├── deployment └── setup.sh ├── docker-compose.example.yml ├── docker-compose.override.yml.example ├── docker-entrypoint.sh ├── docker_create_admin.py ├── readme.md ├── requirements.txt ├── reset_db.py ├── static ├── css │ └── styles.css ├── img │ └── favicon.svg ├── js │ └── app.js ├── manifest.json ├── offline.html └── sw.js └── templates ├── account.html ├── admin.html ├── index.html ├── login.html └── register.html /.dockerignore: -------------------------------------------------------------------------------- 1 | # Git 2 | .git 3 | .gitignore 4 | 5 | # Docker 6 | .dockerignore 7 | Dockerfile 8 | docker-compose.yml 9 | docker-compose.override.yml 10 | docker-compose.override.yml.example 11 | 12 | # Python 13 | __pycache__/ 14 | *.py[cod] 15 | *$py.class 16 | *.so 17 | .Python 18 | env/ 19 | build/ 20 | develop-eggs/ 21 | dist/ 22 | downloads/ 23 | eggs/ 24 | .eggs/ 25 | lib/ 26 | lib64/ 27 | parts/ 28 | sdist/ 29 | var/ 30 | *.egg-info/ 31 | .installed.cfg 32 | *.egg 33 | venv/ 34 | .venv/ 35 | 36 | # Data directories (these will be mounted as volumes) 37 | data/ 38 | uploads/ 39 | instance/ 40 | 41 | # IDE files 42 | .idea/ 43 | .vscode/ 44 | *.swp 45 | *.swo 46 | 47 | # Logs 48 | *.log 49 | -------------------------------------------------------------------------------- /.env.example: -------------------------------------------------------------------------------- 1 | # .env 2 | 3 | TEXT_MODEL_BASE_URL=https://openrouter.ai/api/v1 4 | TEXT_MODEL_API_KEY=your_text_model_api_key_here 5 | # Choose a model compatible with function calling / JSON mode 6 | # Example: "openai/gpt-4o-mini" or "google/gemma-3-27b-it" are good if using openrouter 7 | TEXT_MODEL_NAME="openai/gpt-4o-mini" 8 | 9 | # Whisper Model Configuration 10 | TRANSCRIPTION_BASE_URL=http://your_local_api_url:port/v1/ 11 | TRANSCRIPTION_API_KEY=your_transcription_api_key_here 12 | WHISPER_MODEL="Systran/faster-distil-whisper-large-v3" 13 | 14 | # Application Settings 15 | # Set to "false" to disable new account registration 16 | ALLOW_REGISTRATION="false" 17 | 18 | # Max tokens for LLM responses (optional, defaults are set in app.py) 19 | SUMMARY_MAX_TOKENS="8000" 20 | CHAT_MAX_TOKENS="5000" 21 | 22 | # Models 23 | # openai/gpt-4o-mini 24 | # google/gemma-3-27b-it 25 | -------------------------------------------------------------------------------- /.github/workflows/docker-publish.yml: -------------------------------------------------------------------------------- 1 | name: Docker Build and Publish 2 | 3 | on: 4 | push: 5 | branches: [ "master" ] 6 | tags: [ 'v*.*.*' ] 7 | pull_request: 8 | branches: [ "master" ] 9 | 10 | env: 11 | # Use docker.io for Docker Hub if empty 12 | REGISTRY: docker.io 13 | # Use explicit image name instead of github.repository 14 | IMAGE_NAME: learnedmachine/speakr 15 | 16 | jobs: 17 | build: 18 | runs-on: ubuntu-latest 19 | permissions: 20 | contents: read 21 | packages: write 22 | # This is used to complete the identity challenge 23 | # with sigstore/fulcio when running outside of PRs. 24 | id-token: write 25 | 26 | steps: 27 | - name: Checkout repository 28 | uses: actions/checkout@v3 29 | 30 | # Set up Docker Buildx 31 | - name: Set up Docker Buildx 32 | uses: docker/setup-buildx-action@v2 33 | 34 | # Login to Docker Hub 35 | - name: Log into registry ${{ env.REGISTRY }} 36 | if: github.event_name != 'pull_request' 37 | uses: docker/login-action@v2 38 | with: 39 | registry: ${{ env.REGISTRY }} 40 | username: ${{ secrets.DOCKERHUB_USERNAME }} 41 | password: ${{ secrets.DOCKERHUB_TOKEN }} 42 | 43 | # Extract metadata (tags, labels) for Docker 44 | - name: Extract Docker metadata 45 | id: meta 46 | uses: docker/metadata-action@v4 47 | with: 48 | images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} 49 | tags: | 50 | type=ref,event=branch 51 | type=ref,event=pr 52 | type=semver,pattern={{version}} 53 | type=semver,pattern={{major}}.{{minor}} 54 | type=sha 55 | type=raw,value=latest,enable={{is_default_branch}} 56 | 57 | # Build and push Docker image 58 | - name: Build and push Docker image 59 | id: build-and-push 60 | uses: docker/build-push-action@v4 61 | with: 62 | context: . 63 | push: ${{ github.event_name != 'pull_request' }} 64 | tags: ${{ steps.meta.outputs.tags }} 65 | labels: ${{ steps.meta.outputs.labels }} 66 | cache-from: type=gha 67 | cache-to: type=gha,mode=max 68 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | venv/ 2 | __pycache__/ 3 | instance/ 4 | uploads/ 5 | *.db 6 | *.db-journal 7 | __pycache__/ 8 | *.pyc 9 | *.log 10 | .env 11 | .migrate/ 12 | project_files.md 13 | *.md 14 | notes.md 15 | docker-compose.yml 16 | changes.txt 17 | -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | FROM python:3.11-slim 2 | 3 | WORKDIR /app 4 | 5 | # Install system dependencies 6 | RUN apt-get update && apt-get install -y --no-install-recommends \ 7 | gcc \ 8 | && rm -rf /var/lib/apt/lists/* 9 | 10 | # Copy requirements first for better caching 11 | COPY requirements.txt . 12 | RUN pip install --no-cache-dir -r requirements.txt 13 | 14 | # Copy application code 15 | COPY . . 16 | 17 | # Create necessary directories 18 | RUN mkdir -p /data/uploads /data/instance 19 | RUN chmod 755 /data/uploads /data/instance 20 | 21 | # Set environment variables 22 | ENV FLASK_APP=app.py 23 | ENV SQLALCHEMY_DATABASE_URI=sqlite:////data/instance/transcriptions.db 24 | ENV UPLOAD_FOLDER=/data/uploads 25 | 26 | # Add entrypoint script 27 | COPY docker-entrypoint.sh /usr/local/bin/ 28 | RUN chmod +x /usr/local/bin/docker-entrypoint.sh 29 | 30 | # Expose the port 31 | EXPOSE 8899 32 | 33 | # Set entrypoint and default command 34 | ENTRYPOINT ["docker-entrypoint.sh"] 35 | CMD ["gunicorn", "--workers", "3", "--bind", "0.0.0.0:8899", "--timeout", "600", "app:app"] 36 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | GNU AFFERO GENERAL PUBLIC LICENSE 2 | Version 3, 19 November 2007 3 | 4 | Copyright (C) 2007 Free Software Foundation, Inc. 5 | Everyone is permitted to copy and distribute verbatim copies 6 | of this license document, but changing it is not allowed. 7 | 8 | Preamble 9 | 10 | The GNU Affero General Public License is a free, copyleft license for 11 | software and other kinds of works, specifically designed to ensure 12 | cooperation with the community in the case of network server software. 13 | 14 | The licenses for most software and other practical works are designed 15 | to take away your freedom to share and change the works. By contrast, 16 | our General Public Licenses are intended to guarantee your freedom to 17 | share and change all versions of a program--to make sure it remains free 18 | software for all its users. 19 | 20 | When we speak of free software, we are referring to freedom, not 21 | price. Our General Public Licenses are designed to make sure that you 22 | have the freedom to distribute copies of free software (and charge for 23 | them if you wish), that you receive source code or can get it if you 24 | want it, that you can change the software or use pieces of it in new 25 | free programs, and that you know you can do these things. 26 | 27 | Developers that use our General Public Licenses protect your rights 28 | with two steps: (1) assert copyright on the software, and (2) offer 29 | you this License which gives you legal permission to copy, distribute 30 | and/or modify the software. 31 | 32 | A secondary benefit of defending all users' freedom is that 33 | improvements made in alternate versions of the program, if they 34 | receive widespread use, become available for other developers to 35 | incorporate. Many developers of free software are heartened and 36 | encouraged by the resulting cooperation. However, in the case of 37 | software used on network servers, this result may fail to come about. 38 | The GNU General Public License permits making a modified version and 39 | letting the public access it on a server without ever releasing its 40 | source code to the public. 41 | 42 | The GNU Affero General Public License is designed specifically to 43 | ensure that, in such cases, the modified source code becomes available 44 | to the community. It requires the operator of a network server to 45 | provide the source code of the modified version running there to the 46 | users of that server. Therefore, public use of a modified version, on 47 | a publicly accessible server, gives the public access to the source 48 | code of the modified version. 49 | 50 | An older license, called the Affero General Public License and 51 | published by Affero, was designed to accomplish similar goals. This is 52 | a different license, not a version of the Affero GPL, but Affero has 53 | released a new version of the Affero GPL which permits relicensing under 54 | this license. 55 | 56 | The precise terms and conditions for copying, distribution and 57 | modification follow. 58 | 59 | TERMS AND CONDITIONS 60 | 61 | 0. Definitions. 62 | 63 | "This License" refers to version 3 of the GNU Affero General Public License. 64 | 65 | "Copyright" also means copyright-like laws that apply to other kinds of 66 | works, such as semiconductor masks. 67 | 68 | "The Program" refers to any copyrightable work licensed under this 69 | License. Each licensee is addressed as "you". "Licensees" and 70 | "recipients" may be individuals or organizations. 71 | 72 | To "modify" a work means to copy from or adapt all or part of the work 73 | in a fashion requiring copyright permission, other than the making of an 74 | exact copy. The resulting work is called a "modified version" of the 75 | earlier work or a work "based on" the earlier work. 76 | 77 | A "covered work" means either the unmodified Program or a work based 78 | on the Program. 79 | 80 | To "propagate" a work means to do anything with it that, without 81 | permission, would make you directly or secondarily liable for 82 | infringement under applicable copyright law, except executing it on a 83 | computer or modifying a private copy. Propagation includes copying, 84 | distribution (with or without modification), making available to the 85 | public, and in some countries other activities as well. 86 | 87 | To "convey" a work means any kind of propagation that enables other 88 | parties to make or receive copies. Mere interaction with a user through 89 | a computer network, with no transfer of a copy, is not conveying. 90 | 91 | An interactive user interface displays "Appropriate Legal Notices" 92 | to the extent that it includes a convenient and prominently visible 93 | feature that (1) displays an appropriate copyright notice, and (2) 94 | tells the user that there is no warranty for the work (except to the 95 | extent that warranties are provided), that licensees may convey the 96 | work under this License, and how to view a copy of this License. If 97 | the interface presents a list of user commands or options, such as a 98 | menu, a prominent item in the list meets this criterion. 99 | 100 | 1. Source Code. 101 | 102 | The "source code" for a work means the preferred form of the work 103 | for making modifications to it. "Object code" means any non-source 104 | form of a work. 105 | 106 | A "Standard Interface" means an interface that either is an official 107 | standard defined by a recognized standards body, or, in the case of 108 | interfaces specified for a particular programming language, one that 109 | is widely used among developers working in that language. 110 | 111 | The "System Libraries" of an executable work include anything, other 112 | than the work as a whole, that (a) is included in the normal form of 113 | packaging a Major Component, but which is not part of that Major 114 | Component, and (b) serves only to enable use of the work with that 115 | Major Component, or to implement a Standard Interface for which an 116 | implementation is available to the public in source code form. A 117 | "Major Component", in this context, means a major essential component 118 | (kernel, window system, and so on) of the specific operating system 119 | (if any) on which the executable work runs, or a compiler used to 120 | produce the work, or an object code interpreter used to run it. 121 | 122 | The "Corresponding Source" for a work in object code form means all 123 | the source code needed to generate, install, and (for an executable 124 | work) run the object code and to modify the work, including scripts to 125 | control those activities. However, it does not include the work's 126 | System Libraries, or general-purpose tools or generally available free 127 | programs which are used unmodified in performing those activities but 128 | which are not part of the work. For example, Corresponding Source 129 | includes interface definition files associated with source files for 130 | the work, and the source code for shared libraries and dynamically 131 | linked subprograms that the work is specifically designed to require, 132 | such as by intimate data communication or control flow between those 133 | subprograms and other parts of the work. 134 | 135 | The Corresponding Source need not include anything that users 136 | can regenerate automatically from other parts of the Corresponding 137 | Source. 138 | 139 | The Corresponding Source for a work in source code form is that 140 | same work. 141 | 142 | 2. Basic Permissions. 143 | 144 | All rights granted under this License are granted for the term of 145 | copyright on the Program, and are irrevocable provided the stated 146 | conditions are met. This License explicitly affirms your unlimited 147 | permission to run the unmodified Program. The output from running a 148 | covered work is covered by this License only if the output, given its 149 | content, constitutes a covered work. This License acknowledges your 150 | rights of fair use or other equivalent, as provided by copyright law. 151 | 152 | You may make, run and propagate covered works that you do not 153 | convey, without conditions so long as your license otherwise remains 154 | in force. You may convey covered works to others for the sole purpose 155 | of having them make modifications exclusively for you, or provide you 156 | with facilities for running those works, provided that you comply with 157 | the terms of this License in conveying all material for which you do 158 | not control copyright. Those thus making or running the covered works 159 | for you must do so exclusively on your behalf, under your direction 160 | and control, on terms that prohibit them from making any copies of 161 | your copyrighted material outside their relationship with you. 162 | 163 | Conveying under any other circumstances is permitted solely under 164 | the conditions stated below. Sublicensing is not allowed; section 10 165 | makes it unnecessary. 166 | 167 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law. 168 | 169 | No covered work shall be deemed part of an effective technological 170 | measure under any applicable law fulfilling obligations under article 171 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or 172 | similar laws prohibiting or restricting circumvention of such 173 | measures. 174 | 175 | When you convey a covered work, you waive any legal power to forbid 176 | circumvention of technological measures to the extent such circumvention 177 | is effected by exercising rights under this License with respect to 178 | the covered work, and you disclaim any intention to limit operation or 179 | modification of the work as a means of enforcing, against the work's 180 | users, your or third parties' legal rights to forbid circumvention of 181 | technological measures. 182 | 183 | 4. Conveying Verbatim Copies. 184 | 185 | You may convey verbatim copies of the Program's source code as you 186 | receive it, in any medium, provided that you conspicuously and 187 | appropriately publish on each copy an appropriate copyright notice; 188 | keep intact all notices stating that this License and any 189 | non-permissive terms added in accord with section 7 apply to the code; 190 | keep intact all notices of the absence of any warranty; and give all 191 | recipients a copy of this License along with the Program. 192 | 193 | You may charge any price or no price for each copy that you convey, 194 | and you may offer support or warranty protection for a fee. 195 | 196 | 5. Conveying Modified Source Versions. 197 | 198 | You may convey a work based on the Program, or the modifications to 199 | produce it from the Program, in the form of source code under the 200 | terms of section 4, provided that you also meet all of these conditions: 201 | 202 | a) The work must carry prominent notices stating that you modified 203 | it, and giving a relevant date. 204 | 205 | b) The work must carry prominent notices stating that it is 206 | released under this License and any conditions added under section 207 | 7. This requirement modifies the requirement in section 4 to 208 | "keep intact all notices". 209 | 210 | c) You must license the entire work, as a whole, under this 211 | License to anyone who comes into possession of a copy. This 212 | License will therefore apply, along with any applicable section 7 213 | additional terms, to the whole of the work, and all its parts, 214 | regardless of how they are packaged. This License gives no 215 | permission to license the work in any other way, but it does not 216 | invalidate such permission if you have separately received it. 217 | 218 | d) If the work has interactive user interfaces, each must display 219 | Appropriate Legal Notices; however, if the Program has interactive 220 | interfaces that do not display Appropriate Legal Notices, your 221 | work need not make them do so. 222 | 223 | A compilation of a covered work with other separate and independent 224 | works, which are not by their nature extensions of the covered work, 225 | and which are not combined with it such as to form a larger program, 226 | in or on a volume of a storage or distribution medium, is called an 227 | "aggregate" if the compilation and its resulting copyright are not 228 | used to limit the access or legal rights of the compilation's users 229 | beyond what the individual works permit. Inclusion of a covered work 230 | in an aggregate does not cause this License to apply to the other 231 | parts of the aggregate. 232 | 233 | 6. Conveying Non-Source Forms. 234 | 235 | You may convey a covered work in object code form under the terms 236 | of sections 4 and 5, provided that you also convey the 237 | machine-readable Corresponding Source under the terms of this License, 238 | in one of these ways: 239 | 240 | a) Convey the object code in, or embodied in, a physical product 241 | (including a physical distribution medium), accompanied by the 242 | Corresponding Source fixed on a durable physical medium 243 | customarily used for software interchange. 244 | 245 | b) Convey the object code in, or embodied in, a physical product 246 | (including a physical distribution medium), accompanied by a 247 | written offer, valid for at least three years and valid for as 248 | long as you offer spare parts or customer support for that product 249 | model, to give anyone who possesses the object code either (1) a 250 | copy of the Corresponding Source for all the software in the 251 | product that is covered by this License, on a durable physical 252 | medium customarily used for software interchange, for a price no 253 | more than your reasonable cost of physically performing this 254 | conveying of source, or (2) access to copy the 255 | Corresponding Source from a network server at no charge. 256 | 257 | c) Convey individual copies of the object code with a copy of the 258 | written offer to provide the Corresponding Source. This 259 | alternative is allowed only occasionally and noncommercially, and 260 | only if you received the object code with such an offer, in accord 261 | with subsection 6b. 262 | 263 | d) Convey the object code by offering access from a designated 264 | place (gratis or for a charge), and offer equivalent access to the 265 | Corresponding Source in the same way through the same place at no 266 | further charge. You need not require recipients to copy the 267 | Corresponding Source along with the object code. If the place to 268 | copy the object code is a network server, the Corresponding Source 269 | may be on a different server (operated by you or a third party) 270 | that supports equivalent copying facilities, provided you maintain 271 | clear directions next to the object code saying where to find the 272 | Corresponding Source. Regardless of what server hosts the 273 | Corresponding Source, you remain obligated to ensure that it is 274 | available for as long as needed to satisfy these requirements. 275 | 276 | e) Convey the object code using peer-to-peer transmission, provided 277 | you inform other peers where the object code and Corresponding 278 | Source of the work are being offered to the general public at no 279 | charge under subsection 6d. 280 | 281 | A separable portion of the object code, whose source code is excluded 282 | from the Corresponding Source as a System Library, need not be 283 | included in conveying the object code work. 284 | 285 | A "User Product" is either (1) a "consumer product", which means any 286 | tangible personal property which is normally used for personal, family, 287 | or household purposes, or (2) anything designed or sold for incorporation 288 | into a dwelling. In determining whether a product is a consumer product, 289 | doubtful cases shall be resolved in favor of coverage. For a particular 290 | product received by a particular user, "normally used" refers to a 291 | typical or common use of that class of product, regardless of the status 292 | of the particular user or of the way in which the particular user 293 | actually uses, or expects or is expected to use, the product. A product 294 | is a consumer product regardless of whether the product has substantial 295 | commercial, industrial or non-consumer uses, unless such uses represent 296 | the only significant mode of use of the product. 297 | 298 | "Installation Information" for a User Product means any methods, 299 | procedures, authorization keys, or other information required to install 300 | and execute modified versions of a covered work in that User Product from 301 | a modified version of its Corresponding Source. The information must 302 | suffice to ensure that the continued functioning of the modified object 303 | code is in no case prevented or interfered with solely because 304 | modification has been made. 305 | 306 | If you convey an object code work under this section in, or with, or 307 | specifically for use in, a User Product, and the conveying occurs as 308 | part of a transaction in which the right of possession and use of the 309 | User Product is transferred to the recipient in perpetuity or for a 310 | fixed term (regardless of how the transaction is characterized), the 311 | Corresponding Source conveyed under this section must be accompanied 312 | by the Installation Information. But this requirement does not apply 313 | if neither you nor any third party retains the ability to install 314 | modified object code on the User Product (for example, the work has 315 | been installed in ROM). 316 | 317 | The requirement to provide Installation Information does not include a 318 | requirement to continue to provide support service, warranty, or updates 319 | for a work that has been modified or installed by the recipient, or for 320 | the User Product in which it has been modified or installed. Access to a 321 | network may be denied when the modification itself materially and 322 | adversely affects the operation of the network or violates the rules and 323 | protocols for communication across the network. 324 | 325 | Corresponding Source conveyed, and Installation Information provided, 326 | in accord with this section must be in a format that is publicly 327 | documented (and with an implementation available to the public in 328 | source code form), and must require no special password or key for 329 | unpacking, reading or copying. 330 | 331 | 7. Additional Terms. 332 | 333 | "Additional permissions" are terms that supplement the terms of this 334 | License by making exceptions from one or more of its conditions. 335 | Additional permissions that are applicable to the entire Program shall 336 | be treated as though they were included in this License, to the extent 337 | that they are valid under applicable law. If additional permissions 338 | apply only to part of the Program, that part may be used separately 339 | under those permissions, but the entire Program remains governed by 340 | this License without regard to the additional permissions. 341 | 342 | When you convey a copy of a covered work, you may at your option 343 | remove any additional permissions from that copy, or from any part of 344 | it. (Additional permissions may be written to require their own 345 | removal in certain cases when you modify the work.) You may place 346 | additional permissions on material, added by you to a covered work, 347 | for which you have or can give appropriate copyright permission. 348 | 349 | Notwithstanding any other provision of this License, for material you 350 | add to a covered work, you may (if authorized by the copyright holders of 351 | that material) supplement the terms of this License with terms: 352 | 353 | a) Disclaiming warranty or limiting liability differently from the 354 | terms of sections 15 and 16 of this License; or 355 | 356 | b) Requiring preservation of specified reasonable legal notices or 357 | author attributions in that material or in the Appropriate Legal 358 | Notices displayed by works containing it; or 359 | 360 | c) Prohibiting misrepresentation of the origin of that material, or 361 | requiring that modified versions of such material be marked in 362 | reasonable ways as different from the original version; or 363 | 364 | d) Limiting the use for publicity purposes of names of licensors or 365 | authors of the material; or 366 | 367 | e) Declining to grant rights under trademark law for use of some 368 | trade names, trademarks, or service marks; or 369 | 370 | f) Requiring indemnification of licensors and authors of that 371 | material by anyone who conveys the material (or modified versions of 372 | it) with contractual assumptions of liability to the recipient, for 373 | any liability that these contractual assumptions directly impose on 374 | those licensors and authors. 375 | 376 | All other non-permissive additional terms are considered "further 377 | restrictions" within the meaning of section 10. If the Program as you 378 | received it, or any part of it, contains a notice stating that it is 379 | governed by this License along with a term that is a further 380 | restriction, you may remove that term. If a license document contains 381 | a further restriction but permits relicensing or conveying under this 382 | License, you may add to a covered work material governed by the terms 383 | of that license document, provided that the further restriction does 384 | not survive such relicensing or conveying. 385 | 386 | If you add terms to a covered work in accord with this section, you 387 | must place, in the relevant source files, a statement of the 388 | additional terms that apply to those files, or a notice indicating 389 | where to find the applicable terms. 390 | 391 | Additional terms, permissive or non-permissive, may be stated in the 392 | form of a separately written license, or stated as exceptions; 393 | the above requirements apply either way. 394 | 395 | 8. Termination. 396 | 397 | You may not propagate or modify a covered work except as expressly 398 | provided under this License. Any attempt otherwise to propagate or 399 | modify it is void, and will automatically terminate your rights under 400 | this License (including any patent licenses granted under the third 401 | paragraph of section 11). 402 | 403 | However, if you cease all violation of this License, then your 404 | license from a particular copyright holder is reinstated (a) 405 | provisionally, unless and until the copyright holder explicitly and 406 | finally terminates your license, and (b) permanently, if the copyright 407 | holder fails to notify you of the violation by some reasonable means 408 | prior to 60 days after the cessation. 409 | 410 | Moreover, your license from a particular copyright holder is 411 | reinstated permanently if the copyright holder notifies you of the 412 | violation by some reasonable means, this is the first time you have 413 | received notice of violation of this License (for any work) from that 414 | copyright holder, and you cure the violation prior to 30 days after 415 | your receipt of the notice. 416 | 417 | Termination of your rights under this section does not terminate the 418 | licenses of parties who have received copies or rights from you under 419 | this License. If your rights have been terminated and not permanently 420 | reinstated, you do not qualify to receive new licenses for the same 421 | material under section 10. 422 | 423 | 9. Acceptance Not Required for Having Copies. 424 | 425 | You are not required to accept this License in order to receive or 426 | run a copy of the Program. Ancillary propagation of a covered work 427 | occurring solely as a consequence of using peer-to-peer transmission 428 | to receive a copy likewise does not require acceptance. However, 429 | nothing other than this License grants you permission to propagate or 430 | modify any covered work. These actions infringe copyright if you do 431 | not accept this License. Therefore, by modifying or propagating a 432 | covered work, you indicate your acceptance of this License to do so. 433 | 434 | 10. Automatic Licensing of Downstream Recipients. 435 | 436 | Each time you convey a covered work, the recipient automatically 437 | receives a license from the original licensors, to run, modify and 438 | propagate that work, subject to this License. You are not responsible 439 | for enforcing compliance by third parties with this License. 440 | 441 | An "entity transaction" is a transaction transferring control of an 442 | organization, or substantially all assets of one, or subdividing an 443 | organization, or merging organizations. If propagation of a covered 444 | work results from an entity transaction, each party to that 445 | transaction who receives a copy of the work also receives whatever 446 | licenses to the work the party's predecessor in interest had or could 447 | give under the previous paragraph, plus a right to possession of the 448 | Corresponding Source of the work from the predecessor in interest, if 449 | the predecessor has it or can get it with reasonable efforts. 450 | 451 | You may not impose any further restrictions on the exercise of the 452 | rights granted or affirmed under this License. For example, you may 453 | not impose a license fee, royalty, or other charge for exercise of 454 | rights granted under this License, and you may not initiate litigation 455 | (including a cross-claim or counterclaim in a lawsuit) alleging that 456 | any patent claim is infringed by making, using, selling, offering for 457 | sale, or importing the Program or any portion of it. 458 | 459 | 11. Patents. 460 | 461 | A "contributor" is a copyright holder who authorizes use under this 462 | License of the Program or a work on which the Program is based. The 463 | work thus licensed is called the contributor's "contributor version". 464 | 465 | A contributor's "essential patent claims" are all patent claims 466 | owned or controlled by the contributor, whether already acquired or 467 | hereafter acquired, that would be infringed by some manner, permitted 468 | by this License, of making, using, or selling its contributor version, 469 | but do not include claims that would be infringed only as a 470 | consequence of further modification of the contributor version. For 471 | purposes of this definition, "control" includes the right to grant 472 | patent sublicenses in a manner consistent with the requirements of 473 | this License. 474 | 475 | Each contributor grants you a non-exclusive, worldwide, royalty-free 476 | patent license under the contributor's essential patent claims, to 477 | make, use, sell, offer for sale, import and otherwise run, modify and 478 | propagate the contents of its contributor version. 479 | 480 | In the following three paragraphs, a "patent license" is any express 481 | agreement or commitment, however denominated, not to enforce a patent 482 | (such as an express permission to practice a patent or covenant not to 483 | sue for patent infringement). To "grant" such a patent license to a 484 | party means to make such an agreement or commitment not to enforce a 485 | patent against the party. 486 | 487 | If you convey a covered work, knowingly relying on a patent license, 488 | and the Corresponding Source of the work is not available for anyone 489 | to copy, free of charge and under the terms of this License, through a 490 | publicly available network server or other readily accessible means, 491 | then you must either (1) cause the Corresponding Source to be so 492 | available, or (2) arrange to deprive yourself of the benefit of the 493 | patent license for this particular work, or (3) arrange, in a manner 494 | consistent with the requirements of this License, to extend the patent 495 | license to downstream recipients. "Knowingly relying" means you have 496 | actual knowledge that, but for the patent license, your conveying the 497 | covered work in a country, or your recipient's use of the covered work 498 | in a country, would infringe one or more identifiable patents in that 499 | country that you have reason to believe are valid. 500 | 501 | If, pursuant to or in connection with a single transaction or 502 | arrangement, you convey, or propagate by procuring conveyance of, a 503 | covered work, and grant a patent license to some of the parties 504 | receiving the covered work authorizing them to use, propagate, modify 505 | or convey a specific copy of the covered work, then the patent license 506 | you grant is automatically extended to all recipients of the covered 507 | work and works based on it. 508 | 509 | A patent license is "discriminatory" if it does not include within 510 | the scope of its coverage, prohibits the exercise of, or is 511 | conditioned on the non-exercise of one or more of the rights that are 512 | specifically granted under this License. You may not convey a covered 513 | work if you are a party to an arrangement with a third party that is 514 | in the business of distributing software, under which you make payment 515 | to the third party based on the extent of your activity of conveying 516 | the work, and under which the third party grants, to any of the 517 | parties who would receive the covered work from you, a discriminatory 518 | patent license (a) in connection with copies of the covered work 519 | conveyed by you (or copies made from those copies), or (b) primarily 520 | for and in connection with specific products or compilations that 521 | contain the covered work, unless you entered into that arrangement, 522 | or that patent license was granted, prior to 28 March 2007. 523 | 524 | Nothing in this License shall be construed as excluding or limiting 525 | any implied license or other defenses to infringement that may 526 | otherwise be available to you under applicable patent law. 527 | 528 | 12. No Surrender of Others' Freedom. 529 | 530 | If conditions are imposed on you (whether by court order, agreement or 531 | otherwise) that contradict the conditions of this License, they do not 532 | excuse you from the conditions of this License. If you cannot convey a 533 | covered work so as to satisfy simultaneously your obligations under this 534 | License and any other pertinent obligations, then as a consequence you may 535 | not convey it at all. For example, if you agree to terms that obligate you 536 | to collect a royalty for further conveying from those to whom you convey 537 | the Program, the only way you could satisfy both those terms and this 538 | License would be to refrain entirely from conveying the Program. 539 | 540 | 13. Remote Network Interaction; Use with the GNU General Public License. 541 | 542 | Notwithstanding any other provision of this License, if you modify the 543 | Program, your modified version must prominently offer all users 544 | interacting with it remotely through a computer network (if your version 545 | supports such interaction) an opportunity to receive the Corresponding 546 | Source of your version by providing access to the Corresponding Source 547 | from a network server at no charge, through some standard or customary 548 | means of facilitating copying of software. This Corresponding Source 549 | shall include the Corresponding Source for any work covered by version 3 550 | of the GNU General Public License that is incorporated pursuant to the 551 | following paragraph. 552 | 553 | Notwithstanding any other provision of this License, you have 554 | permission to link or combine any covered work with a work licensed 555 | under version 3 of the GNU General Public License into a single 556 | combined work, and to convey the resulting work. The terms of this 557 | License will continue to apply to the part which is the covered work, 558 | but the work with which it is combined will remain governed by version 559 | 3 of the GNU General Public License. 560 | 561 | 14. Revised Versions of this License. 562 | 563 | The Free Software Foundation may publish revised and/or new versions of 564 | the GNU Affero General Public License from time to time. Such new versions 565 | will be similar in spirit to the present version, but may differ in detail to 566 | address new problems or concerns. 567 | 568 | Each version is given a distinguishing version number. If the 569 | Program specifies that a certain numbered version of the GNU Affero General 570 | Public License "or any later version" applies to it, you have the 571 | option of following the terms and conditions either of that numbered 572 | version or of any later version published by the Free Software 573 | Foundation. If the Program does not specify a version number of the 574 | GNU Affero General Public License, you may choose any version ever published 575 | by the Free Software Foundation. 576 | 577 | If the Program specifies that a proxy can decide which future 578 | versions of the GNU Affero General Public License can be used, that proxy's 579 | public statement of acceptance of a version permanently authorizes you 580 | to choose that version for the Program. 581 | 582 | Later license versions may give you additional or different 583 | permissions. However, no additional obligations are imposed on any 584 | author or copyright holder as a result of your choosing to follow a 585 | later version. 586 | 587 | 15. Disclaimer of Warranty. 588 | 589 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY 590 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT 591 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY 592 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, 593 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 594 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM 595 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF 596 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 597 | 598 | 16. Limitation of Liability. 599 | 600 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 601 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS 602 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY 603 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE 604 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF 605 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD 606 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), 607 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF 608 | SUCH DAMAGES. 609 | 610 | 17. Interpretation of Sections 15 and 16. 611 | 612 | If the disclaimer of warranty and limitation of liability provided 613 | above cannot be given local legal effect according to their terms, 614 | reviewing courts shall apply local law that most closely approximates 615 | an absolute waiver of all civil liability in connection with the 616 | Program, unless a warranty or assumption of liability accompanies a 617 | copy of the Program in return for a fee. 618 | 619 | END OF TERMS AND CONDITIONS 620 | 621 | How to Apply These Terms to Your New Programs 622 | 623 | If you develop a new program, and you want it to be of the greatest 624 | possible use to the public, the best way to achieve this is to make it 625 | free software which everyone can redistribute and change under these terms. 626 | 627 | To do so, attach the following notices to the program. It is safest 628 | to attach them to the start of each source file to most effectively 629 | state the exclusion of warranty; and each file should have at least 630 | the "copyright" line and a pointer to where the full notice is found. 631 | 632 | 633 | Copyright (C) 634 | 635 | This program is free software: you can redistribute it and/or modify 636 | it under the terms of the GNU Affero General Public License as published 637 | by the Free Software Foundation, either version 3 of the License, or 638 | (at your option) any later version. 639 | 640 | This program is distributed in the hope that it will be useful, 641 | but WITHOUT ANY WARRANTY; without even the implied warranty of 642 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 643 | GNU Affero General Public License for more details. 644 | 645 | You should have received a copy of the GNU Affero General Public License 646 | along with this program. If not, see . 647 | 648 | Also add information on how to contact you by electronic and paper mail. 649 | 650 | If your software can interact with users remotely through a computer 651 | network, you should also make sure that it provides a way for users to 652 | get its source. For example, if your program is a web application, its 653 | interface could display a "Source" link that leads users to an archive 654 | of the code. There are many ways you could offer source, and different 655 | solutions will be better for different programs; see section 13 for the 656 | specific requirements. 657 | 658 | You should also get your employer (if you work as a programmer) or school, 659 | if any, to sign a "copyright disclaimer" for the program, if necessary. 660 | For more information on this, and how to apply and follow the GNU AGPL, see 661 | . 662 | -------------------------------------------------------------------------------- /create_admin.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | import os 4 | import sys 5 | import getpass 6 | from email_validator import validate_email, EmailNotValidError 7 | 8 | # Try to import from app context 9 | try: 10 | from flask import current_app 11 | app = current_app._get_current_object() 12 | with app.app_context(): 13 | db = app.extensions['sqlalchemy'].db 14 | User = app.extensions['sqlalchemy'].db.metadata.tables['user'] 15 | bcrypt = app.extensions.get('bcrypt') 16 | except (RuntimeError, AttributeError, KeyError): 17 | # If not in app context, import directly 18 | try: 19 | from app import app, db, User, bcrypt 20 | except ImportError as e: 21 | print(f"Error: Could not import required modules: {e}") 22 | print("Make sure create_admin.py is runnable and PYTHONPATH is set.") 23 | sys.exit(1) 24 | 25 | def create_admin_user(): 26 | """ 27 | Create an admin user interactively. 28 | """ 29 | print("Creating admin user for Speakr application") 30 | print("=========================================") 31 | 32 | # Get username 33 | while True: 34 | username = input("Enter username (min 3 characters): ").strip() 35 | if len(username) < 3: 36 | print("Username must be at least 3 characters long.") 37 | continue 38 | 39 | # Check if username already exists 40 | with app.app_context(): 41 | existing_user = db.session.query(User).filter_by(username=username).first() 42 | if existing_user: 43 | print(f"Username '{username}' already exists. Please choose another.") 44 | continue 45 | break 46 | 47 | # Get email 48 | while True: 49 | email = input("Enter email address: ").strip() 50 | try: 51 | # Validate email 52 | validate_email(email) 53 | 54 | # Check if email already exists 55 | with app.app_context(): 56 | existing_email = db.session.query(User).filter_by(email=email).first() 57 | if existing_email: 58 | print(f"Email '{email}' already exists. Please use another.") 59 | continue 60 | break 61 | except EmailNotValidError as e: 62 | print(f"Invalid email: {str(e)}") 63 | 64 | # Get password 65 | while True: 66 | password = getpass.getpass("Enter password (min 8 characters): ") 67 | if len(password) < 8: 68 | print("Password must be at least 8 characters long.") 69 | continue 70 | 71 | confirm_password = getpass.getpass("Confirm password: ") 72 | if password != confirm_password: 73 | print("Passwords do not match. Please try again.") 74 | continue 75 | break 76 | 77 | # Create user 78 | with app.app_context(): 79 | hashed_password = bcrypt.generate_password_hash(password).decode('utf-8') 80 | new_user = User(username=username, email=email, password=hashed_password, is_admin=True) 81 | db.session.add(new_user) 82 | db.session.commit() 83 | 84 | print("\nAdmin user created successfully!") 85 | print(f"Username: {username}") 86 | print(f"Email: {email}") 87 | print("You can now log in to the application with these credentials.") 88 | 89 | if __name__ == "__main__": 90 | create_admin_user() 91 | -------------------------------------------------------------------------------- /create_docs.py: -------------------------------------------------------------------------------- 1 | import os 2 | from pathlib import Path 3 | 4 | def create_markdown_doc(base_dir): 5 | output = [] 6 | 7 | # Add header 8 | output.append("# Project Files\n") 9 | output.append("Generated documentation of all project files.\n") 10 | 11 | # Function to read and format file content 12 | def add_file_content(filepath, relative_path): 13 | output.append(f"\n## {relative_path}\n") 14 | output.append("```" + get_file_extension(filepath) + "\n") 15 | try: 16 | with open(filepath, 'r', encoding='utf-8') as f: 17 | output.append(f.read()) 18 | except Exception as e: 19 | output.append(f"Error reading file: {e}") 20 | output.append("```\n") 21 | 22 | def get_file_extension(filepath): 23 | ext = os.path.splitext(filepath)[1][1:].lower() 24 | # Map file extensions to markdown code block languages 25 | extension_map = { 26 | 'py': 'python', 27 | 'html': 'html', 28 | 'js': 'javascript', 29 | 'css': 'css', 30 | 'sh': 'bash', 31 | 'md': 'markdown', 32 | 'txt': 'text' 33 | } 34 | return extension_map.get(ext, '') 35 | 36 | # List of important file patterns to include 37 | patterns = [ 38 | '*.py', 39 | '*.html', 40 | '*.js', 41 | '*.css', 42 | '*.sh', 43 | 'requirements.txt' 44 | ] 45 | 46 | # Walk through directory and add files 47 | for root, _, _ in os.walk(base_dir): 48 | for pattern in patterns: 49 | for filepath in Path(root).glob(pattern): 50 | if 'venv' not in str(filepath) and '__pycache__' not in str(filepath): 51 | relative_path = os.path.relpath(filepath, base_dir) 52 | add_file_content(filepath, relative_path) 53 | 54 | # Write to output file 55 | output_path = os.path.join(base_dir, 'project_files.md') 56 | with open(output_path, 'w', encoding='utf-8') as f: 57 | f.write('\n'.join(output)) 58 | 59 | return output_path 60 | 61 | if __name__ == "__main__": 62 | # Get the current directory 63 | current_dir = os.getcwd() 64 | 65 | # Create the markdown file 66 | output_file = create_markdown_doc(current_dir) 67 | print(f"Created markdown documentation at: {output_file}") -------------------------------------------------------------------------------- /deployment/setup.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Create directory for the application 4 | sudo systemctl stop transcription 5 | 6 | sudo mkdir -p /opt/transcription-app 7 | sudo chown $USER:$USER /opt/transcription-app 8 | 9 | # Copy application files 10 | cp app.py /opt/transcription-app/ 11 | cp -r templates /opt/transcription-app/ 12 | cp requirements.txt /opt/transcription-app/ 13 | cp reset_db.py /opt/transcription-app/ 14 | cp create_admin.py /opt/transcription-app/ 15 | cp .env /opt/transcription-app/ # Copy the .env file with API keys 16 | 17 | # Add SECRET_KEY to .env file if it doesn't exist 18 | if ! grep -q "SECRET_KEY" /opt/transcription-app/.env; then 19 | echo "SECRET_KEY=$(openssl rand -hex 32)" >> /opt/transcription-app/.env 20 | echo "Added SECRET_KEY to .env file" 21 | fi 22 | 23 | # Create and activate virtual environment 24 | python3 -m venv /opt/transcription-app/venv 25 | source /opt/transcription-app/venv/bin/activate 26 | 27 | # Install requirements 28 | cd /opt/transcription-app 29 | pip install -r requirements.txt 30 | 31 | # Create directories for uploads and database with proper permissions 32 | mkdir -p /opt/transcription-app/uploads 33 | mkdir -p /opt/transcription-app/instance 34 | chmod 755 /opt/transcription-app/uploads 35 | chmod 755 /opt/transcription-app/instance 36 | 37 | # Initialize or migrate the database 38 | if [ ! -f /opt/transcription-app/instance/transcriptions.db ]; then 39 | # If database doesn't exist, create it from scratch 40 | echo "Database doesn't exist. Creating new database..." 41 | python reset_db.py 42 | else 43 | # If database exists, migrate it to preserve data 44 | echo "Database exists. Migrating schema to preserve data..." 45 | python migrate_db.py 46 | fi 47 | 48 | # Set proper ownership for all files 49 | sudo chown -R $USER:$USER /opt/transcription-app 50 | 51 | # Create systemd service file 52 | sudo tee /etc/systemd/system/transcription.service << EOF 53 | [Unit] 54 | Description=Transcription Web Application 55 | After=network.target 56 | 57 | [Service] 58 | User=$USER 59 | EnvironmentFile=/opt/transcription-app/.env 60 | WorkingDirectory=/opt/transcription-app 61 | Environment="PATH=/opt/transcription-app/venv/bin" 62 | Environment="PYTHONPATH=/opt/transcription-app" 63 | ExecStart=/opt/transcription-app/venv/bin/gunicorn --workers 3 --bind 0.0.0.0:8899 --timeout 600 app:app 64 | Restart=always 65 | RestartSec=5 66 | 67 | [Install] 68 | WantedBy=multi-user.target 69 | EOF 70 | 71 | # Reload systemd and start service 72 | sudo systemctl daemon-reload 73 | sudo systemctl restart transcription 74 | sudo systemctl disable transcription 75 | sudo systemctl enable transcription 76 | 77 | # Check service status 78 | echo "Checking service status..." 79 | sleep 3 80 | sudo systemctl status transcription 81 | 82 | echo "Installation complete! The application should be running on port 8899." 83 | 84 | # Ask if user wants to create an admin user 85 | read -p "Do you want to create an admin user now? (y/n): " create_admin 86 | if [[ $create_admin == "y" || $create_admin == "Y" ]]; then 87 | echo "Creating admin user..." 88 | python create_admin.py 89 | else 90 | echo "You can create an admin user later by running: python create_admin.py" 91 | fi 92 | -------------------------------------------------------------------------------- /docker-compose.example.yml: -------------------------------------------------------------------------------- 1 | services: 2 | app: 3 | image: learnedmachine/speakr:latest 4 | container_name: speakr 5 | restart: unless-stopped 6 | ports: 7 | - "8899:8899" 8 | # VOLUME CONFIGURATION OPTIONS: 9 | # Uncomment ONE of the following volume configurations: 10 | 11 | # Option 1: Using specific host paths for both volumes 12 | volumes: 13 | - /path/to/uploads:/data/uploads # Replace with your custom path 14 | - /path/to/instance:/data/instance # Replace with your custom path 15 | 16 | # Option 2: Using Docker-managed volumes for both 17 | # volumes: 18 | # - speakr-uploads:/data/uploads # Docker will manage this volume 19 | # - speakr-instance:/data/instance # Docker will manage this volume 20 | 21 | # Option 3: Mixed approach - custom path for uploads, Docker-managed for instance 22 | # volumes: 23 | # - /path/to/uploads:/data/uploads # Replace with your custom path 24 | # - speakr-instance:/data/instance # Docker will manage this volume 25 | 26 | environment: 27 | # Database and upload folder configuration 28 | - SQLALCHEMY_DATABASE_URI=sqlite:////data/instance/transcriptions.db 29 | - UPLOAD_FOLDER=/data/uploads 30 | 31 | # Text model configuration 32 | - TEXT_MODEL_BASE_URL=https://openrouter.ai/api/v1 33 | - TEXT_MODEL_API_KEY=your_text_model_api_key_here 34 | - TEXT_MODEL_NAME=openai/gpt-4o-mini 35 | 36 | # Whisper model configuration 37 | - TRANSCRIPTION_BASE_URL=http://your_local_api_url:port/v1/ 38 | - TRANSCRIPTION_API_KEY=your_transcription_api_key_here 39 | - WHISPER_MODEL=Systran/faster-distil-whisper-large-v3 40 | 41 | # Application settings 42 | # Transcription and Output languages are now per-user settings, configurable on the Account page in the app. 43 | - ALLOW_REGISTRATION=false 44 | - SUMMARY_MAX_TOKENS=8000 # Optional: Max tokens for title/summary generation (default: 3000) 45 | - CHAT_MAX_TOKENS=5000 # Optional: Max tokens for chat responses (default: 2000) 46 | 47 | # Admin user creation 48 | - ADMIN_USERNAME=admin 49 | - ADMIN_EMAIL=admin@example.com 50 | - ADMIN_PASSWORD=securepassword 51 | 52 | # IMPORTANT: Uncomment this section if you're using any Docker-managed volumes 53 | # (required for Options 2 and 3 above) 54 | # volumes: 55 | # speakr-uploads: 56 | # # This defines the Docker-managed volume 57 | # speakr-instance: 58 | # # This defines the Docker-managed volume 59 | # 60 | # For custom volume names, use: 61 | # volumes: 62 | # speakr-uploads: 63 | # name: custom-speakr-uploads-name 64 | # speakr-instance: 65 | # name: custom-speakr-instance-name 66 | -------------------------------------------------------------------------------- /docker-compose.override.yml.example: -------------------------------------------------------------------------------- 1 | version: '3.8' 2 | 3 | services: 4 | app: 5 | volumes: 6 | # Uncomment and modify these lines to use custom paths for data storage 7 | # - /path/to/your/uploads:/data/uploads 8 | # - /path/to/your/database:/data/instance 9 | environment: 10 | # Admin user creation (uncomment and set these to create an admin user on first run) 11 | # - ADMIN_USERNAME=admin 12 | # - ADMIN_EMAIL=admin@example.com 13 | # - ADMIN_PASSWORD=securepassword 14 | 15 | # Application settings 16 | # - ALLOW_REGISTRATION=false 17 | -------------------------------------------------------------------------------- /docker-entrypoint.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -e 3 | 4 | # Create necessary directories 5 | mkdir -p /data/uploads /data/instance 6 | chmod 755 /data/uploads /data/instance 7 | 8 | # Initialize the database if it doesn't exist 9 | if [ ! -f /data/instance/transcriptions.db ]; then 10 | echo "Database doesn't exist. Creating new database..." 11 | python -c "from app import app, db; app.app_context().push(); db.create_all()" 12 | echo "Database created successfully." 13 | else 14 | echo "Database exists. Checking for schema updates..." 15 | python -c "from app import app; app.app_context().push()" 16 | fi 17 | 18 | # Check if we need to create an admin user (regardless of whether the database exists) 19 | if [ -n "$ADMIN_USERNAME" ] && [ -n "$ADMIN_EMAIL" ] && [ -n "$ADMIN_PASSWORD" ]; then 20 | echo "Creating admin user using environment variables..." 21 | python docker_create_admin.py 22 | fi 23 | 24 | # Start the application 25 | exec "$@" 26 | -------------------------------------------------------------------------------- /docker_create_admin.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | import os 4 | import sys 5 | from email_validator import validate_email, EmailNotValidError 6 | 7 | # Try to import from app context 8 | try: 9 | from flask import current_app 10 | app = current_app._get_current_object() 11 | with app.app_context(): 12 | db = app.extensions['sqlalchemy'].db 13 | User = app.extensions['sqlalchemy'].db.metadata.tables['user'] 14 | bcrypt = app.extensions.get('bcrypt') 15 | except (RuntimeError, AttributeError, KeyError): 16 | # If not in app context, import directly 17 | try: 18 | from app import app, db, User, bcrypt 19 | except ImportError as e: 20 | print(f"Error: Could not import required modules: {e}") 21 | print("Make sure docker_create_admin.py is runnable and PYTHONPATH is set.") 22 | sys.exit(1) 23 | 24 | def create_admin_user_from_env(): 25 | """ 26 | Create an admin user from environment variables. 27 | Required environment variables: 28 | - ADMIN_USERNAME 29 | - ADMIN_EMAIL 30 | - ADMIN_PASSWORD 31 | """ 32 | print("Creating admin user for Speakr application from environment variables") 33 | print("=================================================================") 34 | 35 | # Get values from environment variables 36 | username = os.environ.get('ADMIN_USERNAME') 37 | email = os.environ.get('ADMIN_EMAIL') 38 | password = os.environ.get('ADMIN_PASSWORD') 39 | 40 | # Validate required environment variables 41 | if not username or not email or not password: 42 | print("Error: ADMIN_USERNAME, ADMIN_EMAIL, and ADMIN_PASSWORD environment variables must be set.") 43 | sys.exit(1) 44 | 45 | # Validate username 46 | if len(username) < 3: 47 | print("Error: Username must be at least 3 characters long.") 48 | sys.exit(1) 49 | 50 | # Validate email 51 | try: 52 | validate_email(email) 53 | except EmailNotValidError as e: 54 | print(f"Error: Invalid email: {str(e)}") 55 | sys.exit(1) 56 | 57 | # Validate password 58 | if len(password) < 8: 59 | print("Error: Password must be at least 8 characters long.") 60 | sys.exit(1) 61 | 62 | # Create user 63 | with app.app_context(): 64 | # Check if username already exists 65 | existing_user = db.session.query(User).filter_by(username=username).first() 66 | if existing_user: 67 | print(f"User with username '{username}' already exists.") 68 | sys.exit(0) 69 | 70 | # Check if email already exists 71 | existing_email = db.session.query(User).filter_by(email=email).first() 72 | if existing_email: 73 | print(f"User with email '{email}' already exists.") 74 | sys.exit(0) 75 | 76 | # Create new admin user 77 | hashed_password = bcrypt.generate_password_hash(password).decode('utf-8') 78 | new_user = User(username=username, email=email, password=hashed_password, is_admin=True) 79 | db.session.add(new_user) 80 | db.session.commit() 81 | 82 | print("\nAdmin user created successfully!") 83 | print(f"Username: {username}") 84 | print(f"Email: {email}") 85 | print("You can now log in to the application with these credentials.") 86 | 87 | if __name__ == "__main__": 88 | create_admin_user_from_env() 89 | -------------------------------------------------------------------------------- /readme.md: -------------------------------------------------------------------------------- 1 | # Speakr 2 | 3 | [![License: AGPL v3](https://img.shields.io/badge/License-AGPL_v3-blue.svg)](https://www.gnu.org/licenses/agpl-3.0) [![Docker Build and Publish](https://github.com/murtaza-nasir/speakr/actions/workflows/docker-publish.yml/badge.svg)](https://github.com/murtaza-nasir/speakr/actions/workflows/docker-publish.yml) 4 | 5 | This project is dual-licensed. See the [License](#license) section for details. 6 | 7 | Speakr is a personal, self-hosted web application designed for transcribing audio recordings (like meetings), generating concise summaries and titles, and interacting with the content through a chat interface. Keep all your meeting notes and insights securely on your own server. 8 | 9 | ## Screenshots 10 | ![image](https://github.com/user-attachments/assets/788aebc7-86bd-4024-be4d-c6273d61c765) 11 | ![image](https://github.com/user-attachments/assets/36f05267-ad02-4cfe-9f10-a3f140a080ca) 12 | ![image](https://github.com/user-attachments/assets/a1d471fa-8b52-4f9e-962d-19cbd0955a3b) 13 | ![image](https://github.com/user-attachments/assets/637bfb92-bbfc-4113-93d2-c7d051c970af) 14 | 15 | ## Features 16 | 17 | **Core Functionality:** 18 | 19 | * **Audio Upload:** Upload audio files (MP3, WAV, M4A, etc.) via drag-and-drop or file selection. 20 | * **Background Processing:** Transcription and summarization happen in the background without blocking the UI. 21 | * **Multilingual Support:** User-configurable languages for both audio transcription (input) and AI-generated content like summaries and chat (output). 22 | * **Transcription:** Uses OpenAI-compatible Speech-to-Text (STT) APIs (configurable, e.g., self-hosted Whisper). Transcription language can be set per user. 23 | * **AI Summarization & Titling:** Generates concise titles and summaries using configurable LLMs via OpenAI-compatible APIs (like OpenRouter). Features an improved default summarization prompt, and users can provide their own custom prompt. Output language can be set per user. 24 | * **Interactive Chat:** Ask questions and interact with the transcription content using an AI model. Incorporates user's professional context (name, title, company if provided by the user) for more relevant responses. Chat output language can be set per user. 25 | * **Search, Inbox & Highlight:** For highlighting and easy processing 26 | * **Metadata Editing:** Edit titles, participants, meeting dates, summaries, and notes associated with recordings. 27 | 28 | **User Features:** 29 | 30 | * **Authentication:** Secure user registration and login system. 31 | * **Account Management:** Users can change their passwords and manage preferences on their Account page, including: 32 | * Setting transcription and output languages. 33 | * Defining a custom summarization prompt. 34 | * Adding personal/professional information (name, title, company) to enhance chat context and AI interactions. 35 | * **Recording Gallery:** View, manage, and access all personal recordings. 36 | * **Dark Mode:** Switch between light and dark themes. 37 | 38 | **Admin Features:** 39 | 40 | * **Admin Dashboard:** Central place for administration tasks (`/admin`). 41 | * **User Management:** Add, edit, delete users, and grant/revoke admin privileges. 42 | * **System Statistics:** View overall usage statistics (total users, recordings, storage, etc.). 43 | 44 | ## Technology Stack 45 | 46 | * **Backend:** Python 3, Flask 47 | * **Database:** SQLAlchemy ORM with SQLite (default) 48 | * **WSGI Server:** Gunicorn 49 | * **AI Integration:** OpenAI Python library (compatible with various endpoints like OpenAI, OpenRouter, or local servers) 50 | * **Authentication:** Flask-Login, Flask-Bcrypt, Flask-WTF 51 | * **Frontend:** Jinja2 Templates, Tailwind CSS, Vue.js (for interactive components), Font Awesome 52 | * **Deployment:** 53 | * Bash script (`setup.sh`) for Linux/Systemd environments 54 | * Docker with automated builds via GitHub Actions 55 | 56 | ## Prerequisites 57 | 58 | * Python 3.8+ 59 | * `pip` (Python package installer) 60 | * `venv` (Python virtual environment tool - usually included with Python) 61 | * Access to OpenAI-compatible API endpoints for: 62 | * Speech-to-Text (e.g., Whisper - can be self-hosted) 63 | * Language Model (e.g., via OpenRouter, OpenAI, or other compatible service) 64 | * API Keys for the chosen endpoints. 65 | * (For Deployment) A Linux server with `sudo` access and `systemd`. 66 | 67 | ## Setup Instructions 68 | 69 | **IMPORTANT NOTE:** Currently, only the Docker installation method is working. The Local Development and Deployment methods are not functional at this time. 70 | 71 | Choose either **Docker** (recommended and currently the only working method), **Local Development**, or **Deployment**. 72 | 73 | ### 1. Docker Installation 74 | 75 | The easiest way to deploy Speakr is using Docker and docker compose. 76 | 77 | #### Option A: Using Pre-built Docker Images 78 | 79 | 1. **Create a docker-compose.yml file:** 80 | ```yaml 81 | services: 82 | app: 83 | image: learnedmachine/speakr:latest 84 | container_name: speakr 85 | restart: unless-stopped 86 | ports: 87 | - "8899:8899" 88 | volumes: 89 | - ./uploads:/data/uploads 90 | - ./instance:/data/instance 91 | environment: 92 | # Database and upload folder configuration 93 | - SQLALCHEMY_DATABASE_URI=sqlite:////data/instance/transcriptions.db 94 | - UPLOAD_FOLDER=/data/uploads 95 | 96 | # Text model configuration 97 | - TEXT_MODEL_BASE_URL=https://openrouter.ai/api/v1 98 | - TEXT_MODEL_API_KEY=your_text_model_api_key_here 99 | - TEXT_MODEL_NAME=openai/gpt-4o-mini 100 | 101 | # Whisper model configuration 102 | - TRANSCRIPTION_BASE_URL=http://your_local_api_url:port/v1/ 103 | - TRANSCRIPTION_API_KEY=your_transcription_api_key_here 104 | - WHISPER_MODEL=Systran/faster-distil-whisper-large-v3 105 | # Note: Transcription and Output languages are now per-user settings, configurable on the Account page in the app. 106 | 107 | # Application settings 108 | - ALLOW_REGISTRATION=false 109 | ``` 110 | 111 | Alternatively, you can copy the example file: 112 | ```bash 113 | cp docker-compose.example.yml docker-compose.yml 114 | ``` 115 | Then edit the file to update the environment variables with your actual values. **Make sure to change the mount points to the correct paths**. 116 | 117 | 2. **Start the container:** 118 | ```bash 119 | docker compose up -d 120 | ``` 121 | 122 | #### Option A.1: Deploying with Portainer 123 | 124 | If you're using Portainer to manage your Docker containers: 125 | 126 | 1. **In Portainer:** 127 | - Go to Stacks → Add stack 128 | - Name your stack (e.g., "speakr") 129 | - Upload the `docker-compose.example.yml` file or paste its contents 130 | - Edit the environment variables with your actual values 131 | - Click "Deploy the stack" 132 | 133 | 2. **Important Notes for Portainer:** 134 | - Make sure to update all environment variables with your actual values 135 | - For volume persistence, you can either: 136 | - Use named volumes as shown in the example file 137 | - Or modify the volumes to use bind mounts to specific directories on your host 138 | 139 | #### Option B: Building Locally 140 | 141 | 1. **Clone the Repository:** 142 | ```bash 143 | git clone https://github.com/murtaza-nasir/speakr.git 144 | cd speakr 145 | ``` 146 | 147 | 2. **Configure Environment Variables:** 148 | * Copy the example docker-compose file: 149 | ```bash 150 | cp docker-compose.example.yml docker-compose.yml 151 | ``` 152 | * Edit the `docker-compose.yml` file to update the environment variables with your actual API keys and settings as described in the Configuration section. 153 | 154 | 3. **Build and Start the Container:** 155 | ```bash 156 | docker compose up -d 157 | ``` 158 | 159 | 4. **Create an Admin User:** 160 | 161 | You can create an admin user in one of the following ways: 162 | 163 | * **Option A: Using environment variables:** 164 | 165 | Create a `docker-compose.override.yml` file: 166 | ```bash 167 | cp docker-compose.override.yml.example docker-compose.override.yml 168 | ``` 169 | 170 | Edit the file to uncomment and set the admin credentials: 171 | ```yaml 172 | services: 173 | app: 174 | environment: 175 | - ADMIN_USERNAME=admin 176 | - ADMIN_EMAIL=admin@example.com 177 | - ADMIN_PASSWORD=securepassword 178 | ``` 179 | 180 | Then restart the container: 181 | ```bash 182 | docker compose down 183 | docker compose up -d 184 | ``` 185 | 186 | * **Option B: Using the create_admin.py script:** 187 | ```bash 188 | docker compose exec app python create_admin.py 189 | ``` 190 | Follow the interactive prompts to create an admin user. 191 | 192 | 5. **Access Speakr:** Open your web browser and navigate to `http://localhost:8899`. 193 | 194 | #### Customizing Data Storage 195 | 196 | By default, all data (database and uploaded audio files) is stored in Docker volumes. To use custom directories on your host system: 197 | 198 | 1. Create a `docker-compose.override.yml` file (if you haven't already): 199 | ```bash 200 | cp docker-compose.override.yml.example docker-compose.override.yml 201 | ``` 202 | 203 | 2. Edit `docker-compose.override.yml` and uncomment the volume mappings: 204 | ```yaml 205 | services: 206 | app: 207 | volumes: 208 | - /path/to/your/uploads:/data/uploads 209 | - /path/to/your/database:/data/instance 210 | ``` 211 | 212 | 3. Replace `/path/to/your/uploads` and `/path/to/your/database` with actual paths on your system. 213 | 214 | 4. Restart the container: 215 | ```bash 216 | docker compose down 217 | docker compose up -d 218 | ``` 219 | 220 | #### Updating the Docker Installation 221 | 222 | To update the application to a newer version: 223 | 224 | 1. Pull the latest code: 225 | ```bash 226 | git pull 227 | ``` 228 | 229 | 2. Rebuild and restart the container: 230 | ```bash 231 | docker compose down 232 | docker compose build 233 | docker compose up -d 234 | ``` 235 | 236 | Your data will be preserved as it's stored in Docker volumes or your custom mapped directories. 237 | 238 | ### 2. Local Development 239 | 240 | **NOTE: This method is currently not working. Please use the Docker installation method above.** 241 | 242 | Follow these steps to run Speakr on your local machine for development or testing. 243 | 244 | 1. **Clone the Repository:** 245 | ```bash 246 | git clone https://github.com/murtaza-nasir/speakr.git 247 | cd speakr 248 | ``` 249 | 250 | 2. **Create and Activate Virtual Environment:** 251 | ```bash 252 | python3 -m venv venv 253 | source venv/bin/activate 254 | # On Windows use: venv\Scripts\activate 255 | ``` 256 | 257 | 3. **Install Dependencies:** 258 | ```bash 259 | pip install -r requirements.txt 260 | ``` 261 | 262 | 4. **Configure Environment Variables:** 263 | * Copy the example environment file `.env.example` or create a new file named `.env` in the project root. 264 | * Add the following variables, replacing placeholder values with your actual keys and endpoints: 265 | 266 | ```dotenv 267 | # --- Required for Summaries/Chat --- 268 | # (Use OpenRouter or another OpenAI-compatible Chat API) 269 | TEXT_MODEL_API_KEY=sk-or-v1-... # Your OpenRouter or compatible API key 270 | TRANSCRIPTION_BASE_URL="https://openrouter.ai/api/v1" # Or your chat model endpoint 271 | # Recommended Models: openai/gpt-4o-mini, google/gemini-flash-1.5, etc. 272 | TEXT_MODEL_MODEL_NAME="openai/gpt-4o-mini" 273 | 274 | # --- Required for Transcription --- 275 | # (Use OpenAI Whisper API or a compatible local/remote endpoint) 276 | TRANSCRIPTION_API_KEY="cant-be-empty" # Use your OpenAI key OR often "none", "NA", "cant-be-empty" for local endpoints 277 | TRANSCRIPTION_BASE_URL="http://YOUR_LOCAL_WHISPER_IP:PORT/v1/" # Your transcription endpoint URL 278 | # Set the specific model name your transcription endpoint uses (if needed by API) 279 | WHISPER_MODEL="Systran/faster-distil-whisper-large-v3" # Or the model your endpoint expects 280 | 281 | # --- Flask Specific --- 282 | # A strong, random secret key is crucial for session security. 283 | # Generate one using: python -c 'import secrets; print(secrets.token_hex(32))' 284 | SECRET_KEY="YOUR_VERY_STRONG_RANDOM_SECRET_KEY" 285 | 286 | # --- Optional --- 287 | # Set to 'false' to disable new user registrations 288 | ALLOW_REGISTRATION="true" 289 | ``` 290 | 291 | 5. **Database Setup & Migrations:** 292 | * The application uses SQLite by default, stored in `instance/transcriptions.db`. 293 | * If you ever need to start completely fresh, you can use `python reset_db.py`, but **be careful as this deletes all data**) 294 | 295 | 6. **Create an Admin User:** 296 | * Run the interactive script to create your first user with admin privileges: 297 | ```bash 298 | python create_admin.py 299 | ``` 300 | * Follow the prompts to enter a username, email, and password. 301 | 302 | 7. **Run the Application:** 303 | * **Option A (Flask Development Server - recommended for local dev):** 304 | ```bash 305 | flask run --host=0.0.0.0 --port=8899 306 | # Or (if flask command not found, ensure venv is active): 307 | # python app.py 308 | ``` 309 | * **Option B (Gunicorn - closer to production):** 310 | ```bash 311 | gunicorn --workers 3 --bind 0.0.0.0:8899 --timeout 600 app:app 312 | ``` 313 | 314 | 8. **Access Speakr:** Open your web browser and navigate to `http://localhost:8899` (or your server's IP address if running remotely). 315 | 316 | ### 3. Deployment (Linux with Systemd) 317 | 318 | **NOTE: This method is currently not working. Please use the Docker installation method above.** 319 | 320 | The `deployment/setup.sh` script automates the setup process on a Linux server using `systemd`. 321 | 322 | **Warning:** Review the script carefully before running it, especially the paths and user (`$USER`) it assumes. 323 | 324 | 1. **Copy Project:** Ensure all project files (including the `deployment` directory and your configured `.env` file) are on the target server. 325 | 2. **Make Script Executable:** 326 | ```bash 327 | chmod +x deployment/setup.sh 328 | ``` 329 | 3. **Run Setup Script:** 330 | ```bash 331 | sudo bash deployment/setup.sh 332 | ``` 333 | * This script will: 334 | * Create `/opt/transcription-app`. 335 | * Copy necessary files. 336 | * Set up Python virtual environment and install dependencies. 337 | * Ensure `.env` exists and has a `SECRET_KEY`. 338 | * Create `uploads` and `instance` directories. 339 | * Initialize or migrate the database (`reset_db.py` on first run, `migrate_db.py` otherwise). 340 | * Set file ownership. 341 | * Create and enable a `systemd` service (`transcription.service`) to run the app with Gunicorn. 342 | * Start the service. 343 | * Prompt you to create an admin user. 344 | 345 | 4. **Service Management:** 346 | * **Check Status:** `sudo systemctl status transcription.service` 347 | * **Stop Service:** `sudo systemctl stop transcription.service` 348 | * **Start Service:** `sudo systemctl start transcription.service` 349 | * **Restart Service:** `sudo systemctl restart transcription.service` 350 | * **View Logs:** `sudo journalctl -u transcription.service -f` (follow logs) 351 | * **View Recent Logs:** `sudo journalctl -u transcription.service -n 100 --no-pager` 352 | 353 | 5. **Access Speakr:** Open your web browser and navigate to `http://YOUR_SERVER_IP:8899`. 354 | 355 | ## Configuration 356 | 357 | Configuration is primarily handled through environment variables in the `docker-compose.yml` file for Docker installations, or through the `.env` file for other installation methods (though note that the non-Docker installation methods are currently not working). 358 | 359 | **Key Variables:** 360 | 361 | * `TEXT_MODEL_BASE_URL`: **Required.** The base URL for the chat/summarization API. Defaults to OpenRouter's URL. 362 | * `TEXT_MODEL_API_KEY`: **Required.** Your API key for the chat/summarization model endpoint (e.g., OpenRouter API Key). 363 | * `TEXT_MODEL_NAME`: **Required.** The specific model to use for chat/summarization. **Important:** Choose a model that supports structured outputs for optimal performance. OpenAI models (GPT-4o and later) and Fireworks models are recommended. See [OpenRouter's structured outputs documentation](https://openrouter.ai/docs/features/structured-outputs) for more details. 364 | * `TRANSCRIPTION_BASE_URL`: **Required.** The base URL for your transcription API endpoint (e.g., `http://localhost:8787/v1/`). 365 | * `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. 366 | * `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. 367 | * `SUMMARY_MAX_TOKENS`: *Optional.* The maximum number of tokens for the title and summary generation. Defaults to `3000`. 368 | * `CHAT_MAX_TOKENS`: *Optional.* The maximum number of tokens for chat responses. Defaults to `2000`. 369 | * `SECRET_KEY`: **Required.** A long, random string used by Flask for session security. The `setup.sh` script generates one if it's missing. 370 | * `ALLOW_REGISTRATION`: *Optional.* Set to `false` to prevent new users from registering via the web UI. Defaults to `true`. 371 | 372 | **Note on User Preferences:** Transcription language, output language for summaries/chat, custom summarization prompts, and personal/professional details (name, title, company) are now configurable per user on their Account page within the application. 373 | 374 | ## Usage 375 | 376 | 1. **Register/Login:** Access the web application via your browser. Register a new account (if enabled) or log in. 377 | 2. **Set Preferences (Recommended):** Go to your Account page to: 378 | * Set your preferred transcription and output languages. 379 | * Define a custom summarization prompt to tailor summaries to your needs. 380 | * Optionally, add your name, job title, and company to provide more context for AI chat interactions. 381 | 3. **Upload:** Go to "New Recording" or drag-and-drop audio files onto the page. Upload progress and subsequent processing status will appear in the bottom-left popup. 382 | 4. **View Recordings:** The main "Gallery" view lists your recordings, grouped by date. Click on a recording to view its details. 383 | 5. **Interact:** 384 | * Listen to the audio using the player. 385 | * Read the transcription (will use your preferred transcription language if set). 386 | * Review the AI-generated summary and title (will be in your preferred output language if set). 387 | * Read or edit metadata (participants, notes, meeting date). Use the small edit icons or the "Edit Details" button. 388 | * Use the "Chat with Transcript" panel to ask questions about the recording content (responses will be in your preferred output language if set). 389 | 6. **Manage:** Edit details or delete recordings using the buttons in the detail view or the icons in the recording list. 390 | 391 | ## Admin Panel 392 | 393 | * Accessible at `/admin` for logged-in admin users. 394 | * **User Management:** View, add, edit (username, email, password, admin status), and delete users. 395 | * **System Statistics:** View application-wide usage data. 396 | 397 | ## Database Management 398 | 399 | The following scripts are located in the application root (`/opt/transcription-app` if deployed): 400 | 401 | * `reset_db.py`: **Use with caution!** This script deletes the existing database (`instance/transcriptions.db`) and the contents of the `uploads` directory, then creates a fresh, empty database schema. 402 | 403 | ## License 404 | 405 | This project is **dual-licensed**: 406 | 407 | 1. **GNU Affero General Public License v3.0 (AGPLv3)** 408 | [![License: AGPL v3](https://img.shields.io/badge/License-AGPL_v3-blue.svg)](https://www.gnu.org/licenses/agpl-3.0) 409 | 410 | Speakr is offered under the AGPLv3 as its open-source license. You are free to use, modify, and distribute this software under the terms of the AGPLv3. A key condition of the AGPLv3 is that if you run a modified version on a network server and provide access to it for others, you must also make the source code of your modified version available to those users under the AGPLv3. 411 | 412 | * You **must** create a file named `LICENSE` (or `COPYING`) in the root of your repository and paste the full text of the [GNU AGPLv3 license](https://www.gnu.org/licenses/agpl-3.0.txt) into it. 413 | * Read the full license text carefully to understand your rights and obligations. 414 | 415 | 2. **Commercial License** 416 | 417 | For users or organizations who cannot or do not wish to comply with the terms of the AGPLv3 (for example, if you want to integrate Speakr into a proprietary commercial product or service without being obligated to share your modifications under AGPLv3), a separate commercial license is available. 418 | 419 | Please contact **[Your Name/Company Name and Email Address or Website Link for Licensing Inquiries]** for details on obtaining a commercial license. 420 | 421 | **You must choose one of these licenses** under which to use, modify, or distribute this software. If you are using or distributing the software without a commercial license agreement, you must adhere to the terms of the AGPLv3. 422 | 423 | ## Contributing 424 | 425 | While direct code contributions are not the primary focus at this stage, feedback, bug reports, and feature suggestions are highly valuable! Please feel free to open an Issue on the GitHub repository. 426 | 427 | **Note on Future Contributions and CLAs:** 428 | Should this project begin accepting code contributions from external developers in the future, signing a **Contributor License Agreement (CLA)** will be **required** before any pull requests can be merged. This policy ensures that the project maintainer receives the necessary rights to distribute all contributions under both the AGPLv3 and the commercial license options offered. Details on the CLA process will be provided if and when the project formally opens up to external code contributions. 429 | -------------------------------------------------------------------------------- /requirements.txt: -------------------------------------------------------------------------------- 1 | flask==2.3.3 2 | flask-sqlalchemy==3.1.1 3 | flask-login==0.6.3 4 | flask-wtf==1.2.2 5 | flask-bcrypt==1.0.1 6 | email-validator==2.2.0 7 | openai==1.3.0 8 | werkzeug==2.3.7 9 | gunicorn==21.2.0 10 | python-dotenv==1.0.0 11 | markdown==3.5.1 12 | -------------------------------------------------------------------------------- /reset_db.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | # Add this near the top if you run this standalone often outside app context 4 | import os 5 | import sys 6 | import shutil 7 | # Add project root to path if necessary for 'app' import 8 | # sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))) 9 | 10 | # Load environment variables in case DB path relies on them (optional here) 11 | # from dotenv import load_dotenv 12 | # load_dotenv() 13 | 14 | # Check if running within app context already (e.g., via Flask command) 15 | try: 16 | from flask import current_app 17 | # Ensure app context is pushed if needed for config access 18 | app = current_app._get_current_object() 19 | # Make sure db is initialized within the app context if needed 20 | # (SQLAlchemy initialization in app.py handles this mostly) 21 | with app.app_context(): 22 | db = app.extensions['sqlalchemy'].db # Access db via extensions 23 | except (RuntimeError, AttributeError, KeyError): 24 | # If not in app context, import directly 25 | try: 26 | # Ensure this import reflects the updated app.py with the new model 27 | from app import app, db 28 | except ImportError as e: 29 | print(f"Error: Could not import 'app' and 'db': {e}") 30 | print("Make sure reset_db.py is runnable and PYTHONPATH is set.") 31 | sys.exit(1) 32 | 33 | def reset_database(delete_uploads=True): 34 | # Determine the database path relative to the instance folder 35 | # Use app config if available 36 | instance_path = app.instance_path if hasattr(app, 'instance_path') else os.path.join(os.getcwd(), 'instance') 37 | try: 38 | # Ensure app context for config access if not already present 39 | with app.app_context(): 40 | # Use absolute path from config 41 | db_uri = app.config.get('SQLALCHEMY_DATABASE_URI', 'sqlite:///instance/transcriptions.db') 42 | # Handle relative vs absolute paths specified in URI 43 | if db_uri.startswith('sqlite:///'): 44 | # Assume absolute path from URI root if starts with '///' 45 | db_path = db_uri.replace('sqlite:///', '/', 1) # Replace only first 46 | # Ensure instance path reflects the directory containing the DB 47 | instance_path = os.path.dirname(db_path) 48 | elif db_uri.startswith('sqlite://'): 49 | # Assume relative path from instance folder 50 | db_filename = db_uri.split('/')[-1] 51 | db_path = os.path.join(instance_path, db_filename) 52 | else: # Handle other DB types or formats if needed 53 | print(f"Warning: Non-SQLite URI detected: {db_uri}. Deletion logic might need adjustment.") 54 | # Attempt to parse or fallback 55 | db_filename = db_uri.split('/')[-1] # Best guess 56 | db_path = os.path.join(instance_path, db_filename) 57 | 58 | except Exception as config_e: 59 | print(f"Error accessing app config for DB path: {config_e}. Using default.") 60 | # Fallback if config access fails 61 | instance_path = os.path.join(os.getcwd(), 'instance') 62 | db_filename = 'transcriptions.db' 63 | db_path = os.path.join(instance_path, db_filename) 64 | 65 | # Ensure instance directory exists 66 | print(f"Ensuring instance directory exists: {instance_path}") 67 | os.makedirs(instance_path, exist_ok=True) 68 | print(f"Database path identified as: {db_path}") 69 | 70 | # Remove existing database if it exists 71 | if os.path.exists(db_path): 72 | print(f"Removing existing database at {db_path}") 73 | try: 74 | os.remove(db_path) 75 | # Also remove journal file if it exists 76 | journal_path = db_path + "-journal" 77 | if os.path.exists(journal_path): 78 | os.remove(journal_path) 79 | print(f"Removing existing journal file at {journal_path}") 80 | except OSError as e: 81 | print(f"Error removing database file: {e}. Check permissions or if it's in use.") 82 | # Decide whether to exit or continue 83 | # sys.exit(1) 84 | 85 | # Create application context to work with the database 86 | try: 87 | with app.app_context(): 88 | print("Creating new database schema (including 'summary' column)...") 89 | # Create all tables defined in models (app.py) 90 | db.create_all() 91 | print("Database schema created successfully!") 92 | except Exception as e: 93 | print(f"Error creating database schema: {e}") 94 | # Attempt rollback if possible (though less relevant for create_all) 95 | try: 96 | db.session.rollback() 97 | except Exception as rb_e: 98 | print(f"Rollback attempt failed: {rb_e}") 99 | sys.exit(1) 100 | 101 | # Delete all files in the uploads directory if requested 102 | if delete_uploads: 103 | try: 104 | uploads_dir = os.path.join(os.getcwd(), 'uploads') 105 | if os.path.exists(uploads_dir): 106 | print(f"Deleting all files in uploads directory: {uploads_dir}") 107 | for filename in os.listdir(uploads_dir): 108 | file_path = os.path.join(uploads_dir, filename) 109 | try: 110 | if os.path.isfile(file_path): 111 | os.remove(file_path) 112 | print(f"Deleted file: {file_path}") 113 | elif os.path.isdir(file_path): 114 | shutil.rmtree(file_path) 115 | print(f"Deleted directory: {file_path}") 116 | except Exception as e: 117 | print(f"Error deleting {file_path}: {e}") 118 | print("All files in uploads directory have been deleted.") 119 | else: 120 | print(f"Uploads directory not found: {uploads_dir}") 121 | # Create the directory if it doesn't exist 122 | os.makedirs(uploads_dir, exist_ok=True) 123 | print(f"Created uploads directory: {uploads_dir}") 124 | except Exception as e: 125 | print(f"Error cleaning uploads directory: {e}") 126 | 127 | if __name__ == "__main__": 128 | print("Attempting to reset the database and clean up all data...") 129 | reset_database(delete_uploads=True) 130 | print("Database reset process finished.") 131 | -------------------------------------------------------------------------------- /static/css/styles.css: -------------------------------------------------------------------------------- 1 | /* Dark Mode CSS Variables */ 2 | :root { 3 | /* Light mode variables */ 4 | --bg-primary: #f3f4f6; /* gray-100 */ 5 | --bg-secondary: #ffffff; /* white */ 6 | --bg-tertiary: #f9fafb; /* gray-50 */ 7 | --bg-accent: #dbeafe; /* blue-100 */ 8 | --bg-accent-hover: #bfdbfe; /* blue-200 */ 9 | --bg-button: #2563eb; /* blue-600 */ 10 | --bg-button-hover: #1d4ed8; /* blue-700 */ 11 | --bg-danger: #dc2626; /* red-600 */ 12 | --bg-danger-hover: #b91c1c; /* red-700 */ 13 | --bg-danger-light: #fee2e2; /* red-100 */ 14 | --bg-info-light: #dbeafe; /* blue-100 */ 15 | --bg-warn-light: #fef3c7; /* amber-100 */ 16 | --bg-success-light: #d1fae5; /* green-100 */ 17 | --bg-pending-light: #f5f5f4; /* stone-100 */ 18 | --bg-input: #ffffff; /* white */ 19 | --bg-audio-player: linear-gradient(to right, #eff6ff, #eef2ff); /* blue-50, indigo-50 */ 20 | 21 | --text-primary: #1f2937; /* gray-800 */ 22 | --text-secondary: #374151; /* gray-700 */ 23 | --text-muted: #6b7280; /* gray-500 */ 24 | --text-light: #9ca3af; /* gray-400 */ 25 | --text-accent: #1d4ed8; /* blue-700 */ 26 | --text-button: #ffffff; /* white */ 27 | --text-danger: #b91c1c; /* red-700 */ 28 | --text-danger-strong: #991b1b; /* red-800 */ 29 | --text-info-strong: #1e40af; /* blue-800 */ 30 | --text-warn-strong: #92400e; /* amber-800 */ 31 | --text-success-strong: #065f46; /* green-800 */ 32 | --text-pending-strong: #44403c; /* stone-700 */ 33 | 34 | --border-primary: #e5e7eb; /* gray-200 */ 35 | --border-secondary: #d1d5db; /* gray-300 */ 36 | --border-accent: #93c5fd; /* blue-300 */ 37 | --border-danger: #f87171; /* red-400 */ 38 | --border-focus: #3b82f6; /* blue-500 */ 39 | --ring-focus: #bfdbfe; /* blue-200 */ 40 | 41 | --scrollbar-track: #f1f1f1; 42 | --scrollbar-thumb: #c5c5c5; 43 | --scrollbar-thumb-hover: #a8a8a8; 44 | } 45 | 46 | .dark { 47 | /* Dark mode variables */ 48 | --bg-primary: #111827; /* gray-900 */ 49 | --bg-secondary: #1f2937; /* gray-800 */ 50 | --bg-tertiary: #374151; /* gray-700 */ 51 | --bg-accent: #1e3a8a; /* blue-900 */ 52 | --bg-accent-hover: #1e40af; /* blue-800 */ 53 | --bg-button: #2563eb; /* blue-600 */ 54 | --bg-button-hover: #3b82f6; /* blue-500 */ 55 | --bg-danger: #dc2626; /* red-600 */ 56 | --bg-danger-hover: #ef4444; /* red-500 */ 57 | --bg-danger-light: #7f1d1d; /* red-900 */ 58 | --bg-info-light: #1e3a8a; /* blue-900 */ 59 | --bg-warn-light: #78350f; /* amber-900 */ 60 | --bg-success-light: #064e3b; /* green-900 */ 61 | --bg-pending-light: #292524; /* stone-800 */ 62 | --bg-input: #374151; /* gray-700 */ 63 | --bg-audio-player: linear-gradient(to right, #374151, #4b5563); /* gray-700, gray-600 */ 64 | 65 | --text-primary: #f3f4f6; /* gray-100 */ 66 | --text-secondary: #d1d5db; /* gray-300 */ 67 | --text-muted: #9ca3af; /* gray-400 */ 68 | --text-light: #6b7280; /* gray-500 */ 69 | --text-accent: #60a5fa; /* blue-400 */ 70 | --text-button: #ffffff; /* white */ 71 | --text-danger: #f87171; /* red-400 */ 72 | --text-danger-strong: #fca5a5; /* red-300 */ 73 | --text-info-strong: #93c5fd; /* blue-300 */ 74 | --text-warn-strong: #fcd34d; /* amber-300 */ 75 | --text-success-strong: #6ee7b7; /* green-300 */ 76 | --text-pending-strong: #d6d3d1; /* stone-300 */ 77 | 78 | --border-primary: #374151; /* gray-700 */ 79 | --border-secondary: #4b5563; /* gray-600 */ 80 | --border-accent: #1d4ed8; /* blue-700 */ 81 | --border-danger: #ef4444; /* red-500 */ 82 | --border-focus: #3b82f6; /* blue-500 */ 83 | --ring-focus: #1e40af; /* blue-800 */ 84 | 85 | --scrollbar-track: #2d3748; /* gray-800 */ 86 | --scrollbar-thumb: #4a5568; /* gray-600 */ 87 | --scrollbar-thumb-hover: #718096; /* gray-500 */ 88 | } 89 | 90 | /* Modern UI styles */ 91 | .height-100 { height: 100%; } 92 | .drag-area { transition: background-color 0.3s ease, border-color 0.3s ease; } 93 | .custom-scrollbar::-webkit-scrollbar { width: 6px; } 94 | .custom-scrollbar::-webkit-scrollbar-track { background: var(--scrollbar-track); border-radius: 12px; } 95 | .custom-scrollbar::-webkit-scrollbar-thumb { background: var(--scrollbar-thumb); border-radius: 12px; } 96 | .custom-scrollbar::-webkit-scrollbar-thumb:hover { background: var(--scrollbar-thumb-hover); } 97 | html { /* Apply base colors to html for smoother transitions */ 98 | background-color: var(--bg-primary); 99 | color: var(--text-primary); 100 | transition: background-color 0.3s, color 0.3s; 101 | font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; 102 | } 103 | html { 104 | height: 100%; 105 | margin: 0; 106 | } 107 | body { 108 | height: 100%; 109 | margin: 0; 110 | overflow-y: auto; /* Allow scrolling on the body */ 111 | } 112 | 113 | /* Mobile fly-in menu specific styles */ 114 | @media (max-width: 1023px) { /* Corresponds to Tailwind's lg breakpoint */ 115 | .sidebar-container.fixed { 116 | height: 100vh; /* Full viewport height */ 117 | overflow-y: auto; /* Allow scrolling within the fly-in menu */ 118 | } 119 | .main-content-area { 120 | transition: filter 0.3s ease-in-out; 121 | } 122 | body.mobile-menu-open .main-content-area { 123 | filter: blur(4px); /* Optional: blur background when menu is open */ 124 | } 125 | body.mobile-menu-open { 126 | overflow: hidden; /* Prevent body scroll when mobile menu is open */ 127 | } 128 | } 129 | 130 | /* Mobile viewport height fix */ 131 | @media (max-width: 767px) { /* Target mobile devices specifically */ 132 | .main { 133 | min-height: 4000px !important; /* Fixed viewport height for mobile */ 134 | } 135 | } 136 | #app { 137 | min-height: 100%; /* Full viewport height */ 138 | display: flex; 139 | flex-direction: column; 140 | } 141 | main { 142 | flex: 1; 143 | position: relative; 144 | display: flex; 145 | flex-direction: column; 146 | overflow-y: auto; /* Allow scrolling on main */ 147 | } 148 | 149 | /* Sidebar styles with flexible height */ 150 | .sidebar-container { 151 | height: 100%; /* Use relative height */ 152 | display: flex; 153 | flex-direction: column; 154 | overflow-y: auto; /* Allow sidebar to scroll */ 155 | } 156 | 157 | /* Grid container with flex layout and flexible height */ 158 | .grid-container { 159 | height: 100%; /* Use relative height */ 160 | display: flex; 161 | flex-direction: column; 162 | overflow-y: auto; /* Allow scrolling */ 163 | } 164 | 165 | .sidebar-header { 166 | flex-shrink: 0; /* Prevent header from shrinking */ 167 | } 168 | 169 | .sidebar-content { 170 | flex-grow: 1; 171 | overflow-y: auto; /* Enable scrolling for content */ 172 | padding-right: 6px; /* Space for scrollbar */ 173 | min-height: 0; /* Added for robust flex scrolling */ 174 | } 175 | .progress-popup { position: fixed; bottom: 1rem; left: 1rem; z-index: 100; transition: all 0.3s ease-in-out; min-width: 300px; border-radius: 12px; overflow: hidden; } 176 | .progress-popup.minimized { transform: translateY(calc(100% - 45px)); } 177 | .progress-list-item { display: grid; grid-template-columns: auto 1fr auto; gap: 0.5rem; align-items: center; } 178 | /* Unified style for content boxes (summary, notes, transcription) */ 179 | .summary-box, .transcription-box, .notes-box { 180 | background-color: var(--bg-tertiary); 181 | padding: 1rem; /* p-4 */ 182 | border-radius: 0.75rem; /* rounded-xl */ 183 | border: 1px solid var(--border-primary); 184 | min-height: 0; /* Allow proper flex shrinking for scrolling */ 185 | overflow-y: auto; /* Enable vertical scrolling */ 186 | white-space: normal; /* Allow markdown HTML to control spacing */ 187 | font-family: inherit; /* Use body font */ 188 | font-size: 0.875rem; /* text-sm */ 189 | line-height: 1.5; /* Consistent line height */ 190 | box-shadow: 0 1px 2px rgba(0,0,0,0.03); /* Subtle shadow */ 191 | flex: 1; /* Take up available space */ 192 | color: var(--text-secondary); 193 | } 194 | 195 | /* Standardize border radius for all content boxes */ 196 | .transcription-box, 197 | .summary-box, 198 | .chat-container, 199 | textarea, 200 | div[v-if="!editingParticipants"], 201 | div[v-if="!editingNotes"] { 202 | border-radius: 0.75rem !important; /* rounded-xl */ 203 | } 204 | 205 | /* Content boxes with flex layout */ 206 | .content-column { 207 | display: flex; 208 | flex-direction: column; 209 | height: 100%; 210 | min-height: 0; /* Allow content to size based on parent container */ 211 | flex: 1 1 auto; /* Grow and shrink as needed */ 212 | overflow: hidden; 213 | } 214 | 215 | /* Left column content (participants, transcription, tabs) */ 216 | .left-content { 217 | display: flex; 218 | flex-direction: column; 219 | height: 100%; 220 | gap: 1rem; 221 | overflow-y: auto; /* Enable scrolling for content that exceeds container */ 222 | min-height: 0; /* Allows flex to work properly */ 223 | } 224 | 225 | /* Right column content (audio player, chat) */ 226 | .right-content { 227 | display: flex; 228 | flex-direction: column; 229 | height: 100%; 230 | gap: 1rem; 231 | overflow-y: auto; /* Enable scrolling for content that exceeds container */ 232 | min-height: 0; /* Allows flex to work properly */ 233 | } 234 | 235 | /* Participants section - small fixed height */ 236 | .participants-section { 237 | flex-shrink: 0; 238 | } 239 | 240 | /* Transcription section - takes up significant space */ 241 | .transcription-section { 242 | flex: 2; 243 | min-height: 0; /* Allows flex to work properly */ 244 | overflow-y: auto; /* Changed from hidden to auto to enable scrolling */ 245 | display: flex; 246 | flex-direction: column; 247 | } 248 | 249 | /* Tab content section - takes up remaining space and aligns with chat box */ 250 | .tab-section { 251 | flex: 1; 252 | min-height: 100px; /* Minimum height to prevent collapsing too much */ 253 | overflow-y: auto; /* Changed from hidden to auto to enable scrolling */ 254 | display: flex; 255 | flex-direction: column; 256 | height: 100%; /* Ensure it takes full height */ 257 | } 258 | 259 | /* Audio player section - small fixed height */ 260 | .audio-section { 261 | flex-shrink: 0; 262 | } 263 | 264 | /* Chat section - takes up remaining space */ 265 | .chat-section { 266 | flex: 1; 267 | min-height: 0; /* Allows flex to work properly */ 268 | overflow-y: auto; /* Changed from hidden to auto to enable scrolling */ 269 | display: flex; 270 | flex-direction: column; 271 | } 272 | 273 | .tab-content-box { 274 | flex: 1; 275 | overflow-y: auto; 276 | min-height: 0; /* Allows flex to work properly */ 277 | height: 100%; /* Fill available height */ 278 | display: flex; 279 | flex-direction: column; 280 | } 281 | 282 | .chat-content-box { 283 | flex: 1; 284 | overflow-y: auto; 285 | min-height: 0; /* Allows flex to work properly */ 286 | } 287 | .metadata-panel { 288 | background-color: var(--bg-tertiary); 289 | border: 1px solid var(--border-primary); 290 | border-radius: 0.75rem; /* rounded-xl to match others */ 291 | padding: 1rem; /* p-4 to be consistent */ 292 | /* margin-top removed to align with other boxes */ 293 | font-size: 0.875rem; /* text-sm */ 294 | color: var(--text-secondary); 295 | flex: 1; /* Take up available space */ 296 | height: 100%; /* Fill the container height */ 297 | overflow-y: auto; /* Enable scrolling when content overflows */ 298 | } 299 | .metadata-panel dt { 300 | font-weight: 500; 301 | color: var(--text-primary); 302 | margin-bottom: 0.1rem; 303 | } 304 | .metadata-panel dd { 305 | margin-left: 0; 306 | margin-bottom: 0.5rem; 307 | word-break: break-all; /* Wrap long filenames */ 308 | } 309 | .status-badge { 310 | display: inline-block; 311 | padding: 0.12rem 0.5rem; /* Even smaller padding */ 312 | font-size: 0.6rem; /* Smaller text */ 313 | font-weight: 500; /* font-medium */ 314 | border-radius: 9999px; /* rounded-full */ 315 | box-shadow: 0 1px 2px rgba(0,0,0,0.05); 316 | letter-spacing: 0.025em; 317 | vertical-align: middle; /* Align with text */ 318 | margin-left: 0.5rem; /* Less space */ 319 | opacity: 0.85; /* Slightly more subtle */ 320 | transition: opacity 0.2s ease; 321 | } 322 | .status-badge:hover { 323 | opacity: 1; 324 | } 325 | .status-processing { color: #1d4ed8; background-color: #dbeafe; } /* text-blue-800 bg-blue-100 */ 326 | .status-summarizing { color: #92400e; background-color: #fef3c7; } /* text-amber-800 bg-amber-100 */ 327 | .status-completed { color: #065f46; background-color: #d1fae5; } /* text-green-800 bg-green-100 */ 328 | .status-failed { color: #991b1b; background-color: #fee2e2; } /* text-red-800 bg-red-100 */ 329 | .status-pending { color: #57534e; background-color: #f5f5f4; } /* text-stone-700 bg-stone-100 */ 330 | 331 | /* Transcription box with flex layout */ 332 | .transcription-box { 333 | flex: 1; 334 | overflow-y: auto; 335 | position: relative; 336 | min-height: 0; /* Allows flex to work properly */ 337 | } 338 | 339 | /* Modern copy button styles */ 340 | .copy-btn { 341 | position: sticky; 342 | top: 10px; 343 | right: 10px; 344 | float: right; 345 | background-color: rgba(255, 255, 255, 0.9); 346 | border: 1px solid #e5e7eb; 347 | border-radius: 0.5rem; 348 | padding: 0.35rem 0.75rem; 349 | font-size: 0.75rem; 350 | cursor: pointer; 351 | z-index: 10; 352 | transition: all 0.2s cubic-bezier(0.25, 0.1, 0.25, 1); 353 | margin-bottom: 10px; 354 | box-shadow: 0 1px 2px rgba(0,0,0,0.05); 355 | } 356 | 357 | .copy-btn:hover { 358 | background-color: #f3f4f6; 359 | transform: translateY(-1px); 360 | box-shadow: 0 2px 4px rgba(0,0,0,0.1); 361 | } 362 | 363 | /* Hover edit button styles */ 364 | .content-box { 365 | position: relative; 366 | overflow-y: auto; /* Allow content to scroll */ 367 | } 368 | 369 | .hover-edit-btn { 370 | position: absolute; 371 | top: 10px; 372 | right: 10px; 373 | background-color: rgba(255, 255, 255, 0.9); 374 | border: 1px solid #e5e7eb; 375 | border-radius: 0.5rem; 376 | padding: 0.35rem 0.75rem; 377 | font-size: 0.75rem; 378 | cursor: pointer; 379 | z-index: 10; 380 | transition: all 0.2s ease; 381 | box-shadow: 0 1px 2px rgba(0,0,0,0.05); 382 | opacity: 0; 383 | } 384 | 385 | .content-box:hover .hover-edit-btn { 386 | opacity: 1; 387 | } 388 | 389 | .hover-edit-btn:hover { 390 | background-color: #f3f4f6; 391 | transform: translateY(-1px); 392 | box-shadow: 0 2px 4px rgba(0,0,0,0.1); 393 | } 394 | 395 | .dark .hover-edit-btn { 396 | background-color: rgba(55, 65, 81, 0.9); 397 | border-color: #4b5563; 398 | } 399 | 400 | .dark .hover-edit-btn:hover { 401 | background-color: #4b5563; 402 | } 403 | 404 | /* Modern chat section styles */ 405 | .chat-container { 406 | border: 1px solid #e5e7eb; 407 | border-radius: 0.75rem; 408 | display: flex; 409 | flex-direction: column; 410 | height: 100%; 411 | min-height: 300px; /* Minimum height for chat container */ 412 | box-shadow: 0 1px 3px rgba(0,0,0,0.05); 413 | overflow: hidden; 414 | } 415 | 416 | .chat-messages { 417 | flex-grow: 1; 418 | overflow-y: auto; 419 | padding: 1.25rem; 420 | } 421 | 422 | .chat-input-container { 423 | border-top: 1px solid #e5e7eb; 424 | padding: 0.75rem; 425 | display: flex; 426 | background-color: var(--bg-tertiary); 427 | } 428 | 429 | .message { 430 | margin-bottom: 1.25rem; 431 | max-width: 80%; 432 | box-shadow: 0 1px 2px rgba(0,0,0,0.05); 433 | line-height: 1.5; 434 | } 435 | 436 | .user-message { 437 | background-color: #dbeafe; 438 | border-radius: 1.25rem 1.25rem 0.25rem 1.25rem; 439 | padding: 0.875rem 1rem; 440 | margin-left: auto; 441 | } 442 | 443 | .ai-message { 444 | background-color: #f3f4f6; 445 | border-radius: 1.25rem 1.25rem 1.25rem 0.25rem; 446 | padding: 0.875rem 1rem; 447 | } 448 | 449 | .copyable { 450 | position: relative; 451 | } 452 | 453 | /* Markdown styling */ 454 | .ai-message h1, .ai-message h2, .ai-message h3, 455 | .summary-box h1, .summary-box h2, .summary-box h3, 456 | .notes-box h1, .notes-box h2, .notes-box h3 { 457 | font-weight: 600; 458 | margin-top: 1rem; 459 | margin-bottom: 0.5rem; 460 | } 461 | 462 | .ai-message h1, .summary-box h1, .notes-box h1 { font-size: 1.25rem; } 463 | .ai-message h2, .summary-box h2, .notes-box h2 { font-size: 1.15rem; } 464 | .ai-message h3, .summary-box h3, .notes-box h3 { font-size: 1.05rem; } 465 | 466 | .ai-message p, .summary-box p, .notes-box p { 467 | margin-bottom: 0.75rem; 468 | } 469 | 470 | .ai-message ul, .ai-message ol, 471 | .summary-box ul, .summary-box ol, 472 | .notes-box ul, .notes-box ol { 473 | margin-left: 1.5rem; 474 | margin-bottom: 0.75rem; 475 | list-style-position: outside; /* Ensures bullets are outside the text flow */ 476 | } 477 | 478 | .ai-message ul, .summary-box ul, .notes-box ul { list-style-type: disc; } 479 | .ai-message ol, .summary-box ol, .notes-box ol { list-style-type: decimal; } 480 | 481 | .ai-message li, .summary-box li, .notes-box li { 482 | display: list-item; /* Ensure li elements are treated as list items */ 483 | margin-bottom: 0.25rem; /* Add some space between list items */ 484 | } 485 | 486 | .ai-message code, .summary-box code, .notes-box code { 487 | background-color: #f1f1f1; /* Consider using var(--bg-tertiary) or similar for theme consistency */ 488 | padding: 0.1rem 0.3rem; 489 | border-radius: 0.25rem; 490 | font-family: monospace; 491 | font-size: 0.9em; 492 | } 493 | 494 | .ai-message pre, .summary-box pre, .notes-box pre { 495 | background-color: #f1f1f1; /* Consider using var(--bg-tertiary) or similar */ 496 | padding: 0.75rem; 497 | border-radius: 0.25rem; 498 | overflow-x: auto; 499 | margin-bottom: 0.75rem; 500 | } 501 | 502 | .ai-message pre code, .summary-box pre code, .notes-box pre code { 503 | background-color: transparent; 504 | padding: 0; 505 | border-radius: 0; 506 | } 507 | 508 | .ai-message table, .summary-box table, .notes-box table { 509 | border-collapse: collapse; 510 | width: 100%; 511 | margin-bottom: 0.75rem; 512 | } 513 | 514 | .ai-message th, .ai-message td, 515 | .summary-box th, .summary-box td, 516 | .notes-box th, .notes-box td { 517 | border: 1px solid var(--border-secondary); /* Use theme variable */ 518 | padding: 0.5rem; 519 | text-align: left; 520 | } 521 | 522 | .ai-message th, .summary-box th, .notes-box th { 523 | background-color: var(--bg-tertiary); /* Use theme variable */ 524 | font-weight: 600; 525 | } 526 | 527 | .ai-message blockquote, .summary-box blockquote, .notes-box blockquote { 528 | border-left: 4px solid var(--border-secondary); /* Use theme variable */ 529 | padding-left: 1rem; 530 | margin-left: 0; 531 | margin-bottom: 0.75rem; 532 | color: var(--text-muted); /* Use theme variable */ 533 | } 534 | 535 | /* Main content container - ensure it fills available space and allows scrolling */ 536 | .flex-grow.flex.flex-col.md\:flex-row.gap-6.overflow-hidden { 537 | max-height: none !important; /* Override the inline style */ 538 | height: 100%; 539 | flex: 1; 540 | overflow-y: auto; /* Allow scrolling */ 541 | } 542 | 543 | /* Ensure the lg:col-span-3 container can grow properly and scroll */ 544 | .lg\:col-span-3.bg-\[var\(--bg-secondary\)\].p-6.rounded-lg.shadow-md.flex.flex-col.max-h-85vh { 545 | /* max-height: none !important; /* Let Tailwind class 'max-h-85vh' apply */ 546 | height: 100%; /* Occupy the height of its grid cell */ 547 | flex: 1; /* For its own children, as it's a flex container */ 548 | overflow-y: auto; /* Allow its own content to scroll if it exceeds its height (max 85vh) */ 549 | } 550 | 551 | /* Modern toast notification styles */ 552 | .toast-container { 553 | position: fixed; 554 | bottom: 20px; 555 | right: 20px; 556 | z-index: 1000; 557 | display: flex; 558 | flex-direction: column; 559 | align-items: flex-end; 560 | gap: 12px; 561 | } 562 | 563 | /* Form styling for edit modal */ 564 | .form-group { 565 | position: relative; 566 | transition: all 0.3s ease; 567 | } 568 | 569 | .form-group:hover { 570 | transform: translateY(-1px); 571 | } 572 | 573 | .form-group input:focus, 574 | .form-group textarea:focus { 575 | box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2); 576 | } 577 | 578 | /* Dark mode adjustments for form elements */ 579 | .dark .form-group input:focus, 580 | .dark .form-group textarea:focus { 581 | box-shadow: 0 0 0 3px rgba(30, 64, 175, 0.3); 582 | } 583 | 584 | /* Elegant divider styling */ 585 | .relative.py-3 { 586 | margin: 0.5rem 0; 587 | } 588 | 589 | /* Toast notification styles */ 590 | .toast { 591 | padding: 12px 18px; 592 | border-radius: 8px; 593 | background-color: #4CAF50; 594 | color: white; 595 | font-size: 14px; 596 | box-shadow: 0 4px 12px rgba(0,0,0,0.1); 597 | opacity: 0; 598 | transform: translateY(20px); 599 | transition: all 0.3s cubic-bezier(0.25, 0.1, 0.25, 1); 600 | display: flex; 601 | align-items: center; 602 | min-width: 200px; 603 | } 604 | 605 | .toast.show { 606 | opacity: 1; 607 | transform: translateY(0); 608 | } 609 | 610 | .toast i { 611 | margin-right: 8px; 612 | } 613 | 614 | /* Copy button animation */ 615 | @keyframes copy-success { 616 | 0% { transform: scale(1); } 617 | 50% { transform: scale(1.2); } 618 | 100% { transform: scale(1); } 619 | } 620 | 621 | .copy-success { 622 | animation: copy-success 0.3s ease; 623 | color: #4CAF50 !important; 624 | } 625 | 626 | /* Fix for sidebar height and scrolling */ 627 | /* Remove fixed height constraint from the grid container to allow natural height */ 628 | .grid.grid-cols-1.lg\:grid-cols-4.gap-6.flex-grow { 629 | display: grid; 630 | min-height: 0; /* Allow the grid to shrink if needed */ 631 | overflow: visible; /* Allow overflow to be visible and scroll with the main window */ 632 | } 633 | 634 | /* Set a fixed height for the sidebar only */ 635 | .lg\:col-span-1.bg-\[var\(--bg-secondary\)\].p-4.rounded-lg.shadow-md.sidebar-container.max-h-85vh { 636 | display: flex; 637 | flex-direction: column; 638 | overflow: hidden; /* Hide overflow at container level */ 639 | height: calc(100vh - 10rem); 640 | position: sticky; 641 | top: 1rem; /* Stick to the top with some padding */ 642 | } 643 | 644 | /* Make sure the sidebar content scrolls internally */ 645 | .sidebar-content { 646 | flex: 1; 647 | overflow-y: auto; /* Enable scrolling for content */ 648 | min-height: 0; /* Allow content to shrink */ 649 | } 650 | 651 | /* Ensure the main content area uses the window scroll */ 652 | .lg\:col-span-3.bg-\[var\(--bg-secondary\)\].p-6.rounded-lg.shadow-md.flex.flex-col.max-h-85vh { 653 | max-height: none !important; /* Override the max-height constraint */ 654 | height: auto; /* Let height be determined by content */ 655 | overflow: visible; /* Use the window scroll */ 656 | } 657 | 658 | /* Allow the main container to use window scrolling */ 659 | main { 660 | overflow-y: visible; /* Use window scrolling instead of internal scrolling */ 661 | } 662 | 663 | /* Ensure body scrolls when content exceeds viewport */ 664 | body { 665 | overflow-y: auto; /* Allow scrolling on the body */ 666 | } 667 | 668 | /* Blinking animation for recording indicator */ 669 | @keyframes blink-animation { 670 | 0% { opacity: 1; } 671 | 50% { opacity: 0.3; } 672 | 100% { opacity: 1; } 673 | } 674 | .blink { 675 | animation: blink-animation 1.5s infinite; 676 | } 677 | -------------------------------------------------------------------------------- /static/img/favicon.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /static/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "id": "com.whispertranscribe.app", 3 | "name": "WhisperTranscribe", 4 | "short_name": "WhisperT", 5 | "description": "WhisperTranscribe Application - Audio transcription and summarization", 6 | "start_url": "/", 7 | "scope": "/", 8 | "display": "standalone", 9 | "display_override": ["window-controls-overlay", "standalone"], 10 | "background_color": "#000000", 11 | "theme_color": "#000000", 12 | "orientation": "any", 13 | "prefer_related_applications": false, 14 | "categories": ["productivity", "utilities", "business"], 15 | "lang": "en", 16 | "dir": "ltr", 17 | "icons": [ 18 | { 19 | "src": "/static/img/icon-192x192.png", 20 | "sizes": "192x192", 21 | "type": "image/png", 22 | "purpose": "any" 23 | }, 24 | { 25 | "src": "/static/img/icon-192x192.png", 26 | "sizes": "192x192", 27 | "type": "image/png", 28 | "purpose": "maskable" 29 | }, 30 | { 31 | "src": "/static/img/icon-512x512.png", 32 | "sizes": "512x512", 33 | "type": "image/png", 34 | "purpose": "any" 35 | }, 36 | { 37 | "src": "/static/img/icon-512x512.png", 38 | "sizes": "512x512", 39 | "type": "image/png", 40 | "purpose": "maskable" 41 | } 42 | ], 43 | "shortcuts": [ 44 | { 45 | "name": "New Recording", 46 | "short_name": "New", 47 | "description": "Upload or record new audio", 48 | "url": "/#upload", 49 | "icons": [{ "src": "/static/img/icon-192x192.png", "sizes": "192x192" }] 50 | }, 51 | { 52 | "name": "View Gallery", 53 | "short_name": "Gallery", 54 | "description": "Access your recordings gallery", 55 | "url": "/#gallery", 56 | "icons": [{ "src": "/static/img/icon-192x192.png", "sizes": "192x192" }] 57 | } 58 | ], 59 | "share_target": { 60 | "action": "/#upload", 61 | "method": "POST", 62 | "enctype": "multipart/form-data", 63 | "params": { 64 | "title": "title", 65 | "text": "text", 66 | "url": "url", 67 | "files": [ 68 | { 69 | "name": "shared_audio", 70 | "accept": ["audio/*"] 71 | } 72 | ] 73 | } 74 | }, 75 | "edge_side_panel": { 76 | "preferred_width": 480 77 | } 78 | } 79 | -------------------------------------------------------------------------------- /static/offline.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Offline - WhisperTranscribe 7 | 8 | 55 | 56 | 57 |
58 | WhisperTranscribe Logo 59 |

You're Offline

60 |

It looks like you're not connected to the internet. Please check your connection and try again.

61 |

Some content may be unavailable until you're back online.

62 |
63 | 64 | 65 | -------------------------------------------------------------------------------- /static/sw.js: -------------------------------------------------------------------------------- 1 | const CACHE_NAME = 'whispertranscribe-cache-v3'; 2 | const ASSETS_TO_CACHE = [ 3 | '/', 4 | '/static/offline.html', 5 | '/static/manifest.json', 6 | '/static/css/styles.css', 7 | '/static/js/app.js', 8 | '/static/img/icon-192x192.png', // Assuming you will add this 9 | '/static/img/icon-512x512.png', // Assuming you will add this 10 | '/static/img/favicon.svg', // Keep existing SVG as a fallback or for other uses 11 | // HTML templates (these are typically served via routes, but caching the routes themselves is handled by fetch strategies) 12 | // We cache '/' which should serve the main page. 13 | // Other specific page routes like /login, /register, /account will be handled by networkFirst. 14 | // CDN assets - caching these can be beneficial but also complex if they change often. 15 | 'https://cdn.tailwindcss.com', 16 | 'https://unpkg.com/vue@3/dist/vue.global.js', 17 | 'https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/all.min.css' 18 | ]; 19 | 20 | // Function to update shortcuts (structure from your example) 21 | // The actual `lists` data would need to be sent from your client-side app.js 22 | const updateShortcuts = async (lists) => { 23 | if (!self.registration || !('shortcuts' in self.registration)) { 24 | console.log('Shortcuts API not supported or registration not available.'); 25 | return; 26 | } 27 | 28 | try { 29 | let shortcuts = [ 30 | { 31 | name: "New Recording", 32 | short_name: "New", 33 | description: "Upload or record new audio", 34 | url: "/#upload", // Or your direct upload page route 35 | icons: [{ src: "/static/img/icon-192x192.png", sizes: "192x192" }] 36 | }, 37 | { 38 | name: "View Gallery", 39 | short_name: "Gallery", 40 | description: "Access your recordings gallery", 41 | url: "/#gallery", // Or your direct gallery page route 42 | icons: [{ src: "/static/img/icon-192x192.png", sizes: "192x192" }] 43 | } 44 | ]; 45 | 46 | // Example: If you had dynamic lists to add as shortcuts 47 | if (Array.isArray(lists) && lists.length > 0) { 48 | const dynamicShortcuts = lists.slice(0, 2).map(list => { // Max 2 dynamic, total 4 49 | if (list && list.id && list.title) { 50 | return { 51 | name: list.title, 52 | short_name: list.title.length > 10 ? list.title.substring(0, 9) + '…' : list.title, 53 | description: `View ${list.title}`, 54 | url: `/list/${list.id}`, // Example dynamic URL 55 | icons: [{ src: "/static/img/icon-192x192.png", sizes: "192x192" }] 56 | }; 57 | } 58 | return null; 59 | }).filter(Boolean); 60 | shortcuts = [...shortcuts, ...dynamicShortcuts]; 61 | } 62 | 63 | await self.registration.shortcuts.set(shortcuts); 64 | console.log('PWA shortcuts updated successfully:', shortcuts); 65 | } catch (error) { 66 | console.error('Error updating PWA shortcuts:', error); 67 | } 68 | }; 69 | 70 | 71 | // Cache first strategy: Respond from cache if available, otherwise fetch from network and cache. 72 | const cacheFirst = async (request) => { 73 | const responseFromCache = await caches.match(request); 74 | if (responseFromCache) { 75 | return responseFromCache; 76 | } 77 | try { 78 | const responseFromNetwork = await fetch(request); 79 | // Check if the response is valid before caching 80 | if (responseFromNetwork && responseFromNetwork.ok) { 81 | const cache = await caches.open(CACHE_NAME); 82 | cache.put(request, responseFromNetwork.clone()); 83 | } 84 | return responseFromNetwork; 85 | } catch (error) { 86 | console.error('CacheFirst: Network request failed for:', request.url, error); 87 | // For assets, returning a generic error or specific offline asset might be better than network error. 88 | // However, if it's a critical asset not found, this indicates an issue. 89 | return new Response('Network error trying to fetch asset.', { 90 | status: 408, 91 | headers: { 'Content-Type': 'text/plain' }, 92 | }); 93 | } 94 | }; 95 | 96 | // Stale-while-revalidate strategy: Respond from cache immediately if available, 97 | // then update the cache with a fresh response from the network. 98 | const staleWhileRevalidate = async (request) => { 99 | const cache = await caches.open(CACHE_NAME); 100 | const cachedResponsePromise = cache.match(request); 101 | const networkResponsePromise = fetch(request).then(networkResponse => { 102 | if (networkResponse && networkResponse.ok) { 103 | cache.put(request, networkResponse.clone()); 104 | } 105 | return networkResponse; 106 | }).catch(error => { 107 | console.error('StaleWhileRevalidate: Network request failed for:', request.url, error); 108 | // If network fails, we still might have a cached response. 109 | // If not, this error will propagate. 110 | return new Response('API request failed and no cache available.', { 111 | status: 503, // Service Unavailable 112 | headers: { 'Content-Type': 'application/json' }, 113 | body: JSON.stringify({ error: 'Service temporarily unavailable. Please try again later.' }) 114 | }); 115 | }); 116 | 117 | return (await cachedResponsePromise) || networkResponsePromise; 118 | }; 119 | 120 | // Network first strategy: Try to fetch from network first. 121 | // If network fails, fall back to cache. If cache also fails, serve offline page for navigation. 122 | const networkFirst = async (request) => { 123 | try { 124 | const networkResponse = await fetch(request); 125 | if (networkResponse && networkResponse.ok) { 126 | const cache = await caches.open(CACHE_NAME); 127 | cache.put(request, networkResponse.clone()); 128 | } 129 | return networkResponse; 130 | } catch (error) { 131 | console.warn('NetworkFirst: Network request failed for:', request.url, error); 132 | const cachedResponse = await caches.match(request); 133 | if (cachedResponse) { 134 | return cachedResponse; 135 | } 136 | // For navigation requests, fall back to the offline page if both network and cache fail. 137 | if (request.mode === 'navigate') { 138 | const offlinePage = await caches.match('/static/offline.html'); 139 | if (offlinePage) return offlinePage; 140 | } 141 | // For other types of requests, or if offline page isn't cached, re-throw or return error. 142 | return new Response('Network error and no cache available.', { 143 | status: 408, 144 | headers: { 'Content-Type': 'text/plain' }, 145 | }); 146 | } 147 | }; 148 | 149 | self.addEventListener('install', (event) => { 150 | self.skipWaiting(); // Activate new service worker immediately 151 | event.waitUntil( 152 | caches.open(CACHE_NAME).then((cache) => { 153 | console.log('Service Worker: Caching app shell'); 154 | return cache.addAll(ASSETS_TO_CACHE.map(url => new Request(url, { cache: 'reload' }))) // Force reload from network for app shell 155 | .catch(error => { 156 | console.error('Failed to cache app shell during install:', error); 157 | // You might want to log which specific asset failed 158 | ASSETS_TO_CACHE.forEach(url => { 159 | cache.add(new Request(url, { cache: 'reload' })).catch(err => console.warn(`Failed to cache: ${url}`, err)); 160 | }); 161 | }); 162 | }) 163 | ); 164 | }); 165 | 166 | self.addEventListener('activate', (event) => { 167 | event.waitUntil( 168 | caches.keys().then((cacheNames) => { 169 | return Promise.all( 170 | cacheNames 171 | .filter((name) => name !== CACHE_NAME) 172 | .map((name) => { 173 | console.log('Service Worker: Deleting old cache', name); 174 | return caches.delete(name); 175 | }) 176 | ); 177 | }).then(() => { 178 | console.log('Service Worker: Activated and old caches cleared.'); 179 | return self.clients.claim(); // Take control of all open clients 180 | }) 181 | ); 182 | }); 183 | 184 | self.addEventListener('fetch', (event) => { 185 | const request = event.request; 186 | const url = new URL(request.url); 187 | 188 | // Skip non-GET requests from caching strategies (they should pass through) 189 | if (request.method !== 'GET') { 190 | // event.respondWith(fetch(request)); // Let non-GET requests pass through to the network 191 | return; // Or simply return to let the browser handle it 192 | } 193 | 194 | // Serve API calls from /api/ with stale-while-revalidate 195 | // (excluding auth-related endpoints) 196 | if (url.pathname.startsWith('/api/')) { 197 | if (url.pathname.includes('/login') || url.pathname.includes('/logout') || url.pathname.includes('/auth')) { 198 | // For auth, always go to network, don't cache 199 | event.respondWith(fetch(request)); 200 | return; 201 | } 202 | event.respondWith(staleWhileRevalidate(request)); 203 | return; 204 | } 205 | 206 | // Serve /audio/ requests with cache-first, then network. 207 | // These are media files and can be large, so cache-first is good. 208 | if (url.pathname.startsWith('/audio/')) { 209 | event.respondWith(cacheFirst(request)); 210 | return; 211 | } 212 | 213 | // Handle navigation requests (HTML pages) with network-first, then cache, then offline page. 214 | if (request.mode === 'navigate') { 215 | event.respondWith(networkFirst(request)); 216 | return; 217 | } 218 | 219 | // For static assets listed in ASSETS_TO_CACHE, use cache-first. 220 | // This ensures that if an asset path is directly requested, it's served from cache if possible. 221 | // We need to match against the origin + pathname for ASSETS_TO_CACHE. 222 | const requestPath = url.origin === self.origin ? url.pathname : request.url; 223 | if (ASSETS_TO_CACHE.includes(requestPath)) { 224 | event.respondWith(cacheFirst(request)); 225 | return; 226 | } 227 | 228 | // Default strategy for other GET requests: try cache, then network. 229 | // This is a good general fallback for other static assets not explicitly listed 230 | // or for assets from other origins if not handled by ASSETS_TO_CACHE. 231 | event.respondWith( 232 | caches.match(request).then((cachedResponse) => { 233 | if (cachedResponse) { 234 | return cachedResponse; 235 | } 236 | return fetch(request).then(networkResponse => { 237 | // Optionally cache other successful GET responses here if desired 238 | // if (networkResponse && networkResponse.ok) { 239 | // const cache = await caches.open(CACHE_NAME); 240 | // cache.put(request, networkResponse.clone()); 241 | // } 242 | return networkResponse; 243 | }).catch(() => { 244 | // If network fails for a non-navigation, non-API, non-explicitly-cached asset 245 | // there isn't much we can do other than return an error or nothing. 246 | // For simplicity, let the browser handle the error. 247 | }); 248 | }) 249 | ); 250 | }); 251 | 252 | // Listen for messages from the client (e.g., to update shortcuts) 253 | self.addEventListener('message', (event) => { 254 | if (event.data && event.data.type === 'UPDATE_SHORTCUTS') { 255 | console.log('Service Worker: Received UPDATE_SHORTCUTS message:', event.data.lists); 256 | // updateShortcuts(event.data.lists); // Call if you implement dynamic shortcuts based on client data 257 | } 258 | if (event.data && event.data.type === 'SKIP_WAITING') { 259 | self.skipWaiting(); 260 | } 261 | }); 262 | -------------------------------------------------------------------------------- /templates/account.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | {{ title }} - Speakr 7 | 8 | 9 | 10 | 98 | 99 | 100 |
101 |
102 |

103 | 104 | Speakr Logo 105 | Speakr 106 | 107 |

108 |
109 | 112 |
113 | 118 | 134 |
135 |
136 |
137 | 138 |
139 |
140 |

Account Information

141 | 142 | {% with messages = get_flashed_messages(with_categories=true) %} 143 | {% if messages %} 144 | {% for category, message in messages %} 145 |
146 | {{ message }} 147 |
148 | {% endfor %} 149 | {% endif %} 150 | {% endwith %} 151 | 152 |
153 | 154 |
155 |
156 |
157 |

Personal Information

158 |
159 |
160 | 161 | 162 |
163 |
164 | 165 | 166 |
167 |
168 | 169 | 170 |
171 |
172 |
173 | 174 |
175 |

Language & Prompt Preferences

176 |
177 |
178 | 179 | 180 |

Leave blank for auto-detection by transcription service.

181 |
182 |
183 | 184 | 185 |

Language for titles, summaries, and chat. Leave blank for default (usually English or transcription language).

186 |
187 |
188 | 189 | 190 |

This prompt will be used to generate the summary for your transcriptions. You can use placeholders like {{transcription}} and {{language_directive}} if needed, though the system will try to intelligently place the transcription content.

191 |
192 |
193 |
194 | 195 | 198 |
199 |
200 | 201 | 202 |
203 |
204 |

Account Statistics

205 |
206 |
207 |
208 | {{ current_user.recordings|length }} 209 | Total Recordings 210 |
211 | 212 |
213 | 214 | {% set completed_count = current_user.recordings|selectattr('status', 'equalto', 'COMPLETED')|list|length %} 215 | {{ completed_count }} 216 | 217 | Completed 218 |
219 | 220 |
221 | 222 | {% set processing_count = current_user.recordings|selectattr('status', 'in', ['PENDING', 'PROCESSING', 'SUMMARIZING'])|list|length %} 223 | {{ processing_count }} 224 | 225 | Processing 226 |
227 | 228 |
229 | 230 | {% set failed_count = current_user.recordings|selectattr('status', 'equalto', 'FAILED')|list|length %} 231 | {{ failed_count }} 232 | 233 | Failed 234 |
235 |
236 |
237 |
238 | 239 |
240 |

User Details

241 |
242 |
243 | Username 244 | {{ current_user.username }} 245 |
246 |
247 | Email 248 | {{ current_user.email }} 249 |
250 |
251 |
252 | 253 |
254 |

Account Actions

255 |
256 | 257 | Go to Recordings 258 | 259 | 262 |
263 |
264 |
265 |
266 |
267 |
268 | 269 |
270 | Speakr © {{ now.year }} 271 |
272 |
273 | 274 | 275 | 302 | 303 | 395 | 396 | 397 | -------------------------------------------------------------------------------- /templates/admin.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Admin Dashboard - Speakr 7 | 8 | 9 | 10 | 11 | 103 | 104 | 105 |
106 |
107 |

108 | 109 | Speakr Logo 110 | Speakr 111 | 112 |

113 |
114 | 117 |
118 | 123 | 137 |
138 |
139 |
140 | 141 |
142 |
143 |

Admin Dashboard

144 | 145 | {% with messages = get_flashed_messages(with_categories=true) %} 146 | {% if messages %} 147 | {% for category, message in messages %} 148 |
149 | {{ message }} 150 |
151 | {% endfor %} 152 | {% endif %} 153 | {% endwith %} 154 | 155 | 156 |
157 | 169 |
170 | 171 | 172 |
173 |
174 |

User Management

175 | 178 |
179 | 180 | 181 |
182 |
183 | 184 | 187 |
188 |
189 | 190 | 191 |
192 | 193 | 194 | 195 | 196 | 197 | 198 | 199 | 200 | 201 | 202 | 203 | 204 | 205 | 206 | 207 | 208 | 209 | 213 | 214 | 215 | 228 | 229 | 230 | 238 | 239 | 240 |
IDUsernameEmailAdminRecordingsStorage UsedActions
${ user.id }${ user.username }${ user.email } 210 | Yes 211 | No 212 | ${ user.recordings_count }${ formatFileSize(user.storage_used) } 216 |
217 | 220 | 223 | 226 |
227 |
231 |
232 | Loading users... 233 |
234 |
235 | No users found. 236 |
237 |
241 |
242 |
243 | 244 | 245 |
246 |

System Statistics

247 | 248 | 249 |
250 |
251 |
252 |
253 | 254 |
255 |
256 |

Total Users

257 |

${ stats.total_users }

258 |
259 |
260 |
261 | 262 |
263 |
264 |
265 | 266 |
267 |
268 |

Total Recordings

269 |

${ stats.total_recordings }

270 |
271 |
272 |
273 | 274 |
275 |
276 |
277 | 278 |
279 |
280 |

Total Storage Used

281 |

${ formatFileSize(stats.total_storage) }

282 |
283 |
284 |
285 | 286 |
287 |
288 |
289 | 290 |
291 |
292 |

Total Queries

293 |

${ stats.total_queries }

294 |
295 |
296 |
297 |
298 | 299 | 300 |
301 |
302 |

Recording Status Distribution

303 |
304 |
305 | ${ stats.completed_recordings } 306 | Completed 307 |
308 |
309 | ${ stats.processing_recordings } 310 | Processing 311 |
312 |
313 | ${ stats.pending_recordings } 314 | Pending 315 |
316 |
317 | ${ stats.failed_recordings } 318 | Failed 319 |
320 |
321 |
322 | 323 |
324 |

Top Users by Storage

325 |
326 |
327 |
328 | 329 | ${ user.username } 330 |
331 |
332 | ${ formatFileSize(user.storage_used) } 333 | (${ user.recordings_count} recordings) 334 |
335 |
336 |
337 | No data available 338 |
339 |
340 |
341 |
342 |
343 |
344 |
345 | 346 |
347 | Speakr © {{ now.year }} 348 |
349 | 350 | 351 |
352 |
353 |
354 |

Add New User

355 | 356 |
357 |
358 |
359 | 360 | 361 |
362 |
363 | 364 | 365 |
366 |
367 | 368 | 369 |
370 |
371 | 372 | 373 |
374 |
375 | 376 | 377 |
378 |
379 | 380 | 381 |
382 |
383 |
384 |
385 | 386 | 387 |
388 |
389 |
390 |

Edit User

391 | 392 |
393 |
394 |
395 | 396 | 397 |
398 |
399 | 400 | 401 |
402 |
403 | 404 | 405 |
406 |
407 | 408 | 409 |
410 |
411 | 412 | 413 |
414 |
415 |
416 |
417 | 418 | 419 |
420 |
421 |
422 |

Confirm Delete

423 | 424 |
425 |

Are you sure you want to delete the user ${ userToDelete?.username }? This action cannot be undone.

426 |
427 | 428 | 429 |
430 |
431 |
432 |
433 | 434 | 734 | 735 | 736 | -------------------------------------------------------------------------------- /templates/login.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | {{ title }} - Speakr 7 | 8 | 9 | 10 | 98 | 99 | 100 |
101 |
102 |

103 | 104 | Speakr Logo 105 | Speakr 106 | 107 |

108 |
109 | 110 |
111 |
112 |

Login

113 | 114 | {% with messages = get_flashed_messages(with_categories=true) %} 115 | {% if messages %} 116 | {% for category, message in messages %} 117 |
118 | {{ message }} 119 |
120 | {% endfor %} 121 | {% endif %} 122 | {% endwith %} 123 | 124 |
125 | {{ form.hidden_tag() }} 126 | 127 |
128 | {{ form.email.label(class="block text-sm font-medium text-[var(--text-secondary)] mb-1") }} 129 | {% if form.email.errors %} 130 | {{ form.email(class="mt-1 block w-full rounded-md border-[var(--border-danger)] shadow-sm focus:border-[var(--border-focus)] focus:ring-[var(--ring-focus)] focus:ring-opacity-50 bg-[var(--bg-input)] text-[var(--text-primary)]") }} 131 |
132 | {% for error in form.email.errors %} 133 | {{ error }} 134 | {% endfor %} 135 |
136 | {% else %} 137 | {{ form.email(class="mt-1 block w-full rounded-md border-[var(--border-secondary)] shadow-sm focus:border-[var(--border-focus)] focus:ring-[var(--ring-focus)] focus:ring-opacity-50 bg-[var(--bg-input)] text-[var(--text-primary)]") }} 138 | {% endif %} 139 |
140 | 141 |
142 | {{ form.password.label(class="block text-sm font-medium text-[var(--text-secondary)] mb-1") }} 143 | {% if form.password.errors %} 144 | {{ form.password(class="mt-1 block w-full rounded-md border-[var(--border-danger)] shadow-sm focus:border-[var(--border-focus)] focus:ring-[var(--ring-focus)] focus:ring-opacity-50 bg-[var(--bg-input)] text-[var(--text-primary)]") }} 145 |
146 | {% for error in form.password.errors %} 147 | {{ error }} 148 | {% endfor %} 149 |
150 | {% else %} 151 | {{ form.password(class="mt-1 block w-full rounded-md border-[var(--border-secondary)] shadow-sm focus:border-[var(--border-focus)] focus:ring-[var(--ring-focus)] focus:ring-opacity-50 bg-[var(--bg-input)] text-[var(--text-primary)]") }} 152 | {% endif %} 153 |
154 | 155 |
156 | {{ form.remember(class="h-4 w-4 text-[var(--text-accent)] focus:ring-[var(--ring-focus)] border-[var(--border-secondary)] rounded") }} 157 | {{ form.remember.label(class="ml-2 block text-sm text-[var(--text-secondary)]") }} 158 |
159 | 160 |
161 | {{ form.submit(class="w-full py-2 px-4 border border-transparent rounded-md shadow-sm text-sm font-medium text-[var(--text-button)] bg-[var(--bg-button)] hover:bg-[var(--bg-button-hover)] focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-[var(--border-focus)]") }} 162 | 163 |
164 | Don't have an account? 165 | Register here 166 |
167 |
168 |
169 |
170 |
171 | 172 |
173 | Speakr © {{ now.year }} 174 |
175 |
176 | 177 | 178 | -------------------------------------------------------------------------------- /templates/register.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | {{ title }} - Speakr 7 | 8 | 9 | 10 | 98 | 99 | 100 |
101 |
102 |

103 | 104 | Speakr Logo 105 | Speakr 106 | 107 |

108 |
109 | 110 |
111 |
112 |

Create an Account

113 | 114 | {% with messages = get_flashed_messages(with_categories=true) %} 115 | {% if messages %} 116 | {% for category, message in messages %} 117 |
118 | {{ message }} 119 |
120 | {% endfor %} 121 | {% endif %} 122 | {% endwith %} 123 | 124 |
125 | {{ form.hidden_tag() }} 126 | 127 |
128 | {{ form.username.label(class="block text-sm font-medium text-[var(--text-secondary)] mb-1") }} 129 | {% if form.username.errors %} 130 | {{ form.username(class="mt-1 block w-full rounded-md border-[var(--border-danger)] shadow-sm focus:border-[var(--border-focus)] focus:ring-[var(--ring-focus)] focus:ring-opacity-50 bg-[var(--bg-input)] text-[var(--text-primary)]") }} 131 |
132 | {% for error in form.username.errors %} 133 | {{ error }} 134 | {% endfor %} 135 |
136 | {% else %} 137 | {{ form.username(class="mt-1 block w-full rounded-md border-[var(--border-secondary)] shadow-sm focus:border-[var(--border-focus)] focus:ring-[var(--ring-focus)] focus:ring-opacity-50 bg-[var(--bg-input)] text-[var(--text-primary)]") }} 138 | {% endif %} 139 |
140 | 141 |
142 | {{ form.email.label(class="block text-sm font-medium text-[var(--text-secondary)] mb-1") }} 143 | {% if form.email.errors %} 144 | {{ form.email(class="mt-1 block w-full rounded-md border-[var(--border-danger)] shadow-sm focus:border-[var(--border-focus)] focus:ring-[var(--ring-focus)] focus:ring-opacity-50 bg-[var(--bg-input)] text-[var(--text-primary)]") }} 145 |
146 | {% for error in form.email.errors %} 147 | {{ error }} 148 | {% endfor %} 149 |
150 | {% else %} 151 | {{ form.email(class="mt-1 block w-full rounded-md border-[var(--border-secondary)] shadow-sm focus:border-[var(--border-focus)] focus:ring-[var(--ring-focus)] focus:ring-opacity-50 bg-[var(--bg-input)] text-[var(--text-primary)]") }} 152 | {% endif %} 153 |
154 | 155 |
156 | {{ form.password.label(class="block text-sm font-medium text-[var(--text-secondary)] mb-1") }} 157 | {% if form.password.errors %} 158 | {{ form.password(class="mt-1 block w-full rounded-md border-[var(--border-danger)] shadow-sm focus:border-[var(--border-focus)] focus:ring-[var(--ring-focus)] focus:ring-opacity-50 bg-[var(--bg-input)] text-[var(--text-primary)]") }} 159 |
160 | {% for error in form.password.errors %} 161 | {{ error }} 162 | {% endfor %} 163 |
164 | {% else %} 165 | {{ form.password(class="mt-1 block w-full rounded-md border-[var(--border-secondary)] shadow-sm focus:border-[var(--border-focus)] focus:ring-[var(--ring-focus)] focus:ring-opacity-50 bg-[var(--bg-input)] text-[var(--text-primary)]") }} 166 | {% endif %} 167 |

Password must be at least 8 characters long.

168 |
169 | 170 |
171 | {{ form.confirm_password.label(class="block text-sm font-medium text-[var(--text-secondary)] mb-1") }} 172 | {% if form.confirm_password.errors %} 173 | {{ form.confirm_password(class="mt-1 block w-full rounded-md border-[var(--border-danger)] shadow-sm focus:border-[var(--border-focus)] focus:ring-[var(--ring-focus)] focus:ring-opacity-50 bg-[var(--bg-input)] text-[var(--text-primary)]") }} 174 |
175 | {% for error in form.confirm_password.errors %} 176 | {{ error }} 177 | {% endfor %} 178 |
179 | {% else %} 180 | {{ form.confirm_password(class="mt-1 block w-full rounded-md border-[var(--border-secondary)] shadow-sm focus:border-[var(--border-focus)] focus:ring-[var(--ring-focus)] focus:ring-opacity-50 bg-[var(--bg-input)] text-[var(--text-primary)]") }} 181 | {% endif %} 182 |
183 | 184 |
185 | {{ form.submit(class="w-full py-2 px-4 border border-transparent rounded-md shadow-sm text-sm font-medium text-[var(--text-button)] bg-[var(--bg-button)] hover:bg-[var(--bg-button-hover)] focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-[var(--border-focus)]") }} 186 | 187 |
188 | Already have an account? 189 | Login here 190 |
191 |
192 |
193 |
194 |
195 | 196 | 199 |
200 | 201 | 202 | --------------------------------------------------------------------------------