Compare commits

..
Author SHA1 Message Date
Brandon Thomas fb458cff2e better dev script 2026-09-26 18:07:10 -07:00
Brandon Thomas df707bf8e1 performance changes (#1959) 2026-09-26 17:50:36 -07:00
Brandon Thomas 780e4494e9 fix login video on desktop (#1958) 2026-09-26 17:08:31 -07:00
Brandon Thomas c3844acdad ArtCraft 0.41 (#1957)
- website-based login
2026-09-26 03:43:28 -07:00
Brandon Thomas 8456e2fd06 website based login challenges (#1956) 2026-09-26 03:42:09 -07:00
Brandon Thomas 95f8f659a5 ArtCraft 0.40.0 (#1955) 2026-09-18 16:26:35 -04:00
Brandon Thomas 3c5038c159 Added new models and modes: GPT Image 2.5, Wan, Output Formats (#1954) 2026-09-18 16:23:44 -04:00
Brandon Thomas 584fdb7044 backport midjourney fixes from ArtCraft-X (#1953) 2026-09-14 12:45:24 -04:00
Brandon Thomas 5c7807add6 readme update (#1952) 2026-09-11 18:47:17 -04:00
Brandon Thomas 906447fab2 artcraft 0.39: fix for CI builds (no-OP build) (#1950) 2026-09-11 15:47:13 -04:00
Brandon Thomas 6cc5ce7a67 Fix CI builds. We were relying on build caches. (#1949) 2026-09-11 15:46:14 -04:00
Brandon Thomas 9a9b406fdf bump artcraft to 0.38 to test repo reset (#1948)
The entire repo was purged of ancillary code (backend, frontend, models,
tools, etc.) and subsequently reset.

This is a no-op version that guarantees builds can continue on the new
repo state.
2026-09-11 14:48:01 -04:00
Brandon Thomas 28e5d71102 remove stale docs and files (#1947) 2026-09-11 14:43:33 -04:00
Brandon Thomas 0004726a36 ArtCraft Desktop (fresh start)
This is a fresh start for the `artcraft` repo.

The old monorepo, which included our web API gateway, job services, SRE
tools, various frontends, and more has moved to `artcraft-services`

You can find the full git history here:

https://github.com/storytold/artcraft-services

This change was motivated by the fact that the entire git history was
hundreds of gigabytes in size, which is unwieldy for anyone not in the
core team that doesn't care about support services outside of the core
artcraft app.

We wanted to keep this repo in its well-known place since we already
have users and activity here.

Please update your remotes to either `artcraft-services` or make a fresh
clone of this repo.

History can be found at the artcraft-services repo.
2026-09-11 14:19:51 -04:00
8047 changed files with 525688 additions and 532996 deletions
+56
View File
@@ -0,0 +1,56 @@
# API Conventions
## HTTP Handlers (Actix-Web)
Handlers in `storyteller_web` follow this structure:
1. **Request/Response types** with `#[derive(Deserialize/Serialize, ToSchema)]`
2. **Error enum** implementing `ResponseError`, `Display`, `Serialize`, `ToSchema`
3. **Handler function** annotated with `#[utoipa::path(...)]` for OpenAPI docs
4. Handler returns `Result<Json<Response>, ErrorType>`. Only use `Result<HttpResponse, ErrorType>` when you need to set headers/cookies.
### Error Types
- Use `CommonWebError` for simple handlers that only need standard HTTP error codes
- Use a custom error enum when you need endpoint-specific error variants (e.g. `LoginErrorType::InvalidCredentials`)
- Custom error enums MUST implement `ResponseError` (actix), `Display`, and `Serialize`
- When adding `From<RequireUserSessionError>` or similar conversions, implement them on `CommonWebError` in its own module (orphan rule)
- Error response bodies include: `success: false`, `error_code`, `error_code_str`
### Session/Auth
Helpers live in `storyteller_web` under `http_server/web_utils/user_session/`. Each takes a
generic `mysql_executor: E` (any `sqlx::Executor`), so whether it reuses a connection or acquires
its own depends on the **argument you pass**:
- `require_user_session(http_request, session_checker, mysql_executor)` — require a logged-in user.
- `require_user_session_extended(...)` — same, with extra session detail.
- `require_moderator(http_request, session_checker, mysql_executor)` — admin-only endpoints.
PREFER passing an already-open connection (`&mut *conn`) so the helper reuses it. Passing
`&server_state.mysql_pool` makes it acquire a fresh connection — avoid that when the handler
already holds one (the double-acquire adds pool pressure; this crate has had pool-timeout
incidents). There is no `*_using_connection` variant — the reuse/acquire choice is the argument.
### API Type Definitions
- Shared request/response types go in `artcraft_api_defs` crate (under `crates/api_clients/artcraft/artcraft_api_defs/`)
- Types that need `ResponseError` impl must stay in `storyteller_web` (orphan rule)
- New types must be added to `api_doc.rs` schemas (in storyteller-web) for Swagger generation
## Enums (Database-backed)
- Located in `crates/schema/public/enums/src/by_table/{table_name}/`
- Require manual `to_str()` and `from_str()` implementations
- Use `impl_enum_display_and_debug_using_to_str!` and `impl_mysql_enum_coders!` macros
- Add comprehensive tests: serialization, round-trip, variant count
- YOU CAN ADD NEW VALUES but DO NOT CHANGE EXISTING VALUES without a migration strategy
- Note that adding new values can break older versions of the Tauri desktop app that read
responses over Rust - make sure it consumes variants with an "Unknown(String)" variant
catch-all to future proof the APIs.
## Tokens (Primary Keys)
- Located in `crates/schema/public/tokens/src/tokens/`
- Opaque `String` wrappers with Stripe-like prefixes (e.g. `user_`, `mf_`)
- Use `impl_string_token!`, `impl_mysql_token_from_row!`, `impl_crockford_generator!` macros
+92
View File
@@ -0,0 +1,92 @@
# Code Style
## Rust
- Two spaces for indentation (not four)
- No minimum supported Rust version; use latest stable features freely
- `#[macro_use] extern crate serde_derive;` is used in binary crates; library crates use `use serde_derive::{Serialize, Deserialize};`
- Never use `println!` or `eprintln!` outside of tests; use `log` crate macros (`info!`, `warn!`, `error!`, `debug!`, `trace!`) instead
- Use `anyhow::Result` / `AnyhowResult` for fallible functions in application code; new database queries should use `Result<T, sqlx::Error>` instead
- SQLx: MySQL queries belong in the `mysql_queries` crate. Do NOT write `sqlx::query!` /
`sqlx::query()` in application/service crates (e.g. `storyteller-web`, which has zero direct
SQLx queries) — add or reuse a function in `mysql_queries` and call it. The compile-time
`query!` / `query_as!` macro conventions for that crate are documented in
`crates/schema/database/mysql_queries/CLAUDE.md`.
- Enum Display/Debug: use `impl_enum_display_and_debug_using_to_str!` macro, not `derive_more::Display` (CLion doesn't understand it)
- Fields that are optional use the `maybe_` prefix: `maybe_creator_user_token`, `maybe_prompt_token`
- When implementing `fmt::Display` for error types, use the pattern: `write!(f, "{:?}", self)`
## File Layout (Top-to-Bottom Reading Order)
Organize code so a human reading top-to-bottom encounters the most important things first and
can drill down into details only when curious. Think of it like a newspaper: headline first,
then the story, then the fine print.
### Ordering within a file
1. **Constants** at the top, right after imports.
2. **The primary public type** (the main struct/enum the file is about) comes next.
A reader opening this file should immediately see what it defines.
3. **Supporting/subordinate types** (sub-structs, helper enums, serialization DTOs) go
below the primary type, not above it. Ask: "Would a reader need to know this type
exists before seeing the main type?" — if no, push it down.
4. **Type ordering for API types**: Request, then Response (success), then Error.
5. **`impl` blocks** after their type definitions.
### Ordering within an `impl` block
1. **Constructors** (`new`, `from_*`, `builder`) at the top.
2. **Public methods** next — these are the main entry points a reader cares about.
3. **Private helper methods** below public methods.
- Among helpers: place "meaty" helpers (substantial logic, direct continuations of the
public entry point) above "leaf" helpers (small formatters, simple lookups).
- A method that calls another method in the same file should appear *above* the method
it calls. This lets readers follow the call chain downward.
### Ordering within test modules
Put test cases first, helpers last. A reader opening a test file should immediately see
*what* is being tested before *how* the test machinery works.
1. **Imports**
2. **Constants** (test IDs, URLs, fixture data) — small context that tests reference
3. **Test functions** or **sub-modules** grouped by category
4. **Helper functions** (builders, pipeline runners, assertions)
Group related tests into sub-modules (`mod pricing_tests { ... }`) when a category has 2+
tests. Don't create a sub-module for a single test. Keep nesting to two levels max
(`mod tests { mod category { ... } }`). Shared helpers go in the parent module so
sub-modules can reach them via `use super::*`.
## Naming
- Handler functions: `{verb}_{noun}_handler` (e.g. `get_health_check_handler`, `login_handler`)
- Error enums: `{Feature}Error` (e.g. `FalWebhookError`, `HealthCheckError`)
- Request/response structs: `{Action}Request`, `{Action}Response`, `{Action}SuccessResponse`
- Path params: `{Action}PathInfo`
- Builder structs: `{Thing}Builder` with `set_` prefixed setters and a `build()` method
## Imports
- Group imports: std, external crates, internal workspace crates, `crate::` imports
- Prefer `use` imports over inline fully-qualified paths. Inline qualification is acceptable
only for genuine one-off references where adding an import would be noise, or for types
that collide with std prelude names (`Result`, `Option`, `Error`). If you reference a symbol
more than once, always import it.
- Prefer specific imports over wildcards, except in `api_doc.rs` and test modules
- When two crates export a type with the same name, alias with a suffix describing the source crate:
`use enums::...::CommonResolution as CommonResolutionEnum;`
`use artcraft_router::...::CommonResolution as CommonResolutionRouter;`
This avoids long fully-qualified paths in function signatures and bodies.
## MySQL
- MySQL tables: primary key `id` columns must be `BIGINT(20) UNSIGNED`. Do not use signed IDs.
- Always create tables with `ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin`.
## TypeScript / Frontend
- TypeScript with React, Vite, Zustand, Three.js
- Nx monorepo under `crates/frontend/`
- Two spaces for indentation
+73
View File
@@ -0,0 +1,73 @@
# Testing
## Database Fixture Tests
- Live in-crate (e.g. `storyteller-web`'s omni_gen video pricing tests) and
use the `mysql_testing` crate (`crates/schema/database/mysql_testing`) for
guarded pools, schema setup, and account/session/wallet fixtures
- They RUN BY DEFAULT with `cargo test -p storyteller-web` and from the IDE
(requires a local MySQL with an `artcraft_test` database). Machines/CI
without MySQL skip them via the off switch:
`SQLX_OFFLINE=true cargo test -p storyteller-web --features skip_database_tests`
- They connect ONLY via `ARTCRAFT_TEST_DATABASE_URL` (default
`mysql://root:@localhost:3306/artcraft_test`); the guard panics on any
database whose name lacks "test", on `storyteller`/`artcraft`, and on
cloud hosts — see `mysql_testing/README.md`
- Database tests run in PARALLEL: each test creates its own users, wallets,
and rows; schema setup single-flights via a MySQL named lock. Only tests
mutating shared/global state take
`mysql_testing::serial::acquire_serial_test_lock().await`
- External providers must never be called: the harness stubs Kinovi with an
in-process HTTP server via `KINOVI_CUSTOM_API_HOST`/`KINOVI_CUSTOM_CDN_HOST`
## Running Tests
- Most crates: `cargo test -p {crate_name}`
- Crates using SQLx offline mode: `SQLX_OFFLINE=true cargo test -p {crate_name}`
- The `storyteller-web` and `mysql_queries` crates require `SQLX_OFFLINE=true` for compilation
- Use `cargo check -p {crate_name}` for fast compilation checks without running tests
## Test Patterns
- Tests live in `#[cfg(test)] mod tests { ... }` at the bottom of each file
- Group related tests into sub-modules by category (e.g. `mod pricing_tests`, `mod resolution_tests`)
- Only create a sub-module when it has 2+ tests — don't wrap a single test in its own module
- Keep nesting shallow: `mod tests { mod category { ... } }` is fine; a third level is rarely needed
- Shared helpers used by multiple sub-modules belong in the parent `mod tests`, not duplicated in each sub-module
- Enum tests should cover: serialization, deserialization, `to_str`/`from_str` round-trip, variant count
- Password/crypto tests: be mindful of computation cost, don't add too many bcrypt test cases
## Test File Layout
Put test cases first, helpers last. Engineers should see the actual tests before scrolling
to understand helper plumbing.
Within a `mod tests { ... }` block:
1. **Imports** at the top
2. **Constants** (test data IDs, URLs, etc.) — small context that tests reference
3. **Test functions** (`#[test]` / `#[tokio::test]`) grouped by category
4. **Helper functions** (builders, pipeline runners, etc.) at the very bottom
If tests are grouped into sub-modules, the same rule applies within each sub-module:
constants first, then tests, then helpers at the end of that sub-module.
## What to Test
- New error types and their mappings
- Enum variant serialization stability (these are stored in the database)
- Hash/deduplication functions with known inputs
- Edge cases in parsers (empty input, missing fields, malformed data)
## Imports in Tests
- Import test fixtures and constants with `use`, not inline fully-qualified paths.
Write `use test_data::web::image_urls::JUNO_AT_LAKE_IMAGE_URL;` at the top,
then reference `JUNO_AT_LAKE_IMAGE_URL` in test bodies.
- Same rule applies to enum variants used in match arms — import them, don't write
`crate::some::deep::module::MyEnum::Variant` inline.
## What Not to Test
- Don't add integration tests that require a running database unless explicitly asked
- Don't add tests for simple struct construction or trivial getters
+14
View File
@@ -0,0 +1,14 @@
hakari-package = "workspace-build-acceleration"
resolver = "1"
dep-format-version = "4"
workspace-hack-line-style = "workspace-dotted"
platforms = [
"x86_64-unknown-linux-gnu",
"x86_64-apple-darwin",
"x86_64-pc-windows-msvc",
]
exact-versions = true
-14
View File
@@ -1,14 +0,0 @@
*secret*sh
*~
.env
.env-secrets
.git
.idea/
__pycache__/
_ignored_schema.rs
models/Wav2Lip/python/
models/tacotron2/python/
production_database_secret_connect.sh
secrets.toml
secrets.yaml
target/
-66
View File
@@ -1,66 +0,0 @@
DATABASE_URL=mysql://storyteller:password@localhost/storyteller
#DATABASE_URL=mysql://root:root@localhost/storyteller
#DATABASE_URL=mysql://root@localhost/storyteller
# SQLX normally requires a live database to reflect upon at build time.
# This setting turns that on and requires a `sql-data.json` cache file instead.
# See https://github.com/launchbadge/sqlx/tree/master/sqlx-cli#readme
#SQLX_OFFLINE=true
# We can't serve HTTPS locally without self-signed certificate nonsense.
COOKIE_SECURE=false
COOKIE_DOMAIN=.jungle.horse
WEBSITE_HOMEPAGE_REDIRECT=http://jungle.horse
# Bucket config (non-secret)
REGION_NAME=us-east1
TTS_DOWNLOAD_BUCKET_NAME=dev-vocodes-private-uploads
TTS_DOWNLOAD_BUCKET_ROOT=/user_uploaded_tts_models
W2L_PRIVATE_DOWNLOAD_BUCKET_NAME=dev-vocodes-private-uploads
W2L_PUBLIC_DOWNLOAD_BUCKET_NAME=dev-vocodes-public
PRIVATE_BUCKET_NAME=dev-vocodes-private-uploads
PUBLIC_BUCKET_NAME=dev-vocodes-public
# Bucket roots
AUDIO_UPLOADS_BUCKET_ROOT=/user_uploaded_w2l_audio
W2L_DOWNLOAD_BUCKET_ROOT=/user_uploaded_w2l_templates
W2L_INFERENCE_OUTPUT_BUCKET_ROOT=/w2l_output
W2L_CODE_DIRECTORY=/home/bt/dev/storyteller/storyteller-web/models/Wav2Lip
W2L_INFERENCE_SCRIPT_NAME=vocodes_process_inference.py
W2L_MODEL_FILENAME=wav2lip_gan.pth
#W2L_MODEL_CHECKPOINT=/home/bt/models/wav2lip/s3fd-619a316812.pth
W2L_MODEL_CHECKPOINT=/home/bt/models/wav2lip/wav2lip_gan.pth
W2L_END_BUMP_FILENAME=vocodes-short-end-bump.mp4
W2L_DOWNLOAD_SCRIPT_NAME=vocodes_process_upload.py
TTS_CODE_DIRECTORY=/home/bt/dev/storyteller/storyteller-ml/tts
TTS_INFERENCE_SCRIPT_NAME=vocodes_inference.py
TACOTRON_ROOT_CODE_DIRECTORY=/home/bt/dev/storyteller/storyteller-ml/tts
TACOTRON_VIRTUAL_ENV_ACTIVATION_COMMAND="source python/bin/activate"
TACOTRON_MODEL_CHECK_SCRIPT_NAME="vocodes_model_check_tacotron.py"
TALKNET_ROOT_CODE_DIRECTORY=/home/bt/dev/storyteller/storyteller-ml/tts
TALKNET_MODEL_CHECK_SCRIPT_NAME="vocodes_model_check_talknet.py"
HIFIGAN_ROOT_CODE_DIRECTORY=/home/bt/dev/storyteller/storyteller-ml/tts
HIFIGAN_VIRTUAL_ENV_ACTIVATION_COMMAND="source python/bin/activate"
HIFIGAN_MODEL_CHECK_SCRIPT_NAME="vocodes_model_check_hifigan.py"
TTS_INFERENCE_SIDECAR_HOSTNAME=localhost:8000
#TTS_WAVEGLOW_VOCODER_MODEL_FILENAME=waveglow_256channels_universal_v5.pt # THIS SOUNDS HORRID
#TTS_WAVEGLOW_VOCODER_MODEL_FILENAME=waveglow_256channels_v4_uberduck.pt # THIS IS TOO SMALL! 300MB vs 1.2 GB!
TTS_WAVEGLOW_VOCODER_MODEL_FILENAME=waveglow_256channels_v4.pt
TTS_HIFIGAN_VOCODER_MODEL_FILENAME=hifigan_universal_g_02500000.pt
TTS_HIFIGAN_SUPERRES_VOCODER_MODEL_FILENAME=hifigan_superres_twilight_33000.pt
# Development key. Permissible to check in.
NEWRELIC_API_KEY=c402be1c4c4216ec83d0cfc0851520cfFFFFNRAL
+6
View File
@@ -0,0 +1,6 @@
# Ignore certain code for Github language statistics
# https://github.com/github/linguist/blob/master/docs/overrides.md
old_code/trumpet-trumped.com/dictionary/cmudict-0.7b linguist-vendored
old_code/voder-vocodes-1.0/frontends/admin/node_modules/** linguist-vendored
test_data/html_scraping/** linguist-vendored
windows/sqlite/** linguist-vendored
@@ -1,11 +1,11 @@
# To get started with Dependabot version updates, you'll need to specify which
# package ecosystems to update and where the package manifests are located.
# Please see the documentation for all configuration options:
# https://help.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
version: 2
updates:
- package-ecosystem: "cargo" # See documentation for possible values
directory: "/" # Location of package manifests
schedule:
interval: "daily"
interval: "weekly"
@@ -0,0 +1,237 @@
name: "Artcraft MacOS Publish"
on:
push:
branches:
- release
- artcraft-release
- artcraft-macos # Additional branch for MacOS testing
# This workflow creates Universal macOS builds with signing certificate support.
# On each push to the release branches it will create or update a GitHub release, build your app, and upload the artifacts to the release.
jobs:
publish-artcraft:
permissions:
contents: write
strategy:
fail-fast: false
matrix:
include:
# Universal macOS builds (arm64 and x86_64)
- platform: 'macos-latest-xlarge'
args: '--target universal-apple-darwin'
# Uncomment below for additional platforms
# - platform: 'ubuntu-22.04'
# args: ''
# - platform: 'windows-latest'
# args: ''
runs-on: ${{ matrix.platform }}
steps:
- uses: actions/checkout@v4
- name: setup node
uses: actions/setup-node@v4
with:
node-version: lts/*
- name: install Rust stable
uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.platform == 'macos-latest-xlarge' && 'aarch64-apple-darwin,x86_64-apple-darwin' || '' }}
- name: install dependencies (ubuntu only)
if: matrix.platform == 'ubuntu-22.04'
run: |
sudo apt-get update
sudo apt-get install -y libwebkit2gtk-4.1-dev libappindicator3-dev librsvg2-dev patchelf
- name: replace tauri config with mac-specific version
run: |
pushd ${{ github.workspace }}/crates/desktop/artcraft
# Use the mac-specific tauri conf for the build
# TODO(bt): Replace this with the platform-specific naming conventions
cp tauri-mac.conf.json tauri.conf.json
popd
- name: install frontend dependencies
run: |
# Navigate to the frontend directory to install dependencies
cd ./frontend
npm cache clean --force
echo "Installing all workspace dependencies..."
npm ci
echo "=== Version Information ==="
echo "Node version:"
node --version
echo "NPM version:"
npm --version
echo "=== Nx versions from lockfile ==="
npm list --depth=0 | grep nx
- name: import Apple Developer Certificate
if: matrix.platform == 'macos-latest-xlarge'
env:
APPLE_CERTIFICATE: ${{ secrets.APPLE_CERTIFICATE }}
APPLE_CERTIFICATE_PASSWORD: ${{ secrets.APPLE_CERTIFICATE_PASSWORD }}
KEYCHAIN_PASSWORD: ${{ secrets.KEYCHAIN_PASSWORD }}
run: |
echo "Starting certificate import process..."
# Create certificate file
echo $APPLE_CERTIFICATE | base64 --decode > certificate.p12
# Debug: Check if certificate file exists and has content
echo "Certificate file info:"
ls -la certificate.p12
file certificate.p12
# Debug: Check certificate contents without password (just structure)
echo "Certificate structure (may show error if password protected):"
openssl pkcs12 -info -in certificate.p12 -passin pass:$APPLE_CERTIFICATE_PASSWORD -noout || echo "Could not read certificate structure"
# Debug: Try to list what's in the p12 file
echo "Attempting to list certificate contents:"
security cms -D -i certificate.p12 || echo "Not a CMS file, trying PKCS12..."
openssl pkcs12 -in certificate.p12 -passin pass:$APPLE_CERTIFICATE_PASSWORD -info -nodes 2>&1 | head -20 || echo "Failed to read PKCS12 contents"
# Debug: Extract certificate details to verify type and expiration
echo "Extracting certificate details..."
# Extract just the certificate portion and examine it
openssl pkcs12 -in certificate.p12 -passin pass:$APPLE_CERTIFICATE_PASSWORD -nokeys 2>/dev/null | openssl x509 -text -noout | grep -E "(Subject:|Issuer:|Not Before|Not After)" || echo "Failed to parse certificate details"
# Also try to see what type of certificate this is
echo "Certificate type check:"
openssl pkcs12 -in certificate.p12 -passin pass:$APPLE_CERTIFICATE_PASSWORD -nokeys 2>/dev/null | openssl x509 -text -noout | grep -E "(CN=|OU=)" || echo "Could not determine certificate type"
# Debug: Check if private key exists
echo "Checking for private key..."
openssl pkcs12 -in certificate.p12 -passin pass:$APPLE_CERTIFICATE_PASSWORD -nocerts -nodes 2>&1 | grep -E "(PRIVATE KEY|RSA KEY)" | head -5 || echo "No private key found"
# Create temporary keychain
security create-keychain -p "$KEYCHAIN_PASSWORD" build.keychain
security default-keychain -s build.keychain
security unlock-keychain -p "$KEYCHAIN_PASSWORD" build.keychain
security set-keychain-settings -t 3600 -u build.keychain
# Import certificate - ensure both certificate and private key are imported
echo "Importing certificate into keychain..."
# Import the p12 directly - this is the most reliable method
security import certificate.p12 -k build.keychain -P "$APPLE_CERTIFICATE_PASSWORD" -T /usr/bin/codesign -T /usr/bin/security -T /usr/bin/productbuild
# Alternative: Try with additional flags if the first import didn't create an identity
echo "Verifying import..."
if ! security find-identity -v build.keychain | grep -q "1 valid identities found"; then
echo "First import didn't create identity, trying with -A flag..."
security import certificate.p12 -k build.keychain -P "$APPLE_CERTIFICATE_PASSWORD" -A
fi
# Set trust settings for the certificate
echo "Setting trust settings..."
security set-key-partition-list -S apple-tool:,apple:,codesign: -s -k "$KEYCHAIN_PASSWORD" build.keychain
# Unlock the keychain again to ensure it's accessible
security unlock-keychain -p "$KEYCHAIN_PASSWORD" build.keychain
# Add the keychain to the search list
security list-keychains -d user -s build.keychain $(security list-keychains -d user | sed 's/^[[:space:]]*"//;s/"$//')
# List all certificates to debug
echo "Listing all keychains:"
security list-keychains
echo "Listing all certificates in build keychain:"
security find-certificate -a -p build.keychain || echo "No certificates found"
echo "Detailed certificate info:"
security find-certificate -c "Learning Machines" build.keychain || echo "Certificate 'Learning Machines' not found"
# Check certificate trust settings
echo "Checking certificate trust settings:"
security dump-trust-settings || echo "No custom trust settings"
# Try to find codesigning identities
echo "Finding all identities in keychain:"
security find-identity -v build.keychain || echo "No identities found"
echo "Finding codesigning identities:"
security find-identity -v -p codesigning build.keychain || echo "No codesigning identities found"
# Additional debug: Check if this is a valid Developer ID cert
echo "Checking for Developer ID certificates:"
security find-certificate -a build.keychain | grep -A 5 -B 5 "Developer ID" || echo "No Developer ID certificates found"
- name: verify certificate
if: matrix.platform == 'macos-latest-xlarge'
run: |
echo "=== Certificate Verification ==="
echo "1. Checking codesigning identities:"
security find-identity -v -p codesigning build.keychain || echo "No codesigning identities found"
echo -e "\n2. Checking all identities:"
security find-identity -v build.keychain || echo "No identities found"
echo -e "\n3. Checking certificates in keychain:"
security find-certificate -c "Learning Machines" build.keychain -p | openssl x509 -text -noout | grep -E "(Subject:|CN=)" || echo "Could not parse certificate"
# Set the correct signing identity
echo "APPLE_SIGNING_IDENTITY=Developer ID Application: Learning Machines LLC (DJ6XS33FX8)" >> $GITHUB_ENV
echo "Proceeding with identity: Developer ID Application: Learning Machines LLC (DJ6XS33FX8)"
# Also set the team ID
echo "APPLE_DEVELOPMENT_TEAM=DJ6XS33FX8" >> $GITHUB_ENV
- name: Pre-build frontend to avoid Tauri build issues
run: |
# Build the frontend app from the correct directory
cd ./frontend
# Increase Node.js memory limit for the build
export NODE_OPTIONS="--max-old-space-size=8192"
# Use npx to ensure we use the local nx version
echo "Building with npx nx..."
npx nx run artcraft:build
echo "Checking build output..."
ls -la apps/artcraft/dist/ | head -10
# Update Tauri config to skip the build (since we already built)
cd ${{ github.workspace }}/crates/desktop/artcraft
cp tauri.conf.json tauri.conf.json.bak
# Set beforeBuildCommand to empty or a no-op command
if command -v jq &> /dev/null; then
jq '.build.beforeBuildCommand = ""' tauri.conf.json > tauri.conf.json.tmp
mv tauri.conf.json.tmp tauri.conf.json
else
node -e "const fs = require('fs'); const config = JSON.parse(fs.readFileSync('tauri.conf.json', 'utf8')); config.build.beforeBuildCommand = ''; fs.writeFileSync('tauri.conf.json', JSON.stringify(config, null, 2));"
fi
- name: build and publish
uses: tauri-apps/tauri-action@v0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
APPLE_ID: ${{ secrets.APPLE_ID }}
APPLE_ID_PASSWORD: ${{ secrets.APPLE_ID_PASSWORD }}
APPLE_PASSWORD: ${{ secrets.APPLE_PASSWORD }}
APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }}
APPLE_CERTIFICATE_PASSWORD: ${{ secrets.APPLE_CERTIFICATE_PASSWORD }}
APPLE_SIGNING_IDENTITY: ${{ env.APPLE_SIGNING_IDENTITY }}
APPLE_DEVELOPMENT_TEAM: ${{ env.APPLE_DEVELOPMENT_TEAM }}
# Use the SQLx query cache for SQLite
SQLX_OFFLINE: true
with:
projectPath: ./crates/desktop/artcraft
tagName: artcraft-v__VERSION__ # the action automatically replaces __VERSION__ with the app version.
releaseName: "ArtCraft v__VERSION__"
releaseBody: "See the assets below to download this version and install."
releaseDraft: true
prerelease: false
args: ${{ matrix.args }}
@@ -0,0 +1,107 @@
name: "Artcraft Windows Publish"
on:
push:
branches:
- release
- artcraft-release
- artcraft-windows # Additional branch for Windows testing
# This workflow creates Windows builds.
# On each push to the release branches it will create or update a GitHub release, build your app, and upload the artifacts to the release.
jobs:
publish-artcraft-windows:
permissions:
contents: write
strategy:
fail-fast: false
matrix:
include:
# Windows builds
- platform: 'windows-latest'
args: ''
runs-on: ${{ matrix.platform }}
steps:
- uses: actions/checkout@v4
- name: install Rust stable
uses: dtolnay/rust-toolchain@stable
- name: install wreq dependencies
run: |
choco install cmake -y
choco install strawberryperl -y
choco install pkgconfiglite -y
choco install llvm -y
choco install nasm -y
shell: cmd
- name: setup node
uses: actions/setup-node@v4
with:
node-version: lts/*
- name: install frontend dependencies
run: |
# Navigate to the frontend directory to install dependencies
cd ./frontend
npm cache clean --force
echo "Installing all workspace dependencies..."
npm ci
echo "=== Version Information ==="
echo "Node version:"
node --version
echo "NPM version:"
npm --version
echo "=== Nx versions from lockfile ==="
npm list --depth=0 | findstr nx
- name: Pre-build frontend to avoid Tauri build issues
run: |
# Build the frontend app from the correct directory
cd ./frontend
# Increase Node.js memory limit for the build
$env:NODE_OPTIONS="--max-old-space-size=8192"
# Use npx to ensure we use the local nx version
echo "Building with npx nx..."
npx nx run artcraft:build
if ($LASTEXITCODE -ne 0) {
exit $LASTEXITCODE
}
echo "Checking build output..."
dir apps/artcraft/dist/ | Select-Object -First 10
# Update Tauri config to skip the build (since we already built)
cd ${{ github.workspace }}/crates/desktop/artcraft
Copy-Item tauri.conf.json tauri.conf.json.bak
# Set beforeBuildCommand to empty using PowerShell
$config = Get-Content tauri.conf.json | ConvertFrom-Json
$config.build.beforeBuildCommand = ""
$config | ConvertTo-Json -Depth 10 | Set-Content tauri.conf.json
- name: build and publish
uses: tauri-apps/tauri-action@v0
env:
# NB(bt): This is needed by wreq. Hopefully it doesn't kill Tauri
RUSTFLAGS: "-C target-feature=+crt-static"
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# Use the SQLx query cache for SQLite
SQLX_OFFLINE: true
with:
projectPath: ./crates/desktop/artcraft
tagName: artcraft-v__VERSION__ # the action automatically replaces __VERSION__ with the app version.
releaseName: "ArtCraft v__VERSION__"
releaseBody: "Production build of ArtCraft. See the assets below to download and install."
releaseDraft: true
prerelease: false
args: ${{ matrix.args }}
-67
View File
@@ -1,67 +0,0 @@
# Adapted from
# https://github.com/actions/starter-workflows/ci/docker-publish.yml
# If using base images, don't forget to add READ access, eg. from a package settings page like:
# https://github.com/orgs/storytold/packages/container/docker-base-images-rust-ssl/settings/actions_access
name: Publish Docker Container to GHCR
on:
push:
branches:
# NB: Default-branch doesn't work, despite Github's documentation.
#- $default-branch
- master
env:
IMAGE_NAME: storyteller-rust
jobs:
# Push image to GitHub Packages.
# See also https://docs.docker.com/docker-hub/builds/
push:
runs-on: ubuntu-latest
if: github.event_name == 'push'
permissions:
packages: write
contents: read
steps:
- uses: actions/checkout@v2
- name: Login to GitHub Container Registry
uses: docker/login-action@v1
with:
registry: ghcr.io
#username: ${{ github.repository_owner }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build image
run: |
SHORT_SHA=$(echo ${GITHUB_SHA} | cut -c1-12)
docker build . --file Dockerfile --tag $IMAGE_NAME --label "runnumber=${GITHUB_RUN_ID}" --build-arg GIT_SHA=${SHORT_SHA}
- name: Push image to GitHub Container Registry
run: |
IMAGE_ID=ghcr.io/${{ github.repository_owner }}/$IMAGE_NAME
# Change all uppercase to lowercase
IMAGE_ID=$(echo $IMAGE_ID | tr '[A-Z]' '[a-z]')
# Strip git ref prefix from version
VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,')
# Strip "v" prefix from tag name
[[ "${{ github.ref }}" == "refs/tags/"* ]] && VERSION=$(echo $VERSION | sed -e 's/^v//')
# Use Docker `latest` tag convention
[ "$VERSION" == "$default-branch" ] && VERSION=latest
echo IMAGE_ID=$IMAGE_ID
echo VERSION=$VERSION
docker tag $IMAGE_NAME $IMAGE_ID:$VERSION
docker push $IMAGE_ID:$VERSION
SHORT_SHA=$(echo ${GITHUB_SHA} | cut -c1-12)
docker tag $IMAGE_NAME $IMAGE_ID:$SHORT_SHA
docker push $IMAGE_ID:$SHORT_SHA
+98 -13
View File
@@ -1,22 +1,107 @@
*.swo
*.swp
# Secrets are BAD!
*secret*sh
*~
.env
.env-aichatbot-secrets
.env-analytics-job
.env-elasticsearch-secrets
.env-migration-tool-secrets
.env-secrets
.idea/
__pycache__/
_ignored_schema.rs
.env-support-tool-secrets
_develop/tools/.secrets
_develop/tools/db_secrets.toml
crates/service/web/storyteller_web/config/storyteller-web.development-secrets.env
db.secrets
db_secrets.toml
models/Wav2Lip/python/
models/tacotron2/python/
env-secrets
pubkeys.txt
secrets.toml
secrets.yaml
secrets/
twitch_secrets.toml
# Old env secrets
.*-secrets
# New env secrets (per-app)
*-secrets.env
# Utilities with secrets
production_database_secret_connect.sh
production_database_secret_query.sh
production_database_voice_clone_report_download.sh
secrets.toml
secrets.yaml
script/artcraft/mac_signing_build.sh
script/production_database_secret_backup.sh
script/production_database_secret_connect.sh
script/socat_dev_database_connect.sh
# Python virtual envs (named by convention)
venv/
# LLM Testing
/external/
/prompts/
/reports/
/requests/
# Scratch data
scratch/
test_data/temp/
untracked/
tmp/
# Rust build directory
target/
tools/.secrets
tools/db_secrets.toml
twitch_secrets.toml
crates/lib/database_queries/target/
crates/lib/sqlite_queries/target/
# Javascript build directories
node_modules/
# Frontend build outputs
frontend/apps/artcraft/bundle-report.html
# Vim noise
*.swo
*.swp
*~
# IntelliJ/CLion/RustRover noise
.idea/
# Python noise
__pycache__/
# We use diesel for DB migrations only. We don't care about its codgen.
_ignored_schema.rs
# Diesel lock file
.diesel_lock
# AI Chat Sidecar has its own schema managed by diesel, but we don't care for diesel codegen.
crates/programs/aichatbot-sidecar/_ignored_schema.rs
# AI Chat sidecar's SQlite database shouldn't be checked in
crates/programs/aichatbot-sidecar/database.db
# Runtime data for the AI chatbot
runtime_data/
# Old Python virtual environments
models/Wav2Lip/python/
models/tacotron2/python/
# Stuff I want to keep around, but not commit
scraps/
# Mac nonsense
.DS_Store
# Windows build files
# These should be built by the platform
windows/sqlite/sqlite3.exp
windows/sqlite/sqlite3.lib
# ArtCraft Windows DLLs
crates/desktop/src-tauri/*.dll
windows_dlls/
-18
View File
@@ -1,18 +0,0 @@
<component name="ProjectDictionaryState">
<!--
Despite spellcheck dictionaries being created per-user, IntelliJ loads all of them, per:
https://stackoverflow.com/a/28151692
-->
<dictionary name="bt">
<words>
<w>arpabet</w>
<w>backfill</w>
<w>cheermote</w>
<w>fakeyou</w>
<w>hifigan</w>
<w>scrollback</w>
<w>vocoder</w>
<w>vocoders</w>
</words>
</dictionary>
</component>
@@ -0,0 +1,12 @@
{
"db_name": "SQLite",
"query": "\n UPDATE tasks\n SET is_dismissed_by_user = 1\n WHERE id = ?\n ",
"describe": {
"columns": [],
"parameters": {
"Right": 1
},
"nullable": []
},
"hash": "13d435d8f681b73e4080748dcef0579e246e41049af67e1bd79ffc06aa6ba974"
}
@@ -0,0 +1,12 @@
{
"db_name": "SQLite",
"query": "\n UPDATE tasks\n SET\n task_status = ?,\n on_complete_batch_token = ?,\n on_complete_primary_media_file_token = ?,\n on_complete_primary_media_file_class = ?,\n on_complete_primary_media_file_cdn_url = ?,\n on_complete_primary_media_file_thumbnail_url_template = ?\n WHERE\n provider = ?\n AND provider_job_id = ?\n ",
"describe": {
"columns": [],
"parameters": {
"Right": 8
},
"nullable": []
},
"hash": "1e3758851fc8451670f86a9432009b73bdb81de4a08dcaa96a86afb5f9be7a68"
}
@@ -0,0 +1,128 @@
{
"db_name": "SQLite",
"query": "\n SELECT\n id,\n task_status,\n task_type,\n model_type,\n provider,\n provider_job_id,\n frontend_caller,\n frontend_subscriber_id,\n frontend_subscriber_payload,\n on_complete_primary_media_file_token,\n on_complete_primary_media_file_class,\n on_complete_batch_token,\n on_complete_primary_media_file_cdn_url,\n on_complete_primary_media_file_thumbnail_url_template,\n on_failure_type,\n on_failure_message,\n created_at as \"created_at: DateTime<Utc>\",\n updated_at as \"updated_at: DateTime<Utc>\",\n completed_at as \"completed_at: DateTime<Utc>\"\n FROM tasks\n WHERE is_dismissed_by_user == 0\n ",
"describe": {
"columns": [
{
"name": "id",
"ordinal": 0,
"type_info": "Text"
},
{
"name": "task_status",
"ordinal": 1,
"type_info": "Text"
},
{
"name": "task_type",
"ordinal": 2,
"type_info": "Text"
},
{
"name": "model_type",
"ordinal": 3,
"type_info": "Text"
},
{
"name": "provider",
"ordinal": 4,
"type_info": "Text"
},
{
"name": "provider_job_id",
"ordinal": 5,
"type_info": "Text"
},
{
"name": "frontend_caller",
"ordinal": 6,
"type_info": "Text"
},
{
"name": "frontend_subscriber_id",
"ordinal": 7,
"type_info": "Text"
},
{
"name": "frontend_subscriber_payload",
"ordinal": 8,
"type_info": "Text"
},
{
"name": "on_complete_primary_media_file_token",
"ordinal": 9,
"type_info": "Text"
},
{
"name": "on_complete_primary_media_file_class",
"ordinal": 10,
"type_info": "Text"
},
{
"name": "on_complete_batch_token",
"ordinal": 11,
"type_info": "Text"
},
{
"name": "on_complete_primary_media_file_cdn_url",
"ordinal": 12,
"type_info": "Text"
},
{
"name": "on_complete_primary_media_file_thumbnail_url_template",
"ordinal": 13,
"type_info": "Text"
},
{
"name": "on_failure_type",
"ordinal": 14,
"type_info": "Text"
},
{
"name": "on_failure_message",
"ordinal": 15,
"type_info": "Text"
},
{
"name": "created_at: DateTime<Utc>",
"ordinal": 16,
"type_info": "Int64"
},
{
"name": "updated_at: DateTime<Utc>",
"ordinal": 17,
"type_info": "Int64"
},
{
"name": "completed_at: DateTime<Utc>",
"ordinal": 18,
"type_info": "Int64"
}
],
"parameters": {
"Right": 0
},
"nullable": [
false,
false,
false,
true,
true,
true,
true,
true,
true,
true,
true,
true,
true,
true,
true,
true,
false,
false,
true
]
},
"hash": "2436eb7bf4b0e23a899311a67a77f71d89eb35461e2113e43cd9d221bfa91c9a"
}
@@ -0,0 +1,12 @@
{
"db_name": "SQLite",
"query": "\n UPDATE tasks\n SET task_status = \"cancelled_by_user\"\n WHERE task_status NOT IN (\n \"complete_success\",\n \"complete_failure\",\n \"dead\",\n \"cancelled_by_user\",\n \"cancelled_by_provider\",\n \"cancelled_by_us\"\n )\n ",
"describe": {
"columns": [],
"parameters": {
"Right": 0
},
"nullable": []
},
"hash": "30272128d83543d9fbfca930b7cdd4af30adfb4d90f2de044463a111c6340495"
}
@@ -0,0 +1,86 @@
{
"db_name": "SQLite",
"query": "\n SELECT\n id,\n task_status,\n task_type,\n model_type,\n provider,\n provider_job_id,\n frontend_caller,\n queue_status_url,\n queue_response_url,\n prompt_token,\n frontend_subscriber_id,\n frontend_subscriber_payload\n FROM tasks\n WHERE\n provider = ?\n AND provider_job_id = ?\n ",
"describe": {
"columns": [
{
"name": "id",
"ordinal": 0,
"type_info": "Text"
},
{
"name": "task_status",
"ordinal": 1,
"type_info": "Text"
},
{
"name": "task_type",
"ordinal": 2,
"type_info": "Text"
},
{
"name": "model_type",
"ordinal": 3,
"type_info": "Text"
},
{
"name": "provider",
"ordinal": 4,
"type_info": "Text"
},
{
"name": "provider_job_id",
"ordinal": 5,
"type_info": "Text"
},
{
"name": "frontend_caller",
"ordinal": 6,
"type_info": "Text"
},
{
"name": "queue_status_url",
"ordinal": 7,
"type_info": "Text"
},
{
"name": "queue_response_url",
"ordinal": 8,
"type_info": "Text"
},
{
"name": "prompt_token",
"ordinal": 9,
"type_info": "Text"
},
{
"name": "frontend_subscriber_id",
"ordinal": 10,
"type_info": "Text"
},
{
"name": "frontend_subscriber_payload",
"ordinal": 11,
"type_info": "Text"
}
],
"parameters": {
"Right": 2
},
"nullable": [
false,
false,
false,
true,
true,
true,
true,
true,
true,
true,
true,
true
]
},
"hash": "35677894f7b02f32a1bf6396fa6d10caba69bb0f3f03ee7ffbfa1437689d42df"
}
@@ -0,0 +1,12 @@
{
"db_name": "SQLite",
"query": "\n INSERT INTO tasks (\n id,\n task_status,\n task_type,\n model_type,\n provider,\n provider_job_id,\n queue_status_url,\n queue_response_url,\n prompt_token,\n frontend_caller,\n frontend_subscriber_id,\n frontend_subscriber_payload\n )\n VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)\n ",
"describe": {
"columns": [],
"parameters": {
"Right": 12
},
"nullable": []
},
"hash": "4fc9674ae39abaadc36054c200290ec95d0e2c7765336f0fa97805a2265f5c4c"
}
@@ -0,0 +1,12 @@
{
"db_name": "SQLite",
"query": "\n UPDATE tasks\n SET\n task_status = ?,\n on_complete_batch_token = ?,\n on_complete_primary_media_file_token = ?,\n on_complete_primary_media_file_class = ?,\n on_complete_primary_media_file_cdn_url = ?,\n on_complete_primary_media_file_thumbnail_url_template = ?\n WHERE id = ?\n ",
"describe": {
"columns": [],
"parameters": {
"Right": 7
},
"nullable": []
},
"hash": "50a2449b87abed7df3302a74ecd0e8ab87940077a247636680cb09b2fe488321"
}
@@ -0,0 +1,12 @@
{
"db_name": "SQLite",
"query": "\n UPDATE tasks\n SET task_status = ?,\n on_failure_type = ?,\n on_failure_message = ?\n WHERE id = ?\n ",
"describe": {
"columns": [],
"parameters": {
"Right": 4
},
"nullable": []
},
"hash": "9b99ccd0baf9a4b74d8903f63e3a3dcf4c09b75cad978f0532388cbd743b7516"
}
@@ -0,0 +1,12 @@
{
"db_name": "SQLite",
"query": "\n UPDATE tasks\n SET task_status = ?\n WHERE id = ?\n ",
"describe": {
"columns": [],
"parameters": {
"Right": 2
},
"nullable": []
},
"hash": "dc0367e9e43c3d7dda3623e77337ab4529eac2192475be7d08589886703ba1cb"
}
@@ -0,0 +1,12 @@
{
"db_name": "SQLite",
"query": "\n UPDATE tasks\n SET is_dismissed_by_user = 1\n WHERE is_dismissed_by_user != 1\n ",
"describe": {
"columns": [],
"parameters": {
"Right": 0
},
"nullable": []
},
"hash": "f83018ec5493982659a56576296914f937bb4e75db3a522eb4bda486d5caa402"
}
+76
View File
@@ -0,0 +1,76 @@
# AGENTS.md
This file provides guidance for coding agents when working with the Artcraft monorepo.
## Project Overview
Artcraft is a public-facing Tauri desktop app for generating AI images and video.
It uses Rust and TypeScript. Backend services, company tooling, and website builds
live in the separate `artcraft-services` repository.
## Project Structure
```
artcraft/
├── _database/sql/artcraft_migrations/ # Embedded SQLite task database migrations
├── .sqlx/ # SQLite query metadata for offline builds
├── crates/
│ ├── desktop/artcraft/ # Tauri app, configuration, capabilities, icons
│ ├── api_clients/ # Desktop provider clients and shared API types
│ ├── lib/ # Desktop support libraries
│ ├── schema/database/sqlite_tasks/ # Desktop task persistence
│ ├── schema/public/ # Shared wire-format enums and identifiers
│ ├── testing/ # Shared test helpers
│ └── vendor/tauri-plugin-http/ # HTTP plugin fork with cookie access
├── frontend/
│ ├── apps/artcraft/ # Tauri app frontend and public resources
│ └── libs/ # Shared frontend libraries
├── script/artcraft/ # Desktop development and build scripts
├── test_data/ # Fixtures used by retained crate tests
└── Cargo.toml # Desktop dependency workspace
```
Keep `external/` and `secrets/` untouched. Repository pruning must preserve
untracked and ignored local files; delete only Git-tracked paths unless the user
explicitly authorizes a cache cleanup.
## Code Style
- Rust with no minimum supported version
- SQLx for SQLite; prefer `sqlx::query!` / `sqlx::query_as!` compile-time checked macros over runtime `sqlx::query()` whenever possible
- A mix of wreq and reqwest for Rust HTTP clients
- Never use `println!` or `eprintln!` outside of tests; use `log` crate macros instead
- When two crates export the same type name, alias imports with a suffix: `use foo::Bar as BarFoo;`
- Prefer `use` imports over inline fully-qualified paths; only qualify inline for true one-offs or std collisions
- TypeScript with Nx, React, Vite, Zustand, and Three.js
- Use two spaces for indentation
- Each Tauri command belongs in its own file module, named after the command. Keep shared state, types, and helpers in separate support modules; see the [Storyteller command conventions](crates/desktop/artcraft/src/services/storyteller/commands/AGENTS.md).
### File Layout
Organize for top-to-bottom reading. Important things first, details later.
- **Constants** at the top (after imports)
- **Structs/enums** next; outer structs above inner sub-structs
- **API types** in order: Request, Response, Error
- **In impl blocks**: constructors first, then public methods, then private helpers
- Private helpers go *below* the methods that call them
- Among helpers: meatier logic above leaf-level formatters
- **In test modules**: constants first, then test cases (grouped into sub-modules when 2+), then helper functions last
## Markdown
- **Tables must be space-padded so columns align in plain text.** Markdown
tables are read raw (terminals, diffs, editors) at least as often as
rendered, and condensed tables are unreadable there. Pad every cell to its
column width:
```markdown
| Model | Configuration | Credits | Speed | Score |
|--------------|---------------|--------------------|---------|
| Meshy 6 | text or image | 104 | 80.0 | +24 |
| Rodin 2.5 | text or image | 13 | 10.0 | +3 |
```
Not: `| Model | Configuration | Credits | Speed | Score |` packed tight
with varying widths per row.
Symlink
+1
View File
@@ -0,0 +1 @@
AGENTS.md
Generated
+7796 -3545
View File
File diff suppressed because it is too large Load Diff
+121 -24
View File
@@ -1,29 +1,126 @@
[workspace]
resolver = "2"
# Desktop application and its local build/test dependencies.
members = [
# Shared libraries
"crates/lib/config",
"crates/lib/container_common",
"crates/lib/database_queries",
"crates/lib/google_drive_common",
"crates/lib/http_server_common",
"crates/lib/jobs_common",
"crates/lib/memory_caching",
"crates/lib/redis_common",
"crates/lib/reusable_types",
"crates/lib/storage_buckets_common",
"crates/lib/tts_common",
"crates/lib/twitch_common",
"crates/lib/user_input_common",
# Application
"crates/service/generic_download_job",
"crates/service/storyteller_web",
"crates/service/tts_download_job",
"crates/service/tts_inference_job",
"crates/service/twitch_pubsub_subscriber",
"crates/service/w2l_download_job",
"crates/service/w2l_inference_job",
"crates/service/websocket_gateway",
"crates/api_clients/artcraft/artcraft_api_defs",
"crates/api_clients/artcraft/artcraft_client",
"crates/api_clients/artcraft/artcraft_router",
"crates/api_clients/fal_client",
"crates/api_clients/gmicloud_client",
"crates/api_clients/grok_api_client",
"crates/api_clients/grok_consumer_client",
"crates/api_clients/kinovi_web_client",
"crates/api_clients/midjourney_client",
"crates/api_clients/openai_sora_client",
"crates/api_clients/worldlabs_api_client",
"crates/api_clients/worldlabs_consumer_client",
"crates/desktop/artcraft",
"crates/lib/browser_emulation",
"crates/lib/build_metadata",
"crates/lib/caching/memory_store",
"crates/lib/cloudflare_errors",
"crates/lib/cloudflare_mitigation",
"crates/lib/cookie_store",
"crates/lib/cookie_store_wrapper",
"crates/lib/data/primitives",
"crates/lib/data/web_base64",
"crates/lib/errors",
"crates/lib/files/file_to_base64_url",
"crates/lib/files/filesys",
"crates/lib/files/images",
"crates/lib/files/mimetypes",
"crates/lib/http_headers",
"crates/lib/jwt_light",
"crates/lib/url_utils",
"crates/lib/uuid_utils",
"crates/schema/database/sqlite_tasks",
"crates/schema/public/enums",
"crates/schema/public/tokens",
"crates/testing/test_data",
"crates/testing/test_utils",
"crates/vendor/tauri-plugin-http",
]
default-members = ["crates/desktop/artcraft"]
[workspace.package]
publish = false
[workspace.dependencies]
artcraft_api_defs = { path = "crates/api_clients/artcraft/artcraft_api_defs" }
artcraft_client = { path = "crates/api_clients/artcraft/artcraft_client" }
artcraft_router = { path = "crates/api_clients/artcraft/artcraft_router" }
browser_emulation = { path = "crates/lib/browser_emulation" }
cookie_store_wrapper = { path = "crates/lib/cookie_store_wrapper" }
build_metadata = { path = "crates/lib/build_metadata" }
cloudflare_errors = { path = "crates/lib/cloudflare_errors" }
cloudflare_mitigation = { path = "crates/lib/cloudflare_mitigation" }
cookie_store = { path = "crates/lib/cookie_store" }
enums = { path = "crates/schema/public/enums" }
errors = { path = "crates/lib/errors" }
fal_client = { path = "crates/api_clients/fal_client" }
gmicloud_client = { path = "crates/api_clients/gmicloud_client" }
file_to_base64_url = { path = "crates/lib/files/file_to_base64_url" }
filesys = { path = "crates/lib/files/filesys" }
grok_api_client = { path = "crates/api_clients/grok_api_client" }
grok_consumer_client = { path = "crates/api_clients/grok_consumer_client" }
http_headers = { path = "crates/lib/http_headers" }
images = { path = "crates/lib/files/images" }
jwt_light = { path = "crates/lib/jwt_light" }
memory_store = { path = "crates/lib/caching/memory_store" }
midjourney_client = { path = "crates/api_clients/midjourney_client" }
mimetypes = { path = "crates/lib/files/mimetypes" }
openai_sora_client = { path = "crates/api_clients/openai_sora_client" }
primitives = { path = "crates/lib/data/primitives" }
kinovi_web_client = { path = "crates/api_clients/kinovi_web_client" }
sqlite_tasks = { path = "crates/schema/database/sqlite_tasks" }
test_data = { path = "crates/testing/test_data" }
test_utils = { path = "crates/testing/test_utils" }
tokens = { path = "crates/schema/public/tokens" }
url_utils = { path = "crates/lib/url_utils" }
uuid_utils = { path = "crates/lib/uuid_utils" }
web_base64 = { path = "crates/lib/data/web_base64" }
worldlabs_api_client = { path = "crates/api_clients/worldlabs_api_client" }
worldlabs_consumer_client = { path = "crates/api_clients/worldlabs_consumer_client" }
anyhow = "1.0.102"
assertor = "0.0.3"
base64 = "0.22.1"
bstr = "1.12.1"
byteorder = "1.5.0"
chrono = { version = "0.4.44", features = ["serde"] }
cookie = "0.18.1"
env = "1.0.1"
env_logger = "0.11.9"
futures = { version = "0.3.32" }
indexmap = "2.13.0"
log = "0.4.29"
once_cell = "1.21.4"
rand = "0.9.1"
regex = "1.12.3"
reqwest = { version = "0.12.23", default-features = false, features = [ "charset", "http2", "system-proxy", "json", "cookies", "rustls-tls", "gzip" ] }
serde = { version = "1.0.228", features = ["derive"] }
serde_derive = "1.0.228"
serde_json = "1.0.149"
sha2 = "0.11.0-rc.5"
sha3 = "0.10.8"
strum = { version = "0.28.0", features = ["derive"] }
tauri = { version = "2.11.2", features = ["unstable", "devtools", "protocol-asset"] } # NB: "devtools" prevents App Store distribution; "ubstable" is needed for window access
tauri-plugin-dialog = "2.7.1"
tauri-plugin-fs = "2.5.1"
tauri-plugin-log = "2.8.0"
tauri-plugin-upload = "2.4.0"
tempdir = "0.3.7"
tempfile = "3.27.0"
thiserror = "2.0.18"
tokio = { version = "1.50.0", features = ["macros"] }
tokio-util = "0.7.12"
toml = "1.0.7+spec-1.1.0"
url = { version = "2.5.8", features = ["serde"] }
utoipa = { version = "5.4.0", features = ["chrono", "actix_extras", "url"] }
uuid = "1.22.0"
walkdir = "2.4.0"
# wreq native prerequisites:
# macOS: brew install cmake pkg-config llvm
# Windows: choco install cmake strawberryperl pkgconfiglite llvm nasm
wreq-util = "3.0.0-rc.10"
wreq = { version = "6.0.0-rc.28", features = ["json", "query", "form", "multipart", "cookies", "ws", "stream", "gzip", "brotli", "zstd", "deflate"] }
+70
View File
@@ -0,0 +1,70 @@
# Persist clippy check configurations:
# https://github.com/ericseppanen/cargo-cranky
# Clippy doesn't allow this (yet):
# https://github.com/rust-lang/rust-clippy/issues/6625
deny = [
# Rust
"unsafe_code", # We may remove this if needed
# Clippy - "serious" lints
"clippy::borrow_interior_mutable_const", # Seems dangerous to allow this. Eg. `const F = Lazy::new()`;
# Clippy - bad math
#"clippy::cast_possible_truncation", # Seems dangerous, eg f64 to u64.
#"clippy::cast_possible_wrap",
# Clippy - pointer safety / readability / correctness
"clippy::as_ptr_cast_mut",
"clippy::borrow_as_ptr",
"clippy::borrow_deref_ref",
# Clippy async
"clippy::await_holding_lock",
# Clippy - performance
"clippy::cmp_owned",
"clippy::useless_vec",
"clippy::format_in_format_args",
#"clippy::redundant_clone",
#"clippy::unnecessary_to_owned",
#"clippy::vec_init_then_push",
# Clippy - "ergonomic" / "usage" lints
"clippy::clone_on_copy", # Don't use clone() on Copy types
"clippy::option_option", # Lint: Don't ever Option<Option<T>>! Enums instead.
"clippy::zero_sized_map_values", # Lint: use a HashSet instead of HashMap<T, ()>.
# Clippy - "aesthetic" / "style" lints
"clippy::clone_double_ref", # Lint: feels safer/hygienic to disallow this, but I'm not strongly opposed.
"clippy::double_comparisons", # Lint: readability
"clippy::empty_structs_with_brackets", # Lint: {} feels less aesthetic than ;
"clippy::implicit_clone", # Lint: Recommendation here seems more idiomatic.
"clippy::needless_late_init", # Don't declare variables without initializing them
"clippy::needless_return", # Lint: not the worst offender, but let's try to keep unnecessary returns out.
"clippy::redundant_field_names", # Lint: Duplicate names is a burden when reading: you wonder why they're dupes.
"clippy::redundant_static_lifetimes", # Lint: feels more modern to elide static lifetimes
# Rust
"non_fmt_panics", # panic!(format!(...)) will be unsupported soon
"unused_imports", # These are easy to automatically cull
"unused_mut", # Be strict about mutability
"unused_parens", # Unused parens are ugly
"unused_variables", # Don't leave cruft
# Possible:
# "clippy::ptr_arg",
# "clippy::too_many_lines" (note: this is configurable)
]
warn = [
]
allow = [
# Rust
"deprecated", # Other systems can handle deprecated code instead of the linter
"missing_docs", # Not everything needs documentation. Too much documentation is bad. Literate code.
# Clippy
"clippy::if_same_then_else", # There are cases this is clearer! Branches may have notes / considerations.
"clippy::single_char_pattern", # This is like punishing trailing commas. Chars are dumb.
]
-187
View File
@@ -1,187 +0,0 @@
# ==================== Python Build Base ====================
FROM ghcr.io/storytold/docker-base-images-nvidia-cuda-experimental:080f96bc7087 as pybuild-base
# The downloader needs youtube-dl as a python library
# NB: No longer maintained: https://news.ycombinator.com/item?id=28319624
#RUN pip3 install --upgrade youtube-dl
# Used by the downloader script.
# And it looks like youtube-dl is dead...
# Per the README, it looks like pip will always pull the latest version.
# https://github.com/yt-dlp/yt-dlp#update
RUN python3 -m pip install --upgrade yt-dlp
# ==================== Python Build Step 2: Wav2Lip Requirements ====================
FROM pybuild-base as pybuild-requirements
WORKDIR /
COPY models/Wav2Lip ./models/Wav2Lip
WORKDIR models/Wav2Lip
# NB: We need Python3.6
RUN python3.6 -m venv python
#RUN virtualenv -p /usr/bin/python3.6 ... wait
RUN . python/bin/activate \
&& pip install --upgrade pip \
&& pip install -r requirements.txt \
&& deactivate
WORKDIR /
COPY models/tts ./models/tts
WORKDIR models/tts
# NB: Not sure if we need Python3.6 for Tacotron2, but Python3.8 gave me trouble.
# NB: Setuptools fix: https://github.com/tensorflow/tensorflow/issues/34302#issuecomment-554450289
RUN python3.6 -m venv python
RUN . python/bin/activate \
&& pip install --upgrade pip setuptools \
&& pip install -r requirements-tacotron-python36.txt \
&& deactivate
# ==================== Rust Build Base ====================
# Custom base image
# Make sure to add this repository so it has read acces to the base image:
# https://github.com/orgs/storytold/packages/container/docker-base-images-rust-ssl/settings/actions_access
FROM ghcr.io/storytold/docker-base-images-rust-ssl:latest as rust-build
WORKDIR /tmp
COPY Cargo.lock .
COPY Cargo.toml .
COPY sqlx-data.json .
COPY crates/ ./crates
COPY db/ ./db
RUN $HOME/.cargo/bin/cargo fetch
ARG GIT_SHA
RUN echo -n ${GIT_SHA} > GIT_SHA
# Run all of the tests
RUN SQLX_OFFLINE=true \
LD_LIBRARY_PATH=/usr/lib:${LD_LIBRARY_PATH} \
$HOME/.cargo/bin/cargo test
# Build all the binaries.
RUN SQLX_OFFLINE=true \
LD_LIBRARY_PATH=/usr/lib:${LD_LIBRARY_PATH} \
$HOME/.cargo/bin/cargo build \
--release \
--bin storyteller-web
RUN SQLX_OFFLINE=true \
LD_LIBRARY_PATH=/usr/lib:${LD_LIBRARY_PATH} \
$HOME/.cargo/bin/cargo build \
--release \
--bin tts-download-job
RUN SQLX_OFFLINE=true \
LD_LIBRARY_PATH=/usr/lib:${LD_LIBRARY_PATH} \
$HOME/.cargo/bin/cargo build \
--release \
--bin w2l-download-job
RUN SQLX_OFFLINE=true \
LD_LIBRARY_PATH=/usr/lib:${LD_LIBRARY_PATH} \
$HOME/.cargo/bin/cargo build \
--release \
--bin generic-download-job
RUN SQLX_OFFLINE=true \
LD_LIBRARY_PATH=/usr/lib:${LD_LIBRARY_PATH} \
$HOME/.cargo/bin/cargo build \
--release \
--bin tts-inference-job
RUN SQLX_OFFLINE=true \
LD_LIBRARY_PATH=/usr/lib:${LD_LIBRARY_PATH} \
$HOME/.cargo/bin/cargo build \
--release \
--bin w2l-inference-job
RUN SQLX_OFFLINE=true \
LD_LIBRARY_PATH=/usr/lib:${LD_LIBRARY_PATH} \
$HOME/.cargo/bin/cargo build \
--release \
--bin websocket-gateway
RUN SQLX_OFFLINE=true \
LD_LIBRARY_PATH=/usr/lib:${LD_LIBRARY_PATH} \
$HOME/.cargo/bin/cargo build \
--release \
--bin twitch-pubsub-subscriber
# Final image
# FROM ubuntu:xenial
FROM pybuild-requirements as final
WORKDIR /
COPY scripts/ ./scripts
# See: https://github.com/opencontainers/image-spec/blob/master/annotations.md
LABEL org.opencontainers.image.authors='bt@brand.io, echelon@gmail.com'
LABEL org.opencontainers.image.url='https://github.com/storytold/storyteller-web'
LABEL org.opencontainers.image.documentation='https://github.com/storytold/storyteller-web'
LABEL org.opencontainers.image.source='https://github.com/storytold/storyteller-web'
# NB(echelon,2022-05-31): NVIDIA revoked some of their keys.
# A better long term fix is to remove these dependencies outright and not have ML deps in this repo.
# https://developer.nvidia.com/blog/updating-the-cuda-linux-gpg-repository-key/
# https://forums.developer.nvidia.com/t/invalid-public-key-for-cuda-apt-repository/212901/11
RUN apt-key del 7fa2af80
# NB: Fix for 'E: Conflicting values set for option Signed-By regarding source'
# NB: We need to remove all sources
RUN rm $(find /etc/apt | grep cuda)
#RUN wget https://developer.download.nvidia.com/compute/cuda/repos/$distro/$arch/cuda-keyring_1.0-1_all.deb
RUN wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2004/x86_64/cuda-keyring_1.0-1_all.deb
RUN dpkg -i cuda-keyring_1.0-1_all.deb
# NB: Comment this out for non-debug images
# TODO: Figure out how this is done elsewhere with just the static binaries
# Others: `mysql-client`
RUN apt-get update \
&& apt-get install -y \
curl \
python3-pip \
python3 \
wget
RUN python3 --version
# TODO: Use venv to do this instead.
RUN pip3 install gdown
# Copy all the binaries.
COPY --from=rust-build /tmp/target/release/storyteller-web /
COPY --from=rust-build /tmp/target/release/tts-download-job /
COPY --from=rust-build /tmp/target/release/tts-inference-job /
COPY --from=rust-build /tmp/target/release/w2l-download-job /
COPY --from=rust-build /tmp/target/release/w2l-inference-job /
COPY --from=rust-build /tmp/target/release/websocket-gateway /
COPY --from=rust-build /tmp/target/release/twitch-pubsub-subscriber /
COPY --from=rust-build /tmp/target/release/generic-download-job /
COPY --from=rust-build /tmp/GIT_SHA /
# SSL certs are required for crypto
COPY --from=rust-build /etc/ssl /etc/ssl
# Required dynamically linked libraries
COPY --from=rust-build /lib/x86_64-linux-gnu/libssl.* /lib/x86_64-linux-gnu/
COPY --from=rust-build /lib/x86_64-linux-gnu/libcrypto.* /lib/x86_64-linux-gnu/
# Make sure all the links resolve
RUN ldd storyteller-web
# Without a .env file, Rust crashes "mysteriously" (ugh)
RUN touch .env
RUN touch .env-secrets
EXPOSE 8080
CMD LD_LIBRARY_PATH=/usr/lib /storyteller-web
+86
View File
@@ -0,0 +1,86 @@
ArtCraft License (WIP)
======================
(**Warning**: This isn't a real lawyery license full of legitimate legalese yet, but we'll take care of that ASAP.)
ArtCraft is a form of "fair source" software. It's like [free beer](https://en.wiktionary.org/wiki/free_as_in_beer)
in that we give you the code, but there are a few small limitations on what you can do with it.
First, what you *can* do with ArtCraft:
> 1. You do not have to pay us to use ArtCraft. It's free.
>
> 2. You can back up, copy, modify, compile, and use the code for your own private personal purposes.
>
> 3. You can do anything you want with the media you create with ArtCraft. Generated assets are yours.
What you *can't do* with ArtCraft:
> 1. You cannot sell the ArtCraft software commercially (eg. as your own software).
>
> 2. You cannot use the ArtCraft code to develop a competing business or product (eg. selling AI image and video tools).
>
> 3. You cannot fork ArtCraft and remove ArtCraft community, donation links, or paid model services. We intend to
> make money to improve ArtCraft for everyone.
>
> 4. You cannot use the ArtCraft name, logo, or mascot characters to promote your business without permission.
This license means you can see what we're doing and not be at risk of having the rug pulled out from under
you (eg. if our founders die, if our business collapses, if zombies or space aliens invade). It also gives
you a really great way to customize the software or lend a hand in reporting (or even fixing) bugs.
Our desire is to support artists, designers, and filmmakers. We want to help you build your own creative studios
and businesses. We want to give you creative software you can use forever.
ArtCraft is free. We do offer models available through us where you can pay us and support our development, but we also
offer the ability for you to use other providers - and we'll keep adding more options so you have maximum flexibility.
## Our Promise
- All development and business plans will be communicated openly with the community.
- Except for minor test scripts or a few small places where we might need to use licensed 3rd party code, all of
our engineering efforts will live in a single publicly available monorepo. You can see everything we do and even
benefit from using it for personal use. We plan on building a lot more than what you see today, and you'll get
all of it.
- We will not "rug pull" our users. If our business shuts down, gets acquired, or otherwise changes, the tools
we create will always continue to function in the same way.
- If the business ends and our founders quit working in this space, we'll make it so the software transitions
to an OSI-approved open source license. (We don't intend to quit!)
## Why not OSI Open Source?
Philosophical answer: The OSI is an industry body led by hyperscalers. They poach from open source all the time, yet
hyperscaler systems and code (AWS, GCP, YouTube, etc.) remain closed source. The tiniest nuggets are open, but the vast
machinery surrounding it - systems, user behaviors, funnels, at-scale moneymakers - is totally closed.
Practical answer: OSI licenses make it exceptionally challenging to grow big things commercially. And many of
the licenses leave room for hyperscalers to reach in and cherry-pick pieces for themselves that they can better
commercialize than the original authors.
Then there's completely open source software that doesn't even attempt to be a business.
We love software like Blender, but (1) developing ArtCraft is our full-time job, (2) we want to build something at scale
that is much bigger than what you presently see, and (3) this will eventually become much more capital intensive than
just writing code - we want to train novel models that work directly in conjunction with the user interface.
If and when we do get to scale, we intend to keep every bit of our work in the open, including the models. Available
for use, inspection, learning, fitting onto consumer GPU hardware, and more.
Not having a way to make money is unfortunately what killed Stability.ai. Stability.ai walked so that others could
eventually run. (Black Forest Labs, et al.) We're not egotistical enough to count ourselves in that party yet, but we
believe in the original Stability.ai ethos and that their model can work with a few tweaks.
We want to build big and incredible tools the world hasn't seen before. We want to keep them free and entirely source
available. You don't have to pay us, but if you do, all of your investment goes right back into the engineering
and the tools. We're writing code you can clone and keep.
## Inspiration
We took inspiration for this from [Fair Source](https://fair.io/), [Fair Code](https://faircode.io/),
the [Defold License](https://defold.com/license/), and Hacker News discussions. The folks at Obsidian
have some pretty good thoughts on this as well.
~ Brandon Thomas
+118 -56
View File
@@ -1,77 +1,139 @@
storyteller-rust
================
<h1 align="center">ArtCraft</h1>
<p align="center"><strong>The IDE for artists.</strong></p>
Our Rust monorepo, which services our
API surface area.
<!-- Main video: https://www.youtube.com/watch?v=kzvQMdg66Go
GitHub media issue: https://github.com/storytold/artcraft/issues/1951 -->
Application overview
--------------------
https://github.com/user-attachments/assets/7339bd09-3e0d-44a7-a024-af9de64e4c11
* [FakeYou.com](https://fakeyou.com) is powered by:
* HTTP APIs:
* `storyteller-web` - HTTP + database monolith for FakeYou
* Asynchronous Jobs:
* `tts-download-job` - Async download of models
* `tts-inference-job` - Async TTS inference
* `w2l-download-job` - Async download of videos and images
* `w2l-inference-job` - Async W2L inference
<p align="center">
<a href="https://www.youtube.com/watch?v=kzvQMdg66Go">Watch the two-minute ArtCraft demo on YouTube</a>
</p>
* [StorytellerStream](https://storyteller.stream) is powered by:
* HTTP APIs:
* `storyteller-web` - HTTP + database monolith for FakeYou
* Websocket events:
* `websocket-gateway` - Websocket to pull down Twitch events.
* Twitch API integration:
* `twitch-pubsub-subscriber` - Dynamically subscribes to Twitch PubSub for "active" users
<p align="center">
<a href="https://discord.gg/artcraft"><img alt="Discord members online" src="https://img.shields.io/discord/1359579021108842617?style=for-the-badge&amp;label=Discord&amp;color=5865F2&amp;logo=discord&amp;logoColor=white"></a>
<a href="https://www.youtube.com/@OfficialArtCraftStudios"><img alt="YouTube" src="https://img.shields.io/badge/YouTube-FF0000?style=for-the-badge&amp;logo=youtube&amp;logoColor=white"></a>
<a href="https://x.com/get_artcraft"><img alt="X" src="https://img.shields.io/badge/X-181717?style=for-the-badge&amp;logo=x&amp;logoColor=white"></a>
<a href="https://www.linkedin.com/company/artcraft-ai"><img alt="LinkedIn" src="https://img.shields.io/badge/LinkedIn-0A66C2?style=for-the-badge"></a>
</p>
Schema and API notes
--------------------
<p align="center">
<a href="https://getartcraft.com/">Download ArtCraft</a> ·
<a href="https://github.com/storytold/artcraft/releases">GitHub releases</a> ·
<a href="./_docs/dev_setup.md">Build from source</a>
</p>
* [Redis Schema Notes README](_docs/redis_schema.md)
ArtCraft is the IDE for interactive AI image and video creation. Compose in 2D, stage scenes in 3D, and choose the models that fit your work. Turn prompting into *crafting* with visual tools for precise, repeatable results.
Local development
-----------------
## Show, Don't Tell: Advanced Crafting Features
[Local development setup README](_docs/local_development_setup.md)
Artists need control over composition, character identity, and camera placement. Build the scene before you generate it. Click any preview to view it at full size.
Production and Deployment
-------------------------
| Feature | Preview |
| ------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **Image to Location**<br>Place virtual actors in a consistent environment and plan multiple shots in the same room. | <a href="https://github.com/user-attachments/assets/21f103e3-cc19-4882-a630-9caa1b76ae31"><img src="https://github.com/user-attachments/assets/21f103e3-cc19-4882-a630-9caa1b76ae31" width="180" alt="Image to Location demo"></a> |
| **3D Image Compositing**<br>Layer backdrops, foregrounds, and props in 3D to build compositions with depth. | <a href="https://github.com/user-attachments/assets/f93a616f-571d-474e-bcc0-53736de7303d"><img src="https://github.com/user-attachments/assets/f93a616f-571d-474e-bcc0-53736de7303d" width="180" alt="3D Image Compositing demo"></a> |
| **2D Image Compositing**<br>Compose a scene with image layers, background removal, and drawing tools. | <a href="https://github.com/user-attachments/assets/d6f99391-e496-4c62-9e37-29734ba5f899"><img src="https://github.com/user-attachments/assets/d6f99391-e496-4c62-9e37-29734ba5f899" width="180" alt="2D Image Compositing demo"></a> |
| **Image to 3D Mesh**<br>Turn an image into a 3D object you can position, rotate, and frame precisely. | <a href="https://github.com/user-attachments/assets/600a405c-e360-48c1-9b42-6e657ae6243b"><img src="https://github.com/user-attachments/assets/600a405c-e360-48c1-9b42-6e657ae6243b" width="180" alt="Image to 3D Mesh demo"></a> |
| **Character Posing**<br>Pose characters and set your camera before generating the final shot. | <a href="https://raw.githubusercontent.com/storytold/github-media/22a27373707b13f48fc56405f1f89ca143c43d5d/character-posing.webp"><img src="https://raw.githubusercontent.com/storytold/github-media/22a27373707b13f48fc56405f1f89ca143c43d5d/character-posing.webp" width="180" alt="Character Posing demo"></a> |
| **Scene Blocking with Kitbashing**<br>Combine 3D asset kits to control camera angles, object placement, and depth. | <a href="https://github.com/user-attachments/assets/eef025ac-0346-4a46-a023-d48e23629eb5"><img src="https://github.com/user-attachments/assets/eef025ac-0346-4a46-a023-d48e23629eb5" width="180" alt="Scene Blocking with Kitbashing demo"></a> |
| **Character Identity Transfer**<br>Use a posed mannequin to guide the placement and pose of your character. | <a href="https://github.com/user-attachments/assets/629119ee-8c76-4a83-9827-8c6c995a3ec1"><img src="https://github.com/user-attachments/assets/629119ee-8c76-4a83-9827-8c6c995a3ec1" width="180" alt="Character Identity Transfer demo"></a> |
| **Background Removal**<br>Isolate subjects to use as props, layers, or backdrops in 2D and 3D scenes. | <a href="https://github.com/user-attachments/assets/90c65057-5531-404f-83af-b34e66e24ec1"><img src="https://github.com/user-attachments/assets/90c65057-5531-404f-83af-b34e66e24ec1" width="180" alt="Background Removal demo"></a> |
| **Mixed Asset Crafting**<br>Combine image cutouts, worlds, and 3D meshes in one scene. | <a href="https://raw.githubusercontent.com/storytold/github-media/main/ship-editing.gif"><img src="https://raw.githubusercontent.com/storytold/github-media/main/ship-editing.gif" width="180" alt="Mixed Asset Crafting demo"></a> |
[Production builds and deployment README](_docs/production_builds_and_deployment.md)
More previews are coming for scene blocking, canvas editing, and scene relighting.
Development notes
-----------------
## Quick and Easy Prompting
[Development notes README](_docs/development_notes.md)
Start with a prompt when you want to explore an idea quickly, then use the canvas and scene tools to refine it.
Dump a MySQL report
-------------------
| Feature | Preview |
| ------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **Text to Image**<br>Explore ideas across a wide range of image models with a text prompt. | <a href="https://github.com/user-attachments/assets/9cc289cd-faf4-4eaf-aed2-21134cce127c"><img src="https://github.com/user-attachments/assets/9cc289cd-faf4-4eaf-aed2-21134cce127c" width="180" alt="Text to Image demo"></a> |
| **Prompted Image Editing**<br>Describe changes to an image with models such as Nano Banana Pro and GPT Image. | <a href="https://github.com/user-attachments/assets/a06fa6ad-936c-42d0-8767-48fdbb8ff141"><img src="https://github.com/user-attachments/assets/a06fa6ad-936c-42d0-8767-48fdbb8ff141" width="180" alt="Prompted Image Editing demo"></a> |
| **Canvas Image Editing**<br>Use drawing, masks, and inpainting to guide exactly where an image changes. | <a href="https://github.com/user-attachments/assets/f036e08a-f3a6-417a-98ee-ec7f04b2b5ff"><img src="https://github.com/user-attachments/assets/f036e08a-f3a6-417a-98ee-ec7f04b2b5ff" width="180" alt="Canvas Image Editing demo"></a> |
| **Image to Video**<br>Animate an image with your choice of video models and generation controls. | <a href="https://github.com/user-attachments/assets/2bc6c592-511e-4fba-b40f-03c96699b7f7"><img src="https://github.com/user-attachments/assets/2bc6c592-511e-4fba-b40f-03c96699b7f7" width="180" alt="Image to Video demo"></a> |
```
mysql -u storyteller \
-pPasswordHere \
-h IP_HERE \
-P 3306 \
-D storyteller \
-B \
-e "select * from voice_clone_requests;" | sed "s/'/\'/;s/\t/\",\"/g;s/^/\"/;s/$/\"/;s/\n//g" > voice_clone_report.csv
```
More previews are coming for image inpainting and image ingredients.
TODO
----
## Models and Providers Supported within ArtCraft
* Revise this README to be more useful.
| Provider | Models and workflows |
| ------------ | ----------------------------------------------------------------------------------------------- |
| **ArtCraft** | Images, video, music and sound, 3D meshes, and worlds. Browse the complete model catalog below. |
| Grok | Grok Imagine and Grok Video. |
| Midjourney | Midjourney image generation. |
| Sora | Sora 1, Sora 2, and GPT Image 1. |
| World Labs | Marble world generation with Gaussian splats. |
Notes / TODOs:
<details>
<summary><strong>ArtCraft: the full 62-model catalog</strong></summary>
* Examples for good Actix+Sqlx Tests:
https://stackoverflow.com/questions/65370752/how-do-i-create-an-actix-web-server-that-accepts-both-sqlx-database-pools-and-tr
<!-- Catalog source: artcraft-services/crates/service/web/storyteller_web/src/configs/omni_gen/
image_models.rs, video_models/video_models.rs + by_type/, audio_models.rs,
mesh_models.rs, and splat_models.rs. Include the GenerationProvider::Artcraft
mappings, not every model defined for other providers. -->
* Actix/sqlx runtime compat:
https://github.com/launchbadge/sqlx/issues/1117#issuecomment-801237734
* Redis caching of more endpoints
† Currently disabled. ‡ Restricted model; not currently available in the desktop app.
* Jobs for analytics queries (#uses per model, etc)
* Jobs for ingesting Discord, Twitter, Reddit RPAN chat, Twitch chat (not PubSub), etc.
#### Images (16)
| Family | Models |
| ----------- | ----------------------------------------------------------------------------------- |
| Nano Banana | Nano Banana; Nano Banana 2; Nano Banana Pro |
| GPT Image | GPT Image 1.5; GPT Image 2; GPT Image 2.5 Flare; GPT Image 2.5 Sunburst |
| FLUX | FLUX.1 [dev]; FLUX.1 [schnell]; FLUX 1.1 [pro]; FLUX 1.1 [pro] ultra |
| Seedream | Seedream 4; Seedream 4.5; Seedream 5 Lite; Seedream 5.0 Pro; Seedream 5.0 Pro Ultra |
#### Video (25)
| Family | Models |
| -------- | ----------------------------------------------------------------------------------------------------------------------------- |
| Seedance | Seedance 1.0 Lite †; Seedance 1.5 Pro; Seedance 2.0 |
| Kling | Kling 1.6 Pro; Kling 2.1 Pro †; Kling 2.1 Master †; Kling 2.5 Turbo Pro; Kling 2.6 Pro; Kling 3.0 Pro †; Kling 3.0 Standard † |
| Veo | Veo 2 †; Veo 3 †; Veo 3 Fast; Veo 3.1; Veo 3.1 Fast; Veo 3.1 Lite |
| Sora | Sora 2 †; Sora 2 Pro † |
| Vidu | Vidu Q3; Vidu Q3 Turbo |
| MiniMax | MiniMax H3; MiniMax H3 Turbo ‡; MiniMax H3 Ultra ‡ |
| Flux | Flux 3; Flux 3 Draft |
#### Music and sound (5)
| Family | Models |
| ---------- | ------------------------------------------------ |
| Suno | Suno Music; Suno Remix; Suno Sounds; Suno Sample |
| Seed Audio | Seed Audio 1.0 |
#### 3D meshes (11)
| Family | Models |
| ---------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Hunyuan 3D | Hunyuan 3D 2.0; Hunyuan 3D 2.1; Hunyuan 3D 3; Hunyuan 3D 3 Sketch; Hunyuan 3D 3.1 Pro; Hunyuan 3D 3.1 Rapid; Hunyuan 3D 3.1 Part; Hunyuan 3D 3.1 Smart Topology |
| Tripo3D | Tripo3D H3.1 |
| Meshy | Meshy 6 |
| Rodin | Rodin 2.5 Fast |
#### Worlds and Gaussian splats (5)
| Family | Models |
| ---------- | --------------------------------------------------------- |
| Marble | Marble 1.0; Marble 1.0 Draft; Marble 1.1; Marble 1.1 Plus |
| TripoSplat | TripoSplat |
</details>
Additional provider integrations are planned for Kling, Google, Runway, and Luma. We're also interested in supporting existing subscriptions with aggregators such as OpenArt and Freepik.
## Downloads
- [Stable releases for Windows and macOS](https://getartcraft.com/)
- [Latest builds on GitHub](https://github.com/storytold/artcraft/releases)
- [Build from source](./_docs/dev_setup.md), including Linux
## Documentation
- [Development setup](./_docs/dev_setup.md)
- [Developer documentation](./_docs)
- [Desktop build and development scripts](./script/artcraft)
- [Roadmap](./ROADMAP.md)
- [License](./LICENSE.md)
+47
View File
@@ -0,0 +1,47 @@
ArtCraft Roadmap
================
## 2026 Goals (non-exhaustive)
Product
- Make ArtCraft better and more useful than model aggregation websites (our #1 goal).
We don't dislike those websites; we just set a high standard for ourselves.
- Build the best "tangible" computing surfaces where you can mold scenes and videos like
clay and direct them with precision and clarity.
- Add every model and provider into ArtCraft so you can build your own crafting IDE.
Nothing will be left out.
- Build purpose-specific image models, eg. for relighting scenes and reposing characters
and props.
Studio
- Build our content studio. Make lots of narrative shorts and at least one
feature-length AI film by the year's end. Theatrical distribution, but also lots
of social media content. (We are creators, and we want to employ more creators!)
- Host festivals and competitions, including in-person meetups and screenings.
Architecture
- Remove dependence on ArtCraft hosted services.
- More Rust, more speed.
- Code cleanup, more/better tests, CI, ...
Community
- Build a safe community free of negativity and anti-AI stigma. A community of filmmakers
and artists.
## Loftier Goals
- Build an *Open* OpenAI / Google / Anthropic. Open models, open platforms, open hardware.
Why? Because the future could be bleak without it. How, you might ask? Get in touch if
you're curious.
- Don't Be Evil™
@@ -0,0 +1,127 @@
-- noinspection SqlDialectInspectionForFile
--
-- NB: This version needs to be bumped even if just adding or changing comments!
-- Failure to do so will cause Windows to segfault at start. (This is horrible!)
--
-- NB: `app_state_dir.rs` contains the file version number.
--
-- Migration history:
-- tasks_v1.sqlite - initial version
-- tasks_v2.sqlite - added model_type (nullable)
-- tasks_v3.sqlite - added frontend_caller, comments
-- tasks_v4.sqlite - added is_dismissed_by_user
-- tasks_v5.sqlite - added five fields:
-- on_complete_batch_token,
-- on_complete_primary_media_file_token,
-- on_complete_primary_media_file_class,
-- on_complete_primary_media_file_cdn_url,
-- on_complete_primary_media_file_thumbnail_url_template,
-- tasks_v6.sqlite - added two fields:
-- on_failure_type
-- on_failure_message
-- tasks_v7.sqlite - added prompt token + two fields (for fal):
-- prompt_token
-- queue_status_url
-- queue_response_url
CREATE TABLE tasks (
-- Task auto-incrementing primary key.
-- We don't use this.
id TEXT NOT NULL PRIMARY KEY,
-- TaskStatus enum
-- This is how the job system manages job states.
-- e.g. pending, started, complete_success, dead, etc.
task_status TEXT NOT NULL,
-- TaskType enum
-- e.g. image_generation, video_generation, etc.
task_type TEXT NOT NULL,
-- TaskModelType enum
-- e.g. flux_1_dev, veo_2, etc.
model_type TEXT,
-- GenerationProvider enum
-- Together with `provider_job_id`, this creates a foreign key lookup to the job.
-- e.g. 'artcraft', 'fal', 'sora', etc.
provider TEXT,
-- The primary key for the job in the provider's system.
provider_job_id TEXT,
-- OPTIONAL.
-- For third party jobs, we need to record the prompt details upfront.
-- We create a prompt record and store the token to associate once the task completes.
prompt_token TEXT,
-- OPTIONAL.
-- Tell the job system which caller initiated the task.
-- e.g. 'canvas'
frontend_caller TEXT,
-- OPTIONAL.
-- An arbitrary opaque identifier that frontend can set.
frontend_subscriber_id TEXT,
-- OPTIONAL.
-- An opaque JSON payload set by the frontend subscriber that
-- will be re-emitted back to the frontend.
frontend_subscriber_payload TEXT,
-- Whether the user has dismissed the task from view.
is_dismissed_by_user INTEGER NOT NULL DEFAULT 0,
-- OPTIONAL.
-- For some third party systems (eg. FAL), the URL to check the status of the
-- job in the queue.
queue_status_url TEXT,
-- OPTIONAL.
-- For some third party systems (eg. FAL), the URL to check the
-- results (when the job completes)
queue_response_url TEXT,
-- OPTIONAL.
-- When the generation completes, the batch token (if any).
-- This will point to a collection of multiple files.
on_complete_batch_token TEXT,
-- OPTIONAL.
-- When the generation completes, the media token of the "primary" media file.
-- We'll probably always generate homogenous types, but just in case this is the first or primary item in a batch.
on_complete_primary_media_file_token TEXT,
-- OPTIONAL.
-- When the generation completes, the file type of the primary media file.
-- We'll probably always generate homogenous types, but just in case this is the first or primary item in a batch.
on_complete_primary_media_file_class TEXT,
-- OPTIONAL.
-- The URL to the media file.
on_complete_primary_media_file_cdn_url TEXT,
-- OPTIONAL.
-- The URL template for the thumbnail of the primary media file.
on_complete_primary_media_file_thumbnail_url_template TEXT,
-- OPTIONAL.
-- An enum-like string describing the failure reason (even for non-terminal failures).
-- The enum is `TaskFailureType`, which is a close analogue of the backend API's `FrontendFailureCategory`.
on_failure_type TEXT,
-- OPTIONAL.
-- A human-readable message describing the failure reason (even for non-terminal failures).
on_failure_message TEXT,
created_at INTEGER NOT NULL DEFAULT (unixepoch('now')),
updated_at INTEGER NOT NULL DEFAULT (unixepoch('now')),
completed_at INTEGER DEFAULT NULL
);
-- Unique Indices
CREATE UNIQUE INDEX idx_tasks_on_provider_job_id ON tasks(provider_job_id);
-- Indices
CREATE INDEX idx_tasks_on_status ON tasks(task_status);
CREATE INDEX idx_tasks_on_provider ON tasks(provider);
+625
View File
@@ -0,0 +1,625 @@
# ArtCraft Omni API
> # 📚 Full API reference: **<https://storyteller-docs.netlify.app/>**
>
> **Every ArtCraft API endpoint is documented there.** This guide covers only the Omni API video
> endpoints — for everything else, start at the link above.
The **Omni API** is the API-key–authenticated surface for ArtCraft generation. It mirrors the
in-app "Omni Gen" endpoints but is designed for programmatic use: you authenticate with an API key
in the `Authorization` header instead of a browser session cookie.
This guide covers **video generation from URL inputs** — passing image, video, and audio reference
URLs directly. The server downloads each URL, stores it as a media file on your account, and then
runs generation against it. You never have to upload files yourself.
> All examples send **no cookies**. The Omni API is authenticated purely by your API key. If you
> send session cookies they are ignored.
---
## Base URLs
| Environment | Base URL |
| ------------- | ------------------------------ |
| Development | `http://localhost:12345` |
| Production | `https://api.storyteller.ai` |
All paths below are relative to the base URL (e.g. `POST /v1/omni_api/generate/video`).
The examples in this guide use the **development** base URL. To run against production, swap
`http://localhost:12345` for `https://api.storyteller.ai`.
Note: Our APIs are hosted on "`api.storyteller.ai`", not "`api.getartcraft.com`". This is not a
typo. Our Cloudflare CDN URLs are `cdn-2.fakeyou.com`.
---
## Getting an API key
Create and manage API keys from the ArtCraft web app:
1. Go to **<https://app.getartcraft.com/>**
2. Click **Account → Settings → API Keys** (your account must have API keys enabled from our staff)
3. Create a key and copy it. The secret is shown **once** — store it somewhere safe.
> **Don't see the API Keys section?** API access is gated per account. Contact the Artcraft team
> to enable it.
### What an API key looks like
- Prefix: `artcraft_api_`
- Followed by 40 random lowercase Crockford-base32 characters (`0-9 a-z`, excluding `i l o u`)
- Total length: **53 characters**, e.g. `artcraft_api_3k7q9w0xv2hs5n8m4d6r1t8y0p2s4f6h8j0k2m4n6`
Treat the key like a password: never commit it to source control or paste it into logs.
---
## Authentication
Send the secret key in the `Authorization` header. Three forms are accepted:
```
Authorization: Bearer artcraft_api_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Authorization: Key artcraft_api_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Authorization: artcraft_api_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
```
`Bearer` is recommended. **Do not send cookies.**
---
## Video generation — `POST /v1/omni_api/generate/video`
Generates a video and returns an inference job token you can poll for results.
### Request body
| Field | Type | Notes |
| ---------------------------- | --------------- | ----- |
| `model` | string | Generation model, e.g. `seedance_2p0`. **Required.** |
| `prompt` | string | Text prompt. |
| `duration_seconds` | integer | Length of the output video, e.g. `6`. |
| `aspect_ratio` | string | e.g. `wide_sixteen_by_nine`, `tall_nine_by_sixteen`, `square`. |
| `idempotency_token` | string (UUID) | **Required.** A fresh UUID per request; prevents accidental duplicates. |
| `negative_prompt` | string | Optional. |
| `resolution` | string | Optional, e.g. `seven_twenty_p`, `ten_eighty_p`. |
| `generate_audio` | boolean | Optional. |
| **URL inputs** (this guide) | | |
| `start_frame_image_url` | string (URL) | Starting keyframe image. |
| `end_frame_image_url` | string (URL) | Ending keyframe image. |
| `reference_image_urls` | array of URL | Reference images. |
| `reference_video_urls` | array of URL | Reference videos (`mp4`). |
| `reference_audio_urls` | array of URL | Reference audio (`wav`, `mp3`, `ogg`, …). |
| **Media-token inputs** | | |
| `start_frame_image_media_token`, `end_frame_image_media_token`, `reference_image_media_tokens`, `reference_video_media_tokens`, `reference_audio_media_tokens` | token(s) | Use these instead if you've already uploaded media. |
#### Rules for URL inputs
- Each URL field and its media-token counterpart are **mutually exclusive**. Sending both
`reference_image_urls` and `reference_image_media_tokens`, for example, returns:
`Either reference_image_media_tokens or reference_image_urls must be set, not both`.
- Every URL must start with `http://` or `https://`, otherwise:
`URL must start with http:// or https://, bad URL: <url>`.
- Redirects are followed (up to 10), so CDN/redirecting URLs work.
- The file type is detected from the downloaded bytes. Images must be a real image
(`jpeg`/`png`/`gif`/`webp`), reference videos must be `mp4`, reference audio must be a
supported audio type (`wav`, `mp3`, `aac`, `ogg`, `flac`, …).
### Response
```json
{
"success": true,
"inference_job_token": "jinf_xxxxxxxxxxxxxxxxxxxxxxxxx",
"all_job_tokens": ["jinf_xxxxxxxxxxxxxxxxxxxxxxxxx"]
}
```
Use `inference_job_token` to poll for the finished video. `all_job_tokens` lists every job created
(batch requests can create more than one).
---
## Examples
The examples reuse these public sample URLs:
- Images (Wikimedia Commons): an Atlantic puffin, the Matterhorn, a toco toucan
- Video: a short sample `mp4`
- Audio: a short sample `wav`
Replace `YOUR_API_KEY` with your `artcraft_api_…` secret, and generate a fresh `idempotency_token`
(UUID) for every request.
---
### Example 1 — Starting-frame Seedance (`start_frame_image_url`)
Animate outward from a single starting image.
#### bash
```bash
curl -s -X POST http://localhost:12345/v1/omni_api/generate/video \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "seedance_2p0",
"prompt": "An Atlantic puffin stands on a windy cliff edge and turns its head as morning light catches its colorful beak.",
"duration_seconds": 6,
"aspect_ratio": "wide_sixteen_by_nine",
"idempotency_token": "'"$(uuidgen)"'",
"start_frame_image_url": "https://commons.wikimedia.org/wiki/Special:FilePath/Puffin_%28Fratercula_arctica%29.jpg?width=900"
}'
```
#### python
```python
import uuid
import requests
BASE_URL = "http://localhost:12345" # production: https://api.storyteller.ai
API_KEY = "YOUR_API_KEY"
resp = requests.post(
f"{BASE_URL}/v1/omni_api/generate/video",
headers={"Authorization": f"Bearer {API_KEY}"},
json={
"model": "seedance_2p0",
"prompt": "An Atlantic puffin stands on a windy cliff edge and turns its head as morning light catches its colorful beak.",
"duration_seconds": 6,
"aspect_ratio": "wide_sixteen_by_nine",
"idempotency_token": str(uuid.uuid4()),
"start_frame_image_url": "https://commons.wikimedia.org/wiki/Special:FilePath/Puffin_%28Fratercula_arctica%29.jpg?width=900",
},
timeout=240,
)
resp.raise_for_status()
print(resp.json())
```
#### javascript
```javascript
import { randomUUID } from "node:crypto";
const BASE_URL = "http://localhost:12345"; // production: https://api.storyteller.ai
const API_KEY = "YOUR_API_KEY";
const resp = await fetch(`${BASE_URL}/v1/omni_api/generate/video`, {
method: "POST",
headers: {
Authorization: `Bearer ${API_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
model: "seedance_2p0",
prompt:
"An Atlantic puffin stands on a windy cliff edge and turns its head as morning light catches its colorful beak.",
duration_seconds: 6,
aspect_ratio: "wide_sixteen_by_nine",
idempotency_token: randomUUID(),
start_frame_image_url:
"https://commons.wikimedia.org/wiki/Special:FilePath/Puffin_%28Fratercula_arctica%29.jpg?width=900",
}),
});
console.log(resp.status, await resp.json());
```
---
### Example 2 — Image-reference Seedance (`reference_image_urls`)
Guide the generation with one or more reference images.
#### bash
```bash
curl -s -X POST http://localhost:12345/v1/omni_api/generate/video \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "seedance_2p0",
"prompt": "A whimsical journey: an Atlantic puffin perches on a cliff beneath the snow-capped Matterhorn while a brilliant toco toucan watches from a misty rainforest canopy.",
"duration_seconds": 6,
"aspect_ratio": "wide_sixteen_by_nine",
"idempotency_token": "'"$(uuidgen)"'",
"reference_image_urls": [
"https://commons.wikimedia.org/wiki/Special:FilePath/Puffin_%28Fratercula_arctica%29.jpg?width=900",
"https://commons.wikimedia.org/wiki/Special:FilePath/Matterhorn_from_Domh%C3%BCtte_-_2.jpg?width=900",
"https://commons.wikimedia.org/wiki/Special:FilePath/Toco_toucan.jpg?width=900"
]
}'
```
#### python
```python
import uuid
import requests
BASE_URL = "http://localhost:12345" # production: https://api.storyteller.ai
API_KEY = "YOUR_API_KEY"
resp = requests.post(
f"{BASE_URL}/v1/omni_api/generate/video",
headers={"Authorization": f"Bearer {API_KEY}"},
json={
"model": "seedance_2p0",
"prompt": "A whimsical journey: an Atlantic puffin perches on a cliff beneath the snow-capped Matterhorn while a brilliant toco toucan watches from a misty rainforest canopy.",
"duration_seconds": 6,
"aspect_ratio": "wide_sixteen_by_nine",
"idempotency_token": str(uuid.uuid4()),
"reference_image_urls": [
"https://commons.wikimedia.org/wiki/Special:FilePath/Puffin_%28Fratercula_arctica%29.jpg?width=900",
"https://commons.wikimedia.org/wiki/Special:FilePath/Matterhorn_from_Domh%C3%BCtte_-_2.jpg?width=900",
"https://commons.wikimedia.org/wiki/Special:FilePath/Toco_toucan.jpg?width=900",
],
},
timeout=240,
)
resp.raise_for_status()
print(resp.json())
```
#### javascript
```javascript
import { randomUUID } from "node:crypto";
const BASE_URL = "http://localhost:12345"; // production: https://api.storyteller.ai
const API_KEY = "YOUR_API_KEY";
const resp = await fetch(`${BASE_URL}/v1/omni_api/generate/video`, {
method: "POST",
headers: {
Authorization: `Bearer ${API_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
model: "seedance_2p0",
prompt:
"A whimsical journey: an Atlantic puffin perches on a cliff beneath the snow-capped Matterhorn while a brilliant toco toucan watches from a misty rainforest canopy.",
duration_seconds: 6,
aspect_ratio: "wide_sixteen_by_nine",
idempotency_token: randomUUID(),
reference_image_urls: [
"https://commons.wikimedia.org/wiki/Special:FilePath/Puffin_%28Fratercula_arctica%29.jpg?width=900",
"https://commons.wikimedia.org/wiki/Special:FilePath/Matterhorn_from_Domh%C3%BCtte_-_2.jpg?width=900",
"https://commons.wikimedia.org/wiki/Special:FilePath/Toco_toucan.jpg?width=900",
],
}),
});
console.log(resp.status, await resp.json());
```
---
### Example 3 — Image + video reference Seedance (`reference_image_urls` + `reference_video_urls`)
Combine reference images with a reference video (and, optionally, reference audio). This is the
fullest URL-driven request.
#### bash
```bash
curl -s -X POST http://localhost:12345/v1/omni_api/generate/video \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "seedance_2p0",
"prompt": "An Atlantic puffin stands on a windy cliff edge; the scene sweeps up to the snow-capped Matterhorn at sunrise before settling on a brilliant toco toucan in a misty rainforest canopy. The camera glides with the motion of the reference video, set to the mood of the reference audio.",
"duration_seconds": 6,
"aspect_ratio": "wide_sixteen_by_nine",
"idempotency_token": "'"$(uuidgen)"'",
"reference_image_urls": [
"https://commons.wikimedia.org/wiki/Special:FilePath/Puffin_%28Fratercula_arctica%29.jpg?width=900",
"https://commons.wikimedia.org/wiki/Special:FilePath/Matterhorn_from_Domh%C3%BCtte_-_2.jpg?width=900",
"https://commons.wikimedia.org/wiki/Special:FilePath/Toco_toucan.jpg?width=900"
],
"reference_video_urls": ["https://download.samplelib.com/mp4/sample-5s.mp4"],
"reference_audio_urls": ["https://download.samplelib.com/wav/sample-6s.wav"]
}'
```
#### python
```python
import uuid
import requests
BASE_URL = "http://localhost:12345" # production: https://api.storyteller.ai
API_KEY = "YOUR_API_KEY"
resp = requests.post(
f"{BASE_URL}/v1/omni_api/generate/video",
headers={"Authorization": f"Bearer {API_KEY}"},
json={
"model": "seedance_2p0",
"prompt": "An Atlantic puffin stands on a windy cliff edge; the scene sweeps up to the snow-capped Matterhorn at sunrise before settling on a brilliant toco toucan in a misty rainforest canopy. The camera glides with the motion of the reference video, set to the mood of the reference audio.",
"duration_seconds": 6,
"aspect_ratio": "wide_sixteen_by_nine",
"idempotency_token": str(uuid.uuid4()),
"reference_image_urls": [
"https://commons.wikimedia.org/wiki/Special:FilePath/Puffin_%28Fratercula_arctica%29.jpg?width=900",
"https://commons.wikimedia.org/wiki/Special:FilePath/Matterhorn_from_Domh%C3%BCtte_-_2.jpg?width=900",
"https://commons.wikimedia.org/wiki/Special:FilePath/Toco_toucan.jpg?width=900",
],
"reference_video_urls": ["https://download.samplelib.com/mp4/sample-5s.mp4"],
"reference_audio_urls": ["https://download.samplelib.com/wav/sample-6s.wav"],
},
timeout=240,
)
resp.raise_for_status()
print(resp.json())
```
#### javascript
```javascript
import { randomUUID } from "node:crypto";
const BASE_URL = "http://localhost:12345"; // production: https://api.storyteller.ai
const API_KEY = "YOUR_API_KEY";
const resp = await fetch(`${BASE_URL}/v1/omni_api/generate/video`, {
method: "POST",
headers: {
Authorization: `Bearer ${API_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
model: "seedance_2p0",
prompt:
"An Atlantic puffin stands on a windy cliff edge; the scene sweeps up to the snow-capped Matterhorn at sunrise before settling on a brilliant toco toucan in a misty rainforest canopy. The camera glides with the motion of the reference video, set to the mood of the reference audio.",
duration_seconds: 6,
aspect_ratio: "wide_sixteen_by_nine",
idempotency_token: randomUUID(),
reference_image_urls: [
"https://commons.wikimedia.org/wiki/Special:FilePath/Puffin_%28Fratercula_arctica%29.jpg?width=900",
"https://commons.wikimedia.org/wiki/Special:FilePath/Matterhorn_from_Domh%C3%BCtte_-_2.jpg?width=900",
"https://commons.wikimedia.org/wiki/Special:FilePath/Toco_toucan.jpg?width=900",
],
reference_video_urls: ["https://download.samplelib.com/mp4/sample-5s.mp4"],
reference_audio_urls: ["https://download.samplelib.com/wav/sample-6s.wav"],
}),
});
console.log(resp.status, await resp.json());
```
---
## Checking job status
Generation is asynchronous. The generate call returns an `inference_job_token`; poll the job-status
endpoint until the job reaches a terminal state, then read the result URL.
### Endpoints
- **Single job:** `GET /v1/omni_api/job_status/job/{token}`
- **Batch (many jobs):** `GET /v1/omni_api/job_status/batch?tokens=jinf_aaa&tokens=jinf_bbb`
Both require the same `Authorization: Bearer …` header (no cookies).
### Response shape
```json
{
"success": true,
"state": {
"job_token": "jinf_xxxxxxxxxxxxxxxxxxxxxxxxx",
"request": {
"inference_category": "video_generation",
"maybe_prompt_token": "prompt_xxxxxxxxxxxxxxxxxxxxxxxxx",
"maybe_model_type": "seedance_2p0",
"maybe_model_token": null
},
"status": {
"status": "pending",
"maybe_first_started_at": null,
"maybe_failure_category": null,
"progress_percentage": 0
},
"maybe_result": null,
"created_at": "2026-06-24T04:06:14Z",
"updated_at": "2026-06-24T04:06:14Z"
}
}
```
- `state.status.status` — the job state. Keep polling while it's `pending`, `started`, or
`attempt_failed`. **Terminal** states are `complete_success`, `complete_failure`, `dead`,
`cancelled_by_user`, and `cancelled_by_system`.
- `state.status.progress_percentage` — an integer 0–100.
- `state.maybe_result` — `null` until the job succeeds. On `complete_success` it contains the
finished media; the playable/downloadable URL is **`state.maybe_result.media_links.cdn_url`**.
For video, `media_links.maybe_video_previews` also carries still/animated preview URLs.
The batch endpoint returns `{ "success": true, "job_states": [ … ] }` where each entry is the same
`state` payload as above.
### Where the result video / image lives
When `state.status.status` is `complete_success`, the finished media is under `state.maybe_result`:
- **`state.maybe_result.media_links.cdn_url`** — the primary, playable/downloadable URL of the
finished asset. **This is the field you want.** For a video job it's the `.mp4`; for an image job
it's the image file (`.jpg` / `.png` / etc.).
- `state.maybe_result.entity_token` — the `m_…` media-file token for the result.
- `state.maybe_result.media_links.maybe_video_previews` — **video jobs only**. Contains a `still`
(poster `.jpg`) and an `animated` (`.gif`) preview URL, plus `{WIDTH}` thumbnail templates. This
is `null` for image jobs.
- `state.maybe_result.media_links.maybe_thumbnail_template` — **image jobs only**. A URL template;
replace `{WIDTH}` with a pixel width to fetch a resized thumbnail. `null` for video jobs.
**Example — completed video job:**
```json
{
"success": true,
"state": {
"job_token": "jinf_9fcn2qv4dv3vvbrrxbnmfgen06v",
"request": {
"inference_category": "video_generation",
"maybe_prompt_token": "prompt_q53tp4rh97qh8q159p21tazzt",
"maybe_model_type": "seedance_2p0",
"maybe_model_token": null
},
"status": {
"status": "complete_success",
"maybe_first_started_at": "2026-06-24T04:07:11Z",
"maybe_failure_category": null,
"progress_percentage": 100
},
"maybe_result": {
"entity_type": "media_file",
"entity_token": "m_ss682134tx19yhqs5y0nbnd0bd59a6",
"media_links": {
"cdn_url": "https://pub-c8a4a5bdbdb048f286b77bdf9f786ff2.r2.dev/media/8/p/n/0/4/8pn04v7q3vfhf60wy173f6awcwkre1qj/artcraft_8pn04v7q3vfhf60wy173f6awcwkre1qj.mp4",
"maybe_thumbnail_template": null,
"maybe_video_previews": {
"still": "https://pub-c8a4a5bdbdb048f286b77bdf9f786ff2.r2.dev/media/8/p/n/0/4/8pn04v7q3vfhf60wy173f6awcwkre1qj/artcraft_8pn04v7q3vfhf60wy173f6awcwkre1qj.mp4-thumb.jpg",
"animated": "https://pub-c8a4a5bdbdb048f286b77bdf9f786ff2.r2.dev/media/8/p/n/0/4/8pn04v7q3vfhf60wy173f6awcwkre1qj/artcraft_8pn04v7q3vfhf60wy173f6awcwkre1qj.mp4-thumb.gif",
"still_thumbnail_template": "https://pub-c8a4a5bdbdb048f286b77bdf9f786ff2.r2.dev/media/8/p/n/0/4/8pn04v7q3vfhf60wy173f6awcwkre1qj/artcraft_8pn04v7q3vfhf60wy173f6awcwkre1qj.mp4-thumb-{WIDTH}.jpg",
"animated_thumbnail_template": "https://pub-c8a4a5bdbdb048f286b77bdf9f786ff2.r2.dev/media/8/p/n/0/4/8pn04v7q3vfhf60wy173f6awcwkre1qj/artcraft_8pn04v7q3vfhf60wy173f6awcwkre1qj.mp4-thumb-{WIDTH}.gif"
}
},
"maybe_successfully_completed_at": "2026-06-24T04:17:30Z"
},
"created_at": "2026-06-24T04:06:14Z",
"updated_at": "2026-06-24T04:17:30Z"
}
}
```
→ The video is at
`https://pub-c8a4a5bdbdb048f286b77bdf9f786ff2.r2.dev/media/8/p/n/0/4/8pn04v7q3vfhf60wy173f6awcwkre1qj/artcraft_8pn04v7q3vfhf60wy173f6awcwkre1qj.mp4`
(example, not a live URL).
**Example — completed image job** (from `POST /v1/omni_api/generate/image`):
```json
{
"maybe_result": {
"entity_type": "media_file",
"entity_token": "m_3kq9w0xv2hs5n8m4d6r1t8y0p2s4f6",
"media_links": {
"cdn_url": "https://pub-c8a4a5bdbdb048f286b77bdf9f786ff2.r2.dev/media/3/k/q/9/w/3kq9w0xv2hs5n8m4d6r1t8y0p2s4f6/artcraft_3kq9w0xv2hs5n8m4d6r1t8y0p2s4f6.jpg",
"maybe_thumbnail_template": "https://pub-c8a4a5bdbdb048f286b77bdf9f786ff2.r2.dev/media/3/k/q/9/w/3kq9w0xv2hs5n8m4d6r1t8y0p2s4f6/artcraft_3kq9w0xv2hs5n8m4d6r1t8y0p2s4f6.jpg-thumb-{WIDTH}.jpg",
"maybe_video_previews": null
},
"maybe_successfully_completed_at": "2026-06-24T04:09:02Z"
}
}
```
→ The image is at
`https://pub-c8a4a5bdbdb048f286b77bdf9f786ff2.r2.dev/media/3/k/q/9/w/3kq9w0xv2hs5n8m4d6r1t8y0p2s4f6/artcraft_3kq9w0xv2hs5n8m4d6r1t8y0p2s4f6.jpg`
(example, not a live URL).
### Poll until complete
#### bash
```bash
JOB_TOKEN="jinf_xxxxxxxxxxxxxxxxxxxxxxxxx"
while :; do
resp=$(curl -s "http://localhost:12345/v1/omni_api/job_status/job/$JOB_TOKEN" \
-H "Authorization: Bearer YOUR_API_KEY")
status=$(echo "$resp" | python3 -c "import sys,json;print(json.load(sys.stdin)['state']['status']['status'])")
echo "status=$status"
case "$status" in
complete_success)
echo "$resp" | python3 -c "import sys,json;print(json.load(sys.stdin)['state']['maybe_result']['media_links']['cdn_url'])"
break ;;
complete_failure|dead|cancelled_by_user|cancelled_by_system)
echo "job ended without a result: $status"; break ;;
esac
sleep 5
done
```
#### python
```python
import time
import requests
BASE_URL = "http://localhost:12345" # production: https://api.storyteller.ai
API_KEY = "YOUR_API_KEY"
JOB_TOKEN = "jinf_xxxxxxxxxxxxxxxxxxxxxxxxx"
TERMINAL_FAILURES = {"complete_failure", "dead", "cancelled_by_user", "cancelled_by_system"}
while True:
resp = requests.get(
f"{BASE_URL}/v1/omni_api/job_status/job/{JOB_TOKEN}",
headers={"Authorization": f"Bearer {API_KEY}"},
timeout=30,
)
resp.raise_for_status()
state = resp.json()["state"]
status = state["status"]["status"]
print("status:", status, state["status"]["progress_percentage"], "%")
if status == "complete_success":
print("result URL:", state["maybe_result"]["media_links"]["cdn_url"])
break
if status in TERMINAL_FAILURES:
print("job ended without a result:", status)
break
time.sleep(5)
```
#### javascript
```javascript
const BASE_URL = "http://localhost:12345"; // production: https://api.storyteller.ai
const API_KEY = "YOUR_API_KEY";
const JOB_TOKEN = "jinf_xxxxxxxxxxxxxxxxxxxxxxxxx";
const TERMINAL_FAILURES = new Set([
"complete_failure", "dead", "cancelled_by_user", "cancelled_by_system",
]);
const sleep = (ms) => new Promise((r) => setTimeout(r, ms));
while (true) {
const resp = await fetch(`${BASE_URL}/v1/omni_api/job_status/job/${JOB_TOKEN}`, {
headers: { Authorization: `Bearer ${API_KEY}` },
});
const { state } = await resp.json();
const status = state.status.status;
console.log("status:", status, state.status.progress_percentage, "%");
if (status === "complete_success") {
console.log("result URL:", state.maybe_result.media_links.cdn_url);
break;
}
if (TERMINAL_FAILURES.has(status)) {
console.log("job ended without a result:", status);
break;
}
await sleep(5000);
}
```
---
## Notes & troubleshooting
- **Always send a fresh `idempotency_token`** (UUID). Reusing one is rejected as a duplicate.
- **No cookies.** The endpoint authenticates only via the `Authorization` header.
- **URL must be `http(s)`** and reachable by the server; redirects are followed.
- **Type mismatches** (e.g. a `.webm` passed as a reference video, which requires `mp4`) are
rejected with a `400` describing the unpermitted type.
- **`401 Unauthorized`** — missing/invalid API key, or the key's owner is banned.
- **`402 Payment required`** — insufficient credits/balance.
- There is a companion image endpoint, `POST /v1/omni_api/generate/image`, which accepts
`image_urls` (mutually exclusive with `image_media_tokens`) following the same rules.
-19
View File
@@ -1,19 +0,0 @@
database schema
================
Twitch Model
------------
- `twitch_user_id`
Though numeric, this should always be a string per
[https://discuss.dev.twitch.tv/t/bug-v5-api-returns--id-as-string-for-featured-channels/10310]
and
[https://discuss.dev.twitch.tv/t/type-of-user-id-in-api-responses/10205]
- `twitch_channel_id`
This is the same as `twitch_user_id`. They're exactly 1:1. Prefer to
use 'user_id' terminology.
- `twitch_username`
Between 4 and 25 characters.
+81
View File
@@ -0,0 +1,81 @@
Dev Setup
=========
# ArtCraft
ArtCraft is a Rust / Tauri app.
To set up the ArtCraft development environment, install the following:
1. [Install Rust](https://doc.rust-lang.org/cargo/getting-started/installation.html).
2. [Install npm](https://nodejs.org/en/download) or [nvm](https://github.com/nvm-sh/nvm). (Node version `v24.13.0` works at time of writing.)
3. The frontend's Nx and Vite dependencies are installed locally with npm; a global Nx installation is not required for the combined Unix launcher.
4. [Install Tauri CLI](https://v2.tauri.app/reference/cli/). (Version `tauri-cli 2.10.0` works at time of writing.)
**Mac and Linux Development**
```bash
# Start the frontend and Rust/Tauri together in one terminal
./script/artcraft/unix_dev.sh
# Optionally start the free-port search at another port
ARTCRAFT_DEV_PORT=6200 ./script/artcraft/unix_dev.sh
```
Use the combined launcher instead of starting the two legacy dev scripts. It
works from any working directory when invoked by its path and installs frontend
dependencies if the local Vite installation is missing. Node.js 20+ is required.
The launcher binds Vite to `127.0.0.1`, starting at port **5193** and trying
successive ports until one is available. It leaves existing listeners alone.
Only after the real frontend socket is bound does it start Tauri with that exact
`devUrl`. HTTP and the HMR websocket share the selected port; Rust communicates
through native Tauri IPC and needs no separate HTTP port. Configuration overrides
are passed in memory, without changing the checked-in Tauri config.
JavaScript, TypeScript, React, and CSS changes use Vite hot reload; compatible
React component edits use Fast Refresh. Changes that cannot be hot-replaced
reload the page. Rust changes use `cargo tauri dev`'s automatic **rebuild and app
restart**, including dependent workspace crates. SQLx metadata and SQLite
migrations are also watched. Rust reload is a process restart, so it does not
preserve unsaved in-memory app state. See [Tauri's watch behavior](https://v2.tauri.app/develop/#reacting-to-source-code-changes).
After startup, a Vite configuration restart must reuse the chosen port or report
an error; it cannot silently switch to another port while Tauri uses an old URL.
Ctrl-C stops this session's frontend, Rust watcher/compiler, and desktop app.
If the Rust watcher exits, the launcher closes Vite and propagates the exit code.
It never finds or terminates another app by name or port.
The launcher retains the existing Unix defaults for `VITE_ENVIRONMENT_TYPE`,
`SQLX_OFFLINE`, `RUSTFLAGS`, and the Linux WebKit workarounds. Explicit environment
overrides are preserved. It uses the normal Artcraft app data and Cargo target
directory; port separation does not create an isolated account/data profile, and
concurrent Rust builds can wait on Cargo's build lock.
To verify the launcher without compiling Rust or opening a desktop window:
```bash
node --test frontend/scripts/unix-dev.test.mjs
```
The tests use real Vite listeners and HMR, with a test-owned fake Cargo process
tree. They cover occupied ports, simultaneous launches, React edits, shutdown,
Rust-process failure, and watcher arguments. To verify native Rust reload, run
the launcher, wait for the desktop window, make a Rust source edit, and check for
a rebuild/restart in the same terminal. Frontend edits should update the webview
without restarting the Rust process.
**Windows Development**
```powershell
# Run the frontend dev server
.\script\artcraft\windows_frontend_dev.ps1
# Run the Tauri Rust application
.\script\artcraft\windows_rust_dev.ps1
```
Backend services and website builds live in the separate `artcraft-services` repository.
This repository retains the desktop task database in
`_database/sql/artcraft_migrations/` and its SQLite query cache in `.sqlx/`.
Use `SQLX_OFFLINE=true cargo check -p artcraft` to check Rust without a database server.
-21
View File
@@ -1,21 +0,0 @@
development notes
=================
Actix notes
-----------
json request
```
async fn handler(request: web::Json<Mytype>) -> impl Responder { "whatever" }
```
form-multipart request
```
async fn handler(request: web::Form<Mytype>) -> impl Responder { "whatever" }
```
route parameters
```
#[get("/{name}")]
async fn hello(name: web::Path<String>) -> impl Responder { format!("Hi {}", name) }
```
-207
View File
@@ -1,207 +0,0 @@
dev setup
=========
[Back to main README](../README.md)
### Debugging and Fixing CUDA/PyTorch
See this spreadsheet for previous battles with version incompatibility:
https://docs.google.com/spreadsheets/d/1BEdLmwOzo3r83-iJn9sj6co1VT92t3lIeJ-lNH25bdQ/edit#gid=0
Ubuntu might upgrade the driver by accident, and it might need reinstallation. Who knows.
This stuff is a nightmare.
### Database Setup
Install the following libraries, and see the notes further below about MySQL on Ubuntu 20.04.
```
mysql-server
imagemagick
```
To manage the database and perform migrations, install the Rust tools diesel and sqlx.
We'll be using diesel to manage the migrations, but sqlx within the app to actually perform queries.
Diesel is an ORM, which is dumb, so we use sqlx as at-compile-time typesafe SQL.
```
sudo apt-get install libmysqlclient-dev
cargo install sqlx-cli --no-default-features --features mysql [2022-01-16: is this needed?]
```
To install a more modern version of Diesel (unreleased) that
supports the "migrations_dir" toml config option:
```
cargo install diesel_cli \
--git https://github.com/diesel-rs/diesel.git \
--rev a213fe232a122f35a812b0ce0269708a1845a4c9 \
--no-default-features \
--features mysql
```
#### Sqlx Error on Linux when Performing Schema Migrations
You might get this error message during migration,
```
Encountered unknown type for Mysql: enum
thread 'main' panicked at 'internal error: entered unreachable code: Mysql only supports a closed set of types.
If you ever see this error message please open an issue at https://github.com/diesel-rs/diesel containing a dump of your schema definition.', diesel_cli/src/print_schema.rs:310:17
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
```
I haven't found the cause (it doesn't happen on Mac), but the migrations appear to work regardless of the error message.
#### Linux database notes
If MySql in local dev can't be connected to, reset the accounts:
https://linuxconfig.org/how-to-reset-root-mysql-mariadb-password-on-ubuntu-20-04-focal-fossa-linux
#### Fixing dev MySql on Ubuntu 20.04
For some reason, the MySql default install on 20.04 gave me a bunch of trouble.
In retrospect, I _think_ this is because 'root@localhost' requires sudo to access, but if this
gives any trouble in the future, here's how I got around it (two full hours of distraction!)
```
sudo apt-get install mysql-server
# But for some reason the default password doesn't work and diesel/sqlx can't connect?
# Kill everything
sudo apt purge mysql-server mysql-client mysql-common
sudo apt autoremove
sudo mv -iv /var/lib/mysql /var/tmp/mysql-backup
sudo rm -rf /var/lib/mysql*
sudo /usr/bin/mysql_secure_installation
# still no work...
sudo systemctl stop mysql.service
# ugh, it wasn't chowned or created (both states observed in different installs)…
sudo mkdir -p /var/run/mysqld
sudo chown mysql:mysql /var/run/mysqld
sudo mysqld_safe --skip-grant-tables --skip-networking &
mysql -u root
flush privileges;
USE mysql;
ALTER USER 'root'@'localhost' IDENTIFIED BY 'root';
sudo killall -u mysql
sudo systemctl restart mysql.service
# now it works
sudo mysql -u root -p
# but now I have to use "sudo" !?!?
use mysql;
CREATE USER 'storyteller'@'localhost' IDENTIFIED BY 'password';
GRANT ALL PRIVILEGES ON storyteller.* TO 'storyteller'@'localhost';
```
### Install Diesel (migrations only)
We use Diesel to manage migrations, but we don't use it in server code.
Actual server code uses SQLx. To install the CLI tool, run the following:
```
cargo install diesel_cli
```
Mac [has issues](https://github.com/diesel-rs/diesel/issues/2605) and requires a few dependencies:
```
brew install libpq
```
### Database migrations
To reset the entire database (drop, migrate), run:
```
diesel database reset
```
To migrate at the current step and beyond:
```
diesel migration run
```
To undo migrations at the current step:
```
diesel migration redo
```
### Server Query Codegen
We use SQLx instead of Diesel in the production server. It's typesafe
SQL instead of an ORM like Diesel.
SQLx connects to a database to derive type information, but obviously
cannot do this for builds in CI. In order to cache the types, we build
and check in a cache file (necessary for builds):
```
SQLX_OFFLINE=true cargo sqlx prepare
```
Now that we have multiple binaries, it's required to include all the queries in the main
binary so we can generate the cached queries as a single target. That's then executed
with:
```
SQLX_OFFLINE=true cargo sqlx prepare -- --bin storyteller-web
```
### Setting Up a Local Nginx Proxy
Set up a local nginx to proxy to the frontend and backend so cookie issues aren't annoying
Configure Nginx per the checked in Nginx configs (and instructions) in `localdev/nginx-http-config`.
```
And in /etc/hosts,
```
127.0.0.1 jungle.horse
127.0.0.1 api.jungle.horse
```
### Python 3.6 on Apple M1 Mac
Python3.6 isn't supported on Apple silicon, and it's not in homebrew. It can be installed with
[nix using Rosetta](https://stackoverflow.com/a/65980989):
Download: https://nixos.org/download.html#nix-quick-install
```
nix run nixpkgs.python36 -c python
```
Install venv:
```
nix run nixpkgs.python36 -c python -m venv python
```
Install other packages on Mac that aren't used in venv:
```
python3 -m pip install --user requests gdown youtube_dl
```
-36
View File
@@ -1,36 +0,0 @@
production builds and deployment
================================
### Github Docker builds
The repository needs to be given read access to the base docker image:
https://github.com/orgs/storytold/packages/container/docker-base-images-rust-ssl/settings
These instructions assume running on GCP.
### Database migrations
1. Set `DATABASE_URL` in `.env` to the production secrets (DO NOT COMMIT!)
2. Run `diesel migration run`
### Setting up public buckets without list permission
Public buckets that deny the `list` action should use the following Role:
`roles/storage.legacyObjectReader`
See:
* https://stackoverflow.com/a/56354633
* https://cloud.google.com/storage/docs/access-control/making-data-public#buckets
### Generating Bucket Access Key and Secret Key
https://cloud.telestream.net/tutorials/how-to-setting-up-google-cloud-storage/
1. Go to the GCS page
2. Click "settings"
3. Click "interoperability" tab
4. (enable interoperable access if not already set)
5. Click "create new key"
-27
View File
@@ -1,27 +0,0 @@
redis schema
============
Database 0: TTS / RateLimiter
-----------------------------
TODO: Document rate limiter
Public statistics on usage displayed on the website:
* `ttsUseCount:{model_token}`: INCR, GET
* `w2lUseCount:{template_token}`: INCR, GET
Temporary job progress reports to the user:
These are written as a single string, such as "downloading model", "uploading model",
"generating preview", "executing", etc.
* `ttsDownloadExtraStatus:{inference_job_token}`: SETEX, GET
* `ttsInferenceExtraStatus:{inference_job_token}`: SETEX, GET
* `w2lDownloadExtraStatus:{inference_job_token}`: SETEX, GET
* `w2lInferenceExtraStatus:{inference_job_token}`: SETEX, GET
Database 1: Obs / Twitch
------------------------
* WIP
@@ -1,7 +0,0 @@
-- noinspection SqlDialectInspectionForFile
-- noinspection SqlNoDataSourceInspectionForFile
-- noinspection SqlResolveForFile
drop table user_roles;
drop table user_sessions;
drop table users;
-235
View File
@@ -1,235 +0,0 @@
-- noinspection SqlDialectInspectionForFile
-- noinspection SqlNoDataSourceInspectionForFile
-- noinspection SqlResolveForFile
CREATE TABLE users (
-- Not used for anything except replication.
id BIGINT(20) NOT NULL AUTO_INCREMENT,
-- Visible "primary key"
token VARCHAR(32) NOT NULL,
-- Username is a lookup key; display_name allows the user to add custom case.
username VARCHAR(20) NOT NULL,
display_name VARCHAR(20) NOT NULL,
email_address VARCHAR(255) NOT NULL,
email_confirmed BOOLEAN NOT NULL DEFAULT false,
-- The role assigned to the user confers permissions.
user_role_slug VARCHAR(16) NOT NULL,
-- ========== CREDENTIALS ==========
-- Bcrypt password hash. Granted, there are newer methods:
-- https://cheatsheetseries.owasp.org/cheatsheets/Password_Storage_Cheat_Sheet.html
-- Passwords may be a max of 64 characters per BCrypt.
password_hash BINARY(60) NOT NULL,
-- Incremented with every update to the password.
password_version INT NOT NULL DEFAULT 0,
-- ========== ABUSE TRACKING ==========
-- For abuse tracking.
-- Wide enough for IPv4/6
ip_address_creation VARCHAR(40) NOT NULL,
ip_address_last_login VARCHAR(40) NOT NULL,
ip_address_last_update VARCHAR(40) NOT NULL,
-- ========== DISPLAY / PROFILE ==========
-- Gravatar image hashes are precomputed.
email_gravatar_hash CHAR(32) NOT NULL,
-- The profile of the user in markdown (user editable).
profile_markdown TEXT NOT NULL,
-- Generated HTML (not user-editable).
profile_rendered_html TEXT NOT NULL,
-- An uploaded avatar. Public hash in our bucket.
-- avatar_public_bucket_hash CHAR(32) DEFAULT NULL,
-- ========== SOCIAL MEDIA ==========
-- Social media usernames
-- These are not confirmed. We'll need to build an OAuth system to handle that.
discord_username VARCHAR(36) DEFAULT NULL,
twitter_username VARCHAR(36) DEFAULT NULL,
twitch_username VARCHAR(36) DEFAULT NULL,
patreon_username VARCHAR(36) DEFAULT NULL,
github_username VARCHAR(36) DEFAULT NULL,
cashapp_username VARCHAR(36) DEFAULT NULL,
website_url VARCHAR(255) DEFAULT NULL,
-- ========== USER PREFERENCES ==========
-- If the user doesn't want to use gravatar and doesn't have an uploaded avatar.
disable_gravatar BOOLEAN NOT NULL DEFAULT false,
-- (THIS MIGHT NOT BE USED)
-- NB: DO NOT SORT!
-- THIS MUST MATCH THE RESPECTIVE JOBS TABLE.
-- Visibility preference used at TTS inference time (which can be changed on the result itself).
-- Moderators will still see them.
preferred_tts_result_visibility ENUM(
'public',
'hidden',
'private'
) NOT NULL DEFAULT 'public',
-- (THIS MIGHT NOT BE USED)
-- NB: DO NOT SORT!
-- THIS MUST MATCH THE RESPECTIVE JOBS TABLE.
-- Visibility preference used at TTS inference time (which can be changed on the result itself).
-- Moderators will still see them.
preferred_w2l_result_visibility ENUM(
'public',
'hidden',
'private'
) NOT NULL DEFAULT 'public',
-- Auto play preferences
-- Tri-state because we want to potentially change the default behavior.
auto_play_audio_preference BOOLEAN DEFAULT NULL,
auto_play_video_preference BOOLEAN DEFAULT NULL,
-- Favorite TTS voice to use by default
-- maybe_preferred_tts_model_token VARCHAR(32) DEFAULT NULL,
-- Favorite W2L model to use by default
-- maybe_preferred_w2l_template_token VARCHAR(32) DEFAULT NULL,
-- Settings
-- DO NOT REORDER.
-- dark_mode_preference ENUM(
-- 'light-mode',
-- 'dark-mode',
-- 'use-clock'
-- ) NOT NULL DEFAULT 'light-mode',
-- ========== STATS ==========
-- For tracking stats.
-- The "cached" values are updated by a background job.
-- cached_tts_rendered_counter INT(10) NOT NULL DEFAULT 0,
-- cached_w2l_rendered_counter INT(10) NOT NULL DEFAULT 0,
-- ========== MODERATION DETAILS ==========
-- Different than deleted.
-- Users still show up, but can't do anything.
is_banned BOOLEAN NOT NULL DEFAULT false,
-- If a moderator has comments.
maybe_mod_comments VARCHAR(255) DEFAULT NULL,
-- The last moderator that made changes.
maybe_mod_user_token VARCHAR(32) DEFAULT NULL,
-- ========== VECTOR CLOCK ==========
-- Incremented with every update.
version INT NOT NULL DEFAULT 0,
-- ========== TIMESTAMPS ==========
created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
updated_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
-- If the user is deleted, we set this.
-- This is different than banned. These users won't show up at all.
user_deleted_at TIMESTAMP NULL,
mod_deleted_at TIMESTAMP NULL,
-- INDICES --
PRIMARY KEY (id),
UNIQUE KEY (token),
UNIQUE KEY (username),
UNIQUE KEY (email_address),
KEY fk_user_role_slug (user_role_slug)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin;
CREATE TABLE user_roles (
-- Not used for anything except replication.
id BIGINT(20) NOT NULL AUTO_INCREMENT,
-- Effective "primary key"
slug CHAR(16) NOT NULL,
name VARCHAR(255) NOT NULL,
-- Usage
can_use_tts BOOLEAN NOT NULL DEFAULT FALSE,
can_use_w2l BOOLEAN NOT NULL DEFAULT FALSE,
can_delete_own_tts_results BOOLEAN NOT NULL DEFAULT FALSE,
can_delete_own_w2l_results BOOLEAN NOT NULL DEFAULT FALSE,
can_delete_own_account BOOLEAN NOT NULL DEFAULT FALSE,
-- Contribution
can_upload_tts_models BOOLEAN NOT NULL DEFAULT FALSE,
can_upload_w2l_templates BOOLEAN NOT NULL DEFAULT FALSE,
can_delete_own_tts_models BOOLEAN NOT NULL DEFAULT FALSE,
can_delete_own_w2l_templates BOOLEAN NOT NULL DEFAULT FALSE,
-- Moderation
can_approve_w2l_templates BOOLEAN NOT NULL DEFAULT FALSE,
-- Edit includes "lock_from_use" and "lock_from_modification"
can_edit_other_users_profiles BOOLEAN NOT NULL DEFAULT FALSE,
can_edit_other_users_tts_models BOOLEAN NOT NULL DEFAULT FALSE,
can_edit_other_users_w2l_templates BOOLEAN NOT NULL DEFAULT FALSE,
can_delete_other_users_tts_models BOOLEAN NOT NULL DEFAULT FALSE,
can_delete_other_users_tts_results BOOLEAN NOT NULL DEFAULT FALSE,
can_delete_other_users_w2l_templates BOOLEAN NOT NULL DEFAULT FALSE,
can_delete_other_users_w2l_results BOOLEAN NOT NULL DEFAULT FALSE,
can_ban_users BOOLEAN NOT NULL DEFAULT FALSE,
can_delete_users BOOLEAN NOT NULL DEFAULT FALSE,
-- Incremented with every update.
version INT NOT NULL DEFAULT 0,
created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
updated_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
-- INDICES --
PRIMARY KEY (id),
UNIQUE KEY (slug)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin;
CREATE TABLE user_sessions (
-- Not used for anything except replication.
id BIGINT(20) NOT NULL AUTO_INCREMENT,
-- Session entropy
token VARCHAR(32) NOT NULL,
-- Foreign key to user
user_token VARCHAR(32) NOT NULL,
-- Track each session's creation IP.
-- Wide enough for IPv4/6
ip_address_creation VARCHAR(40) NOT NULL,
created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
updated_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
-- Session termination time.
-- This must be set by the server code, or the session is invalid
expires_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
-- deletion = session termination
-- Typically these are destroyed by users, but if in the future we allow mods to
-- delete them, it doesn't really matter who did the deletion: sessions are not
-- designed to be recoverable.
deleted_at TIMESTAMP NULL,
-- INDICES --
PRIMARY KEY (id),
UNIQUE KEY (token),
KEY fk_user_token (user_token),
KEY index_ip_address_creation (ip_address_creation)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin;
@@ -1,5 +0,0 @@
# noinspection SqlNoDataSourceInspectionForFile
# noinspection SqlResolveForFile
drop table tts_model_upload_jobs;
drop table w2l_template_upload_jobs;
@@ -1,231 +0,0 @@
-- noinspection SqlDialectInspectionForFile
-- noinspection SqlNoDataSourceInspectionForFile
-- noinspection SqlResolveForFile
-- NB: See the "squashed" copy of this for better documentation
-- and the current state of the table.
-- TTS MODELS
CREATE TABLE tts_model_upload_jobs (
id BIGINT(20) NOT NULL AUTO_INCREMENT,
-- Effective "primary key" (PUBLIC)
-- This is so the in-progress results can be looked up by the UI.
token VARCHAR(32) NOT NULL,
-- Idempotency token
-- This is so the frontend client doesn't submit duplicate jobs.
uuid_idempotency_token VARCHAR(36) NOT NULL,
-- ========== SUCCESS CASE ==========
-- If the job completes successfully, this is the result token.
-- This is only populated on a successful result.
on_success_result_token VARCHAR(32) DEFAULT NULL,
-- ========== UPLOAD DETAILS ==========
-- The name of the voice
-- The "name" of the voice model, which might be complicated.
-- If maybe_subject_token (etc.) is set, then it's authoritative instead.
title VARCHAR(255) NOT NULL,
-- NB: THIS ENUM IS OUT OF DATE!
-- Check the squashed sql file as an updated reference!
-- NB: DO NOT CHANGE ORDER; APPEND ONLY!
-- THIS MUST MATCH THE RESPECTIVE JOBS TABLE.
tts_model_type ENUM(
'not-set',
'tacotron2',
'glowtts',
'glowtts-vocodes'
) NOT NULL DEFAULT 'not-set',
-- Can be linked to a well-known voice
-- maybe_subject_token VARCHAR(32) DEFAULT NULL,
-- maybe_actor_subject_token VARCHAR(32) DEFAULT NULL,
-- If we need to download the file from Google Drive.
download_url VARCHAR(512) DEFAULT NULL,
-- NB: DO NOT SORT!
-- download_url_type ENUM(
-- 'google-drive',
-- 'web'
-- ) NOT NULL DEFAULT 'web',
-- ========== CREATOR DETAILS AND PREFERENCES ==========
-- Foreign key to user
creator_user_token VARCHAR(32) NOT NULL,
-- For abuse tracking.
-- Wide enough for IPv4/6
creator_ip_address VARCHAR(40) NOT NULL,
-- (THIS MIGHT NOT BE USED)
-- NB: DO NOT SORT!
-- THIS MUST MATCH THE RESPECTIVE JOBS TABLE.
creator_set_visibility ENUM(
'public',
'hidden',
'private'
) NOT NULL DEFAULT 'public',
-- ========== JOB SYSTEM DETAILS ==========
-- Jobs begin as "pending", then transition to other states.
--
-- * Pending = job is ready to go
-- * Started = job is running
-- * Complete_Success = job is done (success)
-- * Complete_Failure = job is done (failure)
-- * Attempt_Failed = job failed but may retry.
-- * Dead = job failed permanently.
--
-- Pending -> Started -> Complete_Success
-- |-> Complete_Failure
-- \-> Attempt_Failed -> Started -> { Complete, Failed, Dead }
status ENUM(
'pending',
'started',
'complete_success',
'complete_failure',
'attempt_failed',
'dead') NOT NULL DEFAULT 'pending',
-- We can track this against a "max_attempt_count"
attempt_count INT(3) NOT NULL DEFAULT 0,
-- If there is a failure, tell the user why.
failure_reason VARCHAR(512) DEFAULT NULL,
created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
updated_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
-- Failed jobs will set a next attempt time.
-- Subsequent tries can increase the timeout.
-- Failures because of permissions require human intervention => [retry_at=null].
-- Failures because of invalid files are dead => [status=dead].
retry_at TIMESTAMP NULL,
-- INDICES --
PRIMARY KEY (id),
UNIQUE KEY (token),
UNIQUE KEY (uuid_idempotency_token),
KEY fk_on_success_result_token (on_success_result_token),
KEY fk_creator_user_token (creator_user_token),
KEY index_status (status),
KEY index_creator_ip_address (creator_ip_address)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin;
-- WAV2LIP TEMPLATES
CREATE TABLE w2l_template_upload_jobs (
id BIGINT(20) NOT NULL AUTO_INCREMENT,
-- Effective "primary key" (PUBLIC)
-- This is so the in-progress results can be looked up by the UI.
token VARCHAR(32) NOT NULL,
-- Idempotency token
-- This is so the frontend client doesn't submit duplicate jobs.
uuid_idempotency_token VARCHAR(36) NOT NULL,
-- ========== SUCCESS CASE ==========
-- If the job completes successfully, this is the result token.
-- This is only populated on a successful result.
on_success_result_token VARCHAR(32) DEFAULT NULL,
-- ========== UPLOAD DETAILS ==========
-- The title of the template
title VARCHAR(255) NOT NULL,
-- NB: DO NOT SORT!
-- THIS MUST MATCH THE RESPECTIVE JOBS TABLE.
template_type ENUM(
'unknown',
'video',
'image'
) NOT NULL DEFAULT 'unknown',
-- Can be linked to a well-known subject
-- maybe_subject_token VARCHAR(32) DEFAULT NULL,
-- maybe_actor_subject_token VARCHAR(32) DEFAULT NULL,
-- If we need to download the file from Google Drive.
download_url VARCHAR(512) DEFAULT NULL,
-- NB: DO NOT SORT!
-- download_url_type ENUM(
-- 'google-drive',
-- 'web'
-- ) NOT NULL DEFAULT 'web',
-- ========== CREATOR DETAILS AND PREFERENCES ==========
-- Foreign key to user
creator_user_token VARCHAR(32) NOT NULL,
-- For abuse tracking.
-- Wide enough for IPv4/6
creator_ip_address VARCHAR(40) NOT NULL,
-- (THIS MIGHT NOT BE USED)
-- NB: DO NOT SORT!
-- THIS MUST MATCH THE RESPECTIVE JOBS TABLE.
creator_set_visibility ENUM(
'public',
'hidden',
'private'
) NOT NULL DEFAULT 'public',
-- ========== JOB SYSTEM DETAILS ==========
-- Jobs begin as "pending", then transition to other states.
--
-- * Pending = job is ready to go
-- * Started = job is running
-- * Complete_Success = job is done (success)
-- * Complete_Failure = job is done (failure)
-- * Attempt_Failed = job failed but may retry.
-- * Dead = job failed permanently.
--
-- Pending -> Started -> Complete_Success
-- |-> Complete_Failure
-- \-> Attempt_Failed -> Started -> { Complete, Failed, Dead }
status ENUM(
'pending',
'started',
'complete_success',
'complete_failure',
'attempt_failed',
'dead') NOT NULL DEFAULT 'pending',
-- We can track this against a "max_attempt_count"
attempt_count INT(3) NOT NULL DEFAULT 0,
-- If there is a failure, tell the user why.
failure_reason VARCHAR(512) DEFAULT NULL,
created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
updated_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
-- Failed jobs will set a next attempt time.
-- Subsequent tries can increase the timeout.
-- Failures because of permissions require human intervention => [retry_at=null].
-- Failures because of invalid files are dead => [status=dead].
retry_at TIMESTAMP NULL,
-- INDICES --
PRIMARY KEY (id),
UNIQUE KEY (token),
UNIQUE KEY (uuid_idempotency_token),
KEY fk_on_success_result_token (on_success_result_token),
KEY fk_creator_user_token (creator_user_token),
KEY index_status (status),
KEY index_creator_ip_address (creator_ip_address)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin;
@@ -1,5 +0,0 @@
# noinspection SqlNoDataSourceInspectionForFile
# noinspection SqlResolveForFile
drop table tts_models;
drop table w2l_templates;
-328
View File
@@ -1,328 +0,0 @@
-- noinspection SqlDialectInspectionForFile
-- noinspection SqlNoDataSourceInspectionForFile
-- noinspection SqlResolveForFile
-- NB: See the "squashed" copy of this for better documentation
-- and the current state of the table.
CREATE TABLE tts_models (
-- Not used for anything except replication.
id BIGINT(20) NOT NULL AUTO_INCREMENT,
-- Effective "primary key" (PUBLIC)
token VARCHAR(32) NOT NULL,
-- NB: THIS ENUM IS OUT OF DATE!
-- Check the squashed sql file as an updated reference!
-- NB: DO NOT CHANGE ORDER; APPEND ONLY!
-- THIS MUST MATCH THE RESPECTIVE JOBS TABLE.
tts_model_type ENUM(
'not-set',
'tacotron2',
'glowtts',
'glowtts-vocodes'
) NOT NULL DEFAULT 'not-set',
-- NB: DO NOT CHANGE ORDER; APPEND ONLY!
-- How text should be handled.
text_preprocessing_algorithm ENUM(
'basic',
'arpabet'
) NOT NULL DEFAULT 'basic',
-- NB: ADDED BY ALTER
-- maybe_default_pretrained_vocoder VARCHAR(64) DEFAULT NULL,
-- Optional Pointer to a newer version of the voice
-- If there's a newer version, we can disable this one.
-- maybe_updated_model_token VARCHAR(32) DEFAULT NULL,
-- We can set as a combination of ['username' + 'voice-name']
-- There can be public aliases for voices, eg. a voice's default model.
-- A user can change this.
-- As such, these should not be foreign keys.
-- updatable_slug VARCHAR(64) NOT NULL,
-- Can be linked to a well-known voice
-- maybe_subject_token VARCHAR(32) DEFAULT NULL,
-- maybe_actor_subject_token VARCHAR(32) DEFAULT NULL,
-- ========== UNSTRUCTURED METADATA ==========
-- The "name" of the voice model, which might be complicated.
-- If maybe_subject_token (etc.) is set, then it's authoritative instead.
title VARCHAR(255) NOT NULL,
-- The description of the model in markdown.
description_markdown TEXT NOT NULL,
-- Generated HTML (not user-editable).
description_rendered_html TEXT NOT NULL,
-- eg. Bill Clinton, Batman, or Goku.
voice_name VARCHAR(255) DEFAULT NULL,
-- Optional; eg. Sean Schemmel
actor_name VARCHAR(255) DEFAULT NULL,
-- Optional; eg. if the voice is "happy" or a singer "a-capella", etc.
characteristic VARCHAR(255) DEFAULT NULL,
-- Optional; eg. if you train the model more than once.
version_string VARCHAR(255) DEFAULT NULL,
-- ========== IMMUTABLE PROVENANCE AND METADATA ==========
-- Where the file was originally downloaded (if it was downloaded)
original_download_url VARCHAR(512) DEFAULT NULL,
-- The filename that was used at upload time (if available)
original_filename VARCHAR(255) DEFAULT NULL,
-- File characteristics
file_size_bytes INT(10) NOT NULL DEFAULT 0,
-- ========== CREATOR DETAILS ==========
-- The person that created the template.
creator_user_token VARCHAR(32) NOT NULL,
-- For abuse tracking.
-- Wide enough for IPv4/6
creator_ip_address_creation VARCHAR(40) NOT NULL,
creator_ip_address_last_update VARCHAR(40) NOT NULL,
-- (THIS MIGHT NOT BE USED)
-- NB: DO NOT SORT!
-- THIS MUST MATCH THE RESPECTIVE JOBS TABLE.
creator_set_visibility ENUM(
'public',
'hidden',
'private'
) NOT NULL DEFAULT 'public',
-- ========== BUCKET STORAGE ==========
-- The pytorch model
-- For now, this will be a hash of the file contents.
-- NB: NOT UNIQUE! We can allow duplicate uploads.
private_bucket_hash CHAR(64) NOT NULL,
-- The "full url" version of the path
private_bucket_object_name VARCHAR(255) NOT NULL,
-- ========== RATING AND RANKING ==========
-- Calculated average, on a scale of 0-100
-- Null with zero ratings.
-- calculated_average_score INT(3) DEFAULT NULL,
-- Other metrics
-- calculated_total_ratings_submitted_count INT(10) NOT NULL DEFAULT 0,
-- calculated_total_uses_count BIGINT(10) NOT NULL DEFAULT 0,
-- ========== MODERATION DETAILS ==========
-- Mods have to approve of tts models for them to show up in a public index.
-- Models can be used by the author (or other parties that know the URL) before
-- they're approved, but unapproved models won't show up in public indices.
-- This is independent of other visibility controls (is_mod_disabled, deleted_at,
-- and creator_set_visibility)
is_public_listing_approved BOOLEAN DEFAULT NULL,
-- Extremely popular models may be locked from deletion or modification by users.
is_locked_from_user_modification BOOLEAN NOT NULL DEFAULT FALSE,
-- In this case, a moderator disables it from being used for inference.
-- This also disables it for the creator.
-- Unlike deletion, it remains "visible" to those that have access.
is_locked_from_use BOOLEAN NOT NULL DEFAULT FALSE,
-- If a moderator has comments.
maybe_mod_comments VARCHAR(255) DEFAULT NULL,
-- The last moderator that made changes.
maybe_mod_user_token VARCHAR(32) DEFAULT NULL,
-- ========== VECTOR CLOCK ==========
-- Incremented with every update.
version INT NOT NULL DEFAULT 0,
-- ========== TIMESTAMPS ==========
created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
updated_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
-- If this is removed by a mod.
-- It completely disappears from the system.
user_deleted_at TIMESTAMP NULL,
mod_deleted_at TIMESTAMP NULL,
-- INDICES --
PRIMARY KEY (id),
UNIQUE KEY (token),
KEY fk_creator_user_token (creator_user_token),
KEY fk_maybe_mod_user_token (maybe_mod_user_token),
KEY index_creator_ip_address_creation (creator_ip_address_creation),
KEY index_creator_ip_address_last_update (creator_ip_address_last_update),
KEY index_creator_set_visibility (creator_set_visibility),
KEY index_private_bucket_hash (private_bucket_hash),
KEY index_is_public_listing_approved (is_public_listing_approved),
KEY index_is_locked_from_user_modification (is_locked_from_user_modification),
KEY index_is_locked_from_use (is_locked_from_use)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin;
CREATE TABLE w2l_templates (
-- Not used for anything except replication.
id BIGINT(20) NOT NULL AUTO_INCREMENT,
-- Effective "primary key" (PUBLIC)
token VARCHAR(32) NOT NULL,
-- NB: DO NOT CHANGE ORDER; APPEND ONLY!
-- THIS MUST MATCH THE RESPECTIVE JOBS TABLE.
template_type ENUM(
'not-set',
'image',
'video'
) NOT NULL DEFAULT 'not-set',
-- Optional Pointer to a newer version of the template
-- If there's a newer version, we can disable this one.
-- maybe_updated_template_token VARCHAR(32) DEFAULT NULL,
-- A combination of ['username' + 'template-name']
-- There can be public aliases for voices, eg. a voice's default model.
-- A user can change this.
-- As such, these should not be foreign keys.
-- updatable_slug VARCHAR(64) NOT NULL,
-- Can be linked to a well-known voice
-- maybe_subject_token VARCHAR(32) DEFAULT NULL,
-- maybe_actor_subject_token VARCHAR(32) DEFAULT NULL,
-- ========== UNSTRUCTURED METADATA ==========
-- The title of the template.
title CHAR(255) NOT NULL,
-- The description of the template in markdown.
description_markdown TEXT NOT NULL,
-- Generated HTML (not user-editable).
description_rendered_html TEXT NOT NULL,
-- ========== IMMUTABLE PROVENANCE AND METADATA ==========
-- Where the file was originally downloaded (if it was downloaded)
original_download_url VARCHAR(512) DEFAULT NULL,
-- The filename that was used at upload time (if available)
original_filename CHAR(255) DEFAULT NULL,
-- Dimensions and other characteristics
file_size_bytes INT(10) NOT NULL DEFAULT 0,
mime_type VARCHAR(32) NOT NULL DEFAULT '',
frame_width INT(10) NOT NULL DEFAULT 0,
frame_height INT(10) NOT NULL DEFAULT 0,
frame_count INT(10) NOT NULL DEFAULT 0,
fps FLOAT NOT NULL DEFAULT 0.0,
duration_millis INT(10) NOT NULL DEFAULT 0,
-- ========== CREATOR DETAILS ==========
-- The person that created the template.
creator_user_token VARCHAR(32) NOT NULL,
-- For abuse tracking.
-- Wide enough for IPv4/6
creator_ip_address_creation VARCHAR(40) NOT NULL,
creator_ip_address_last_update VARCHAR(40) NOT NULL,
-- (THIS MIGHT NOT BE USED)
-- NB: DO NOT SORT!
-- THIS MUST MATCH THE RESPECTIVE JOBS TABLE.
creator_set_visibility ENUM(
'public',
'hidden',
'private'
) NOT NULL DEFAULT 'public',
-- ========== BUCKET STORAGE ==========
-- The hash of the original source image/video
private_bucket_hash CHAR(64) NOT NULL,
-- The "full path" version of the path. Contains the hash.
private_bucket_object_name VARCHAR(255) NOT NULL,
-- The "full path" of the cached faces object. Contains the hash.
private_bucket_cached_faces_object_name VARCHAR(255) NOT NULL,
-- The "full url" of the preview image and/or video. Contains the hash.
maybe_public_bucket_preview_image_object_name VARCHAR(255) DEFAULT NULL,
maybe_public_bucket_preview_video_object_name VARCHAR(255) DEFAULT NULL,
-- ========== RATING AND RANKING ==========
-- Calculated average, on a scale of 0-100
-- Null with zero ratings.
-- calculated_average_score INT(3) DEFAULT NULL,
-- Other metrics
-- calculated_total_ratings_submitted_count INT(10) NOT NULL DEFAULT 0,
-- calculated_total_uses_count BIGINT(10) NOT NULL DEFAULT 0,
-- ========== MODERATION DETAILS ==========
-- Mods have to approve of w2l templates for them to show up in a public index.
-- Templates can be used by the author (or other parties that know the URL) before
-- they're approved, but unapproved templates won't show up in public indices.
-- This is independent of other visibility controls (is_mod_disabled, deleted_at,
-- and creator_set_visibility)
is_public_listing_approved BOOLEAN DEFAULT NULL,
-- Extremely popular models may be locked from deletion or modification by users.
is_locked_from_user_modification BOOLEAN NOT NULL DEFAULT FALSE,
-- In this case, a moderator disables it from being used for inference.
-- This also disables it for the creator.
-- Unlike deletion, it remains "visible" to those that have access.
is_locked_from_use BOOLEAN NOT NULL DEFAULT FALSE,
-- If a moderator has comments.
maybe_mod_comments VARCHAR(255) DEFAULT NULL,
-- The last moderator that made changes.
maybe_mod_user_token VARCHAR(32) DEFAULT NULL,
-- ========== VECTOR CLOCK ==========
-- Incremented with every update.
version INT NOT NULL DEFAULT 0,
-- ========== TIMESTAMPS ==========
created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
updated_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
-- If this is removed by a mod.
-- It shows up nowhere if deleted.
user_deleted_at TIMESTAMP NULL,
mod_deleted_at TIMESTAMP NULL,
-- INDICES --
PRIMARY KEY (id),
UNIQUE KEY (token),
KEY fk_creator_user_token (creator_user_token),
KEY fk_maybe_mod_user_token (maybe_mod_user_token),
KEY index_template_type (template_type),
KEY index_creator_ip_address_creation (creator_ip_address_creation),
KEY index_creator_ip_address_last_update (creator_ip_address_last_update),
KEY index_creator_set_visibility (creator_set_visibility),
KEY index_private_bucket_hash (private_bucket_hash),
KEY index_is_public_listing_approved (is_public_listing_approved),
KEY index_is_locked_from_user_modification (is_locked_from_user_modification),
KEY index_is_locked_from_use (is_locked_from_use)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin;
@@ -1,5 +0,0 @@
# noinspection SqlResolveForFile
# noinspection SqlNoDataSourceInspectionForFile
drop table tts_inference_jobs;
drop table w2l_inference_jobs;
@@ -1,229 +0,0 @@
-- noinspection SqlDialectInspectionForFile
-- noinspection SqlNoDataSourceInspectionForFile
-- noinspection SqlResolveForFile
-- NB: See the "squashed" copy of this for better documentation
-- and the current state of the table.
CREATE TABLE tts_inference_jobs (
id BIGINT(20) NOT NULL AUTO_INCREMENT,
-- Effective "primary key" (PUBLIC)
-- This is so the in-progress results can be looked up by the UI.
token VARCHAR(32) NOT NULL,
-- Idempotency token from client
-- This is so the frontend client doesn't submit duplicate jobs.
uuid_idempotency_token VARCHAR(36) NOT NULL,
-- ========== SUCCESS CASE ==========
-- If the job completes successfully, this is the result token.
-- This is only populated on a successful result.
on_success_result_token VARCHAR(32) DEFAULT NULL,
-- ========== INFERENCE DETAILS ==========
-- The model to use.
-- This also determines which architecture we're using.
model_token VARCHAR(32) NOT NULL,
-- NB: ADDED BY ALTER
-- maybe_override_pretrained_vocoder VARCHAR(64) DEFAULT NULL,
-- The raw, unprocessed user input.
raw_inference_text TEXT NOT NULL,
-- ========== CREATOR DETAILS ==========
-- Foreign key to user
-- If no user is logged in, this is null.
maybe_creator_user_token VARCHAR(32) DEFAULT NULL,
-- Based on a cookie sent by the frontend.
-- We'll save this even if the user is logged in.
maybe_creator_anonymous_visitor_token VARCHAR(32) DEFAULT NULL,
-- For abuse tracking.
-- Wide enough for IPv4/6
creator_ip_address VARCHAR(40) NOT NULL,
-- (THIS MIGHT NOT BE USED)
-- NB: DO NOT SORT!
-- THIS MUST MATCH THE RESPECTIVE JOBS TABLE.
creator_set_visibility ENUM(
'public',
'hidden',
'private'
) NOT NULL DEFAULT 'public',
-- ========== JOB SYSTEM DETAILS ==========
-- Jobs begin as "pending", then transition to other states.
--
-- * Pending = job is ready to go
-- * Started = job is running
-- * Complete_Success = job is done (success)
-- * Complete_Failure = job is done (failure)
-- * Attempt_Failed = job failed but may retry.
-- * Dead = job failed permanently.
--
-- Pending -> Started -> Complete_Success
-- |-> Complete_Failure
-- \-> Attempt_Failed -> Started -> { Complete, Failed, Dead }
status ENUM(
'pending',
'started',
'complete_success',
'complete_failure',
'attempt_failed',
'dead') NOT NULL DEFAULT 'pending',
-- We can track this against a "max_attempt_count"
attempt_count INT(3) NOT NULL DEFAULT 0,
-- If there is a failure, tell the user why.
failure_reason VARCHAR(512) DEFAULT NULL,
created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
updated_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
-- Failed jobs will set a next attempt time.
-- Subsequent tries can increase the timeout.
-- Failures because of permissions require human intervention => [retry_at=null].
-- Failures because of invalid files are dead => [status=dead].
retry_at TIMESTAMP NULL,
-- INDICES --
PRIMARY KEY (id),
UNIQUE KEY (token),
UNIQUE KEY (uuid_idempotency_token),
KEY fk_on_success_result_token (on_success_result_token),
KEY fk_model_token (model_token),
KEY fk_maybe_creator_user_token (maybe_creator_user_token),
KEY index_status (status),
KEY index_creator_ip_address (creator_ip_address)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin;
CREATE TABLE w2l_inference_jobs (
id BIGINT(20) NOT NULL AUTO_INCREMENT,
-- Effective "primary key" (PUBLIC)
-- This is so the in-progress results can be looked up by the UI.
token VARCHAR(32) NOT NULL,
-- Idempotency token from client
-- This is so the frontend client doesn't submit duplicate jobs.
uuid_idempotency_token VARCHAR(36) NOT NULL,
-- ========== SUCCESS CASE ==========
-- If the job completes successfully, this is the result token.
-- This is only populated on a successful result.
on_success_result_token VARCHAR(32) DEFAULT NULL,
-- ========== INFERENCE DETAILS : FACE TEMPLATE ==========
-- The W2L template to use
-- Can be an image or video.
-- This is null if we're using a custom uploaded image.
maybe_w2l_template_token VARCHAR(32) DEFAULT NULL,
-- If we're using a custom uploaded image, this will be present.
-- NOTE: This may never be supported.
maybe_public_image_bucket_location VARCHAR(255) DEFAULT NULL,
-- ========== INFERENCE DETAILS : AUDIO SOURCE ==========
-- If we're using TTS results, this will be present
maybe_tts_inference_result_token VARCHAR(32) DEFAULT NULL,
-- If we're using custom uploaded audio, this will be present.
maybe_public_audio_bucket_hash VARCHAR(64) DEFAULT NULL,
maybe_public_audio_bucket_location VARCHAR(255) DEFAULT NULL,
-- The filename that was used at upload time (if available)
maybe_original_audio_filename CHAR(255) DEFAULT NULL,
-- Where the audio file was originally downloaded (if it was downloaded)
maybe_original_audio_download_url VARCHAR(512) DEFAULT NULL,
maybe_audio_mime_type VARCHAR(32) DEFAULT NULL,
-- ========== CREATOR DETAILS AND PREFERENCES ==========
-- Foreign key to user
-- If no user is logged in, this is null.
maybe_creator_user_token VARCHAR(32) DEFAULT NULL,
-- Based on a cookie sent by the frontend.
-- We'll save this even if the user is logged in.
maybe_creator_anonymous_visitor_token VARCHAR(32) DEFAULT NULL,
-- For abuse tracking.
-- Wide enough for IPv4/6
creator_ip_address VARCHAR(40) NOT NULL,
-- (THIS MIGHT NOT BE USED)
-- NB: DO NOT SORT!
-- THIS MUST MATCH THE RESPECTIVE JOBS TABLE.
creator_set_visibility ENUM(
'public',
'hidden',
'private'
) NOT NULL DEFAULT 'public',
-- Flags to disable branding
disable_end_bump BOOL NOT NULL DEFAULT false,
disable_watermark BOOL NOT NULL DEFAULT false,
-- ========== JOB SYSTEM DETAILS ==========
-- Jobs begin as "pending", then transition to other states.
--
-- * Pending = job is ready to go
-- * Started = job is running
-- * Complete_Success = job is done (success)
-- * Complete_Failure = job is done (failure)
-- * Attempt_Failed = job failed but may retry.
-- * Dead = job failed permanently.
--
-- Pending -> Started -> Complete_Success
-- |-> Complete_Failure
-- \-> Attempt_Failed -> Started -> { Complete, Failed, Dead }
status ENUM(
'pending',
'started',
'complete_success',
'complete_failure',
'attempt_failed',
'dead') NOT NULL DEFAULT 'pending',
-- We can track this against a "max_attempt_count"
attempt_count INT(3) NOT NULL DEFAULT 0,
-- If there is a failure, tell the user why.
failure_reason VARCHAR(512) DEFAULT NULL,
created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
updated_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
-- Failed jobs will set a next attempt time.
-- Subsequent tries can increase the timeout.
-- Failures because of permissions require human intervention => [retry_at=null].
-- Failures because of invalid files are dead => [status=dead].
retry_at TIMESTAMP NULL,
-- INDICES --
PRIMARY KEY (id),
UNIQUE KEY (token),
UNIQUE KEY (uuid_idempotency_token),
KEY fk_on_success_result_token (on_success_result_token),
KEY fk_maybe_w2l_template_token (maybe_w2l_template_token),
KEY fk_maybe_tts_inference_result_token (maybe_tts_inference_result_token),
KEY fk_maybe_creator_user_token (maybe_creator_user_token),
KEY index_status (status),
KEY index_creator_ip_address (creator_ip_address)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin;
@@ -1,5 +0,0 @@
# noinspection SqlResolveForFile
# noinspection SqlNoDataSourceInspectionForFile
drop table tts_results;
drop table w2l_results;
@@ -1,184 +0,0 @@
-- noinspection SqlDialectInspectionForFile
-- noinspection SqlNoDataSourceInspectionForFile
-- noinspection SqlResolveForFile
-- NB: See the "squashed" copy of this for better documentation
-- and the current state of the table.
CREATE TABLE tts_results (
-- Not used for anything except replication.
id BIGINT(20) NOT NULL AUTO_INCREMENT,
-- Effective "primary key" (PUBLIC)
token VARCHAR(32) NOT NULL,
-- ========== INFERENCE DETAILS ==========
-- The TTS model that was used
model_token VARCHAR(32) NOT NULL,
-- NB: ADDED BY ALTER
-- maybe_pretrained_vocoder_used VARCHAR(64) DEFAULT NULL,
-- The original raw, unprocessed user input.
raw_inference_text TEXT NOT NULL,
-- SHA2 hash of the text [SHA2 = CHAR(64), SHA1 = CHAR(40), MD5 = CHAR(32)]
raw_inference_text_hash_sha2 CHAR(64) NOT NULL,
-- First pass at text normalization.
-- eg. 14th -> fourteenth, etc.
normalized_inference_text TEXT NOT NULL,
-- If the model uses arpabet, we'll save the arpabet we used.
maybe_arpabet_text TEXT DEFAULT NULL,
-- ========== CREATOR DETAILS ==========
-- The person that created the template.
-- If the user wasn't logged in, this is null
maybe_creator_user_token VARCHAR(32) DEFAULT NULL,
-- Based on a cookie sent by the frontend.
-- We'll save this even if the user is logged in.
maybe_creator_anonymous_visitor_token VARCHAR(32) DEFAULT NULL,
-- For abuse tracking.
-- Wide enough for IPv4/6
creator_ip_address VARCHAR(40) NOT NULL,
-- (THIS MIGHT NOT BE USED)
-- NB: DO NOT SORT!
-- THIS MUST MATCH THE RESPECTIVE JOBS TABLE.
creator_set_visibility ENUM(
'public',
'hidden',
'private'
) NOT NULL DEFAULT 'public',
-- The synthetic id associated with this result.
-- These ids are incremented on a per-user basis to help users
-- sequence their own work. They serve no other purpose.
maybe_creator_synthetic_id BIGINT(20) DEFAULT NULL,
-- ========== BUCKET STORAGE ==========
-- Where the wav, spectrogram, and etc. are located.
public_bucket_wav_audio_path VARCHAR(255) NOT NULL,
public_bucket_spectrogram_path VARCHAR(255) NOT NULL,
-- ========== METADATA ==========
file_size_bytes INT(10) NOT NULL DEFAULT 0,
duration_millis INT(10) NOT NULL DEFAULT 0,
-- ========== MODERATION DETAILS ==========
-- The last moderator that made changes.
maybe_mod_user_token VARCHAR(32) DEFAULT NULL,
-- ========== TIMESTAMPS ==========
created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
updated_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
-- If this is removed by a mod or the creator.
user_deleted_at TIMESTAMP NULL,
mod_deleted_at TIMESTAMP NULL,
-- INDICES --
PRIMARY KEY (id),
UNIQUE KEY (token),
KEY fk_model_token (model_token),
KEY fk_maybe_creator_user_token (maybe_creator_user_token),
KEY fk_maybe_creator_anonymous_visitor_token (maybe_creator_anonymous_visitor_token),
KEY fk_maybe_mod_user_token (maybe_mod_user_token),
KEY index_creator_ip_address (creator_ip_address),
KEY index_user_deleted_at(user_deleted_at),
KEY index_mod_deleted_at(mod_deleted_at)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin;
CREATE TABLE w2l_results (
-- Not used for anything except replication.
id BIGINT(20) NOT NULL AUTO_INCREMENT,
-- Effective "primary key" (PUBLIC)
token VARCHAR(32) NOT NULL,
-- ========== INFERENCE DETAILS ==========
-- The w2l template that was used (if set)
maybe_w2l_template_token VARCHAR(32) NOT NULL,
-- The inference result, if we're using them.
maybe_tts_inference_result_token VARCHAR(32) DEFAULT NULL,
-- ========== CREATOR DETAILS ==========
-- The person that created the template.
-- If the user wasn't logged in, this is null
maybe_creator_user_token VARCHAR(32) DEFAULT NULL,
-- Based on a cookie sent by the frontend.
-- We'll save this even if the user is logged in.
maybe_creator_anonymous_visitor_token VARCHAR(32) DEFAULT NULL,
-- For abuse tracking.
-- Wide enough for IPv4/6
creator_ip_address VARCHAR(40) NOT NULL,
-- (THIS MIGHT NOT BE USED)
-- NB: DO NOT SORT!
-- THIS MUST MATCH THE RESPECTIVE JOBS TABLE.
creator_set_visibility ENUM(
'public',
'hidden',
'private'
) NOT NULL DEFAULT 'public',
-- The synthetic id associated with this result.
-- These ids are incremented on a per-user basis to help users
-- sequence their own work. They serve no other purpose.
maybe_creator_synthetic_id BIGINT(20) DEFAULT NULL,
-- ========== BUCKET STORAGE ==========
-- Where the wav, spectrogram, and etc. are located.
public_bucket_video_path VARCHAR(255) NOT NULL,
-- ========== METADATA ==========
file_size_bytes INT(10) NOT NULL DEFAULT 0,
mime_type VARCHAR(32) NOT NULL DEFAULT '',
frame_width INT(10) NOT NULL DEFAULT 0,
frame_height INT(10) NOT NULL DEFAULT 0,
duration_millis INT(10) NOT NULL DEFAULT 0,
-- ========== MODERATION DETAILS ==========
-- The last moderator that made changes.
maybe_mod_user_token VARCHAR(32) DEFAULT NULL,
-- ========== TIMESTAMPS ==========
created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
updated_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
-- If this is removed by a mod or the creator.
user_deleted_at TIMESTAMP NULL,
mod_deleted_at TIMESTAMP NULL,
-- INDICES --
PRIMARY KEY (id),
UNIQUE KEY (token),
KEY fk_maybe_creator_user_token (maybe_creator_user_token),
KEY fk_maybe_creator_anonymous_visitor_token (maybe_creator_anonymous_visitor_token),
KEY fk_maybe_w2l_template_token (maybe_w2l_template_token),
KEY fk_maybe_tts_inference_result_token (maybe_tts_inference_result_token),
KEY fk_maybe_mod_user_token (maybe_mod_user_token),
KEY index_creator_ip_address (creator_ip_address),
KEY index_user_deleted_at(user_deleted_at),
KEY index_mod_deleted_at(mod_deleted_at)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin;
@@ -1,6 +0,0 @@
-- noinspection SqlDialectInspectionForFile
-- noinspection SqlNoDataSourceInspectionForFile
-- noinspection SqlResolveForFile
drop table badges;
drop table user_badges;
@@ -1,42 +0,0 @@
-- noinspection SqlDialectInspectionForFile
-- noinspection SqlNoDataSourceInspectionForFile
-- noinspection SqlResolveForFile
-- Badges are rewards for loyalty
CREATE TABLE badges (
-- Not used for anything except replication.
id BIGINT(20) NOT NULL AUTO_INCREMENT,
-- Effective "primary key"
slug VARCHAR(32) NOT NULL,
-- Description
title VARCHAR(255) NOT NULL,
description VARCHAR(512) NOT NULL,
image_url VARCHAR(512) NOT NULL,
created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
updated_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
-- INDICES --
PRIMARY KEY (id),
UNIQUE KEY (slug)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin;
-- Join table
CREATE TABLE user_badges (
id BIGINT(20) NOT NULL AUTO_INCREMENT,
user_token VARCHAR(32) NOT NULL,
badge_slug VARCHAR(32) NOT NULL,
created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
updated_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
-- INDICES --
PRIMARY KEY (id),
KEY fk_user_token (user_token),
KEY fk_badge_slug (badge_slug)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin;
@@ -1,4 +0,0 @@
# noinspection SqlResolveForFile
# noinspection SqlNoDataSourceInspectionForFile
drop table firehose_entries;
@@ -1,37 +0,0 @@
-- noinspection SqlDialectInspectionForFile
-- noinspection SqlNoDataSourceInspectionForFile
-- noinspection SqlResolveForFile
CREATE TABLE firehose_entries (
-- Not used for anything except replication.
id BIGINT(20) NOT NULL AUTO_INCREMENT,
-- Visible "primary key"
token VARCHAR(32) NOT NULL,
-- The type of the event
event_type VARCHAR(32) NOT NULL,
-- The target user
maybe_target_user_token VARCHAR(32) DEFAULT NULL,
-- The target "entity", which varies by event type.
-- eg. a model token or template token
maybe_target_entity_token VARCHAR(32) DEFAULT NULL,
-- If something was created, this might be the token (if we know it)
-- eg. an inference job's token
maybe_created_entity_token VARCHAR(32) DEFAULT NULL,
created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
updated_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
-- INDICES --
PRIMARY KEY (id),
UNIQUE KEY (token),
KEY fk_maybe_target_user_token (maybe_target_user_token),
KEY fk_maybe_target_entity_token (maybe_target_entity_token),
KEY fk_maybe_created_entity_token (maybe_created_entity_token),
KEY index_event_type (event_type)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin;
@@ -1,5 +0,0 @@
-- noinspection SqlDialectInspectionForFile
-- noinspection SqlNoDataSourceInspectionForFile
-- noinspection SqlResolveForFile
drop table ip_address_bans;
@@ -1,37 +0,0 @@
-- noinspection SqlDialectInspectionForFile
-- noinspection SqlNoDataSourceInspectionForFile
-- noinspection SqlResolveForFile
CREATE TABLE ip_address_bans (
-- Not used for anything except replication.
id BIGINT(20) NOT NULL AUTO_INCREMENT,
-- The IP address to ban
ip_address VARCHAR(40) NOT NULL,
-- Maybe the target user.
maybe_target_user_token VARCHAR(32) DEFAULT NULL,
-- Mod who created or last edited the ban.
mod_user_token VARCHAR(32) NOT NULL,
-- Optional notes about the ban.
mod_notes TEXT NOT NULL,
-- Moderator can set an expire time (optional).
-- If not set, the ban is indefinite
expires_at TIMESTAMP DEFAULT NULL,
created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
updated_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
-- If deleted, the ban is removed.
deleted_at TIMESTAMP DEFAULT NULL,
-- INDICES --
PRIMARY KEY (id),
UNIQUE KEY (ip_address),
KEY fk_mod_user_token (mod_user_token),
KEY fk_maybe_target_user_token (maybe_target_user_token)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin;
@@ -1,5 +0,0 @@
-- noinspection SqlDialectInspectionForFile
-- noinspection SqlNoDataSourceInspectionForFile
-- noinspection SqlResolveForFile
drop table moderator_audit_log_entries;
@@ -1,38 +0,0 @@
-- noinspection SqlDialectInspectionForFile
-- noinspection SqlNoDataSourceInspectionForFile
-- noinspection SqlResolveForFile
CREATE TABLE moderator_audit_log_entries (
-- Not used for anything except replication.
id BIGINT(20) NOT NULL AUTO_INCREMENT,
-- Visible "primary key"
token VARCHAR(32) NOT NULL,
-- The type of the event (ban, delete, etc.)
event_type VARCHAR(32) NOT NULL,
-- The target user
maybe_target_user_token VARCHAR(32) DEFAULT NULL,
-- The target "entity", which varies by event type.
-- eg. a model token or template token
maybe_target_entity_token VARCHAR(32) DEFAULT NULL,
-- If an IP was banned, we record it here.
maybe_target_ip_address VARCHAR(40) DEFAULT NULL,
-- Optional mod-specified notes.
optional_notes TEXT DEFAULT NULL,
created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
updated_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
-- INDICES --
PRIMARY KEY (id),
UNIQUE KEY (token),
KEY fk_maybe_target_user_token (maybe_target_user_token),
KEY fk_maybe_target_entity_token (maybe_target_entity_token),
KEY index_event_type (event_type)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin;
@@ -1,6 +0,0 @@
-- noinspection SqlDialectInspectionForFile
-- noinspection SqlNoDataSourceInspectionForFile
-- noinspection SqlResolveForFile
drop table tts_result_synthetic_ids;
drop table w2l_result_synthetic_ids;
@@ -1,47 +0,0 @@
-- noinspection SqlDialectInspectionForFile
-- noinspection SqlNoDataSourceInspectionForFile
-- noinspection SqlResolveForFile
-- It gets unwieldy to show results without a numeric sequence.
-- We create a synthetic sequence for each user to make revisiting results easier.
CREATE TABLE tts_result_synthetic_ids (
-- Not used for anything except replication.
id BIGINT(20) NOT NULL AUTO_INCREMENT,
-- Effective "primary key" (PUBLIC)
user_token VARCHAR(32) NOT NULL,
-- The next result id.
-- After we use an id, we increment this counter.
next_id BIGINT(20) NOT NULL DEFAULT 0,
created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
updated_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
-- INDICES --
PRIMARY KEY (id),
UNIQUE KEY (user_token)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin;
-- It gets unwieldy to show results without a numeric sequence.
-- We create a synthetic sequence for each user to make revisiting results easier.
CREATE TABLE w2l_result_synthetic_ids (
-- Not used for anything except replication.
id BIGINT(20) NOT NULL AUTO_INCREMENT,
-- Effective "primary key" (PUBLIC)
user_token VARCHAR(32) NOT NULL,
-- The next result id.
-- After we use an id, we increment this counter.
next_id BIGINT(20) NOT NULL DEFAULT 0,
created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
updated_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
-- INDICES --
PRIMARY KEY (id),
UNIQUE KEY (user_token)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin;
@@ -1,12 +0,0 @@
-- noinspection SqlDialectInspectionForFile
-- noinspection SqlNoDataSourceInspectionForFile
-- noinspection SqlResolveForFile
ALTER TABLE tts_models
DROP COLUMN maybe_default_pretrained_vocoder;
ALTER TABLE tts_inference_jobs
DROP COLUMN maybe_override_pretrained_vocoder;
ALTER TABLE tts_results
DROP COLUMN maybe_pretrained_vocoder_used;
@@ -1,21 +0,0 @@
-- noinspection SqlDialectInspectionForFile
-- noinspection SqlNoDataSourceInspectionForFile
-- noinspection SqlResolveForFile
-- TODO/FIXME: I originally created this with the wrong directory month.
-- I'll have to repair the migrations table.
-- version: 20210925010101 | run_on: 2021-08-25 03:01:15 (development)
-- UPDATE __diesel_schema_migrations SET version=20210825010101 WHERE version=20210925010101 LIMIT 1;
-- NB: Fixed in production on 2022-01-06
ALTER TABLE tts_models
ADD COLUMN maybe_default_pretrained_vocoder VARCHAR(64) DEFAULT NULL
AFTER text_preprocessing_algorithm;
ALTER TABLE tts_inference_jobs
ADD COLUMN maybe_override_pretrained_vocoder VARCHAR(64) DEFAULT NULL
AFTER model_token;
ALTER TABLE tts_results
ADD COLUMN maybe_pretrained_vocoder_used VARCHAR(64) DEFAULT NULL
AFTER model_token;
@@ -1 +0,0 @@
-- This file should undo anything in `up.sql`
@@ -1,23 +0,0 @@
-- noinspection SqlDialectInspectionForFile
-- noinspection SqlNoDataSourceInspectionForFile
-- noinspection SqlResolveForFile
-- Add talknet to the tts_model_type.
ALTER TABLE tts_models
MODIFY COLUMN tts_model_type ENUM(
'not-set',
'tacotron2',
'glowtts',
'glowtts-vocodes',
'talknet'
) NOT NULL DEFAULT 'not-set';
ALTER TABLE tts_model_upload_jobs
MODIFY COLUMN tts_model_type ENUM(
'not-set',
'tacotron2',
'glowtts',
'glowtts-vocodes',
'talknet'
) NOT NULL DEFAULT 'not-set';
@@ -1,15 +0,0 @@
-- noinspection SqlDialectInspectionForFile
-- noinspection SqlNoDataSourceInspectionForFile
-- noinspection SqlResolveForFile
ALTER TABLE tts_models
DROP COLUMN private_bucket_object_is_archive;
ALTER TABLE tts_models
DROP COLUMN has_self_contained_vocoder;
ALTER TABLE tts_models
DROP COLUMN has_self_contained_duration_model;
ALTER TABLE tts_models
DROP COLUMN has_self_contained_pitch_model;
@@ -1,19 +0,0 @@
-- noinspection SqlDialectInspectionForFile
-- noinspection SqlNoDataSourceInspectionForFile
-- noinspection SqlResolveForFile
ALTER TABLE tts_models
ADD COLUMN private_bucket_object_is_archive BOOLEAN NOT NULL DEFAULT FALSE
AFTER private_bucket_object_name;
ALTER TABLE tts_models
ADD COLUMN has_self_contained_vocoder BOOLEAN NOT NULL DEFAULT FALSE
AFTER tts_model_type;
ALTER TABLE tts_models
ADD COLUMN has_self_contained_duration_model BOOLEAN NOT NULL DEFAULT FALSE
AFTER has_self_contained_vocoder;
ALTER TABLE tts_models
ADD COLUMN has_self_contained_pitch_model BOOLEAN NOT NULL DEFAULT FALSE
AFTER has_self_contained_duration_model;
@@ -1,7 +0,0 @@
-- noinspection SqlDialectInspectionForFile
-- noinspection SqlNoDataSourceInspectionForFile
-- noinspection SqlResolveForFile
DROP TABLE model_categories;
DROP TABLE tts_category_assignments;
DROP TABLE w2l_category_assignments;
@@ -1,174 +0,0 @@
-- noinspection SqlDialectInspectionForFile
-- noinspection SqlNoDataSourceInspectionForFile
-- noinspection SqlResolveForFile
CREATE TABLE model_categories (
-- Not used for anything except replication.
id BIGINT(20) NOT NULL AUTO_INCREMENT,
-- Visible "primary key"
token VARCHAR(32) NOT NULL,
-- Idempotency token
-- This is so the frontend client doesn't submit duplicate requests.
-- Only used on create.
uuid_idempotency_token VARCHAR(36) NOT NULL,
-- ========== MODEL TYPE ==========
model_type ENUM(
'not_set',
'tts',
'w2l'
) NOT NULL DEFAULT 'not_set',
-- ========== CATEGORY TOPOLOGY ==========
-- Optional foreign key link to super category.
-- If absent, this is a top-level category or top-level super category.
maybe_super_category_token VARCHAR(32) DEFAULT NULL,
-- If this category can be applied directly to models.
can_directly_have_models BOOLEAN NOT NULL DEFAULT false,
-- If this category can have subcategories.
can_have_subcategories BOOLEAN NOT NULL DEFAULT false,
-- If only mods are allowed to tag (or untag) models with this.
can_only_mods_apply BOOLEAN NOT NULL DEFAULT false,
-- ========== CATEGORY NAME ==========
-- The name of the category, which might be complicated.
name VARCHAR(255) NOT NULL,
-- The name displayed in the dropdown (if it should be different), otherwise NULL.
-- eg. "Gender" (name) and "By Gender" (dropdown name)
maybe_dropdown_name VARCHAR(20) DEFAULT NULL,
-- ========== CREATOR DETAILS ==========
-- The person that created the category.
creator_user_token VARCHAR(32) NOT NULL,
-- For abuse tracking.
-- Wide enough for IPv4/6
creator_ip_address_creation VARCHAR(40) NOT NULL,
-- Technically we don't allow editing, but just in case.
creator_ip_address_last_update VARCHAR(40) NOT NULL,
-- ========== MODERATION DETAILS ==========
-- Mods have to approve of categories. They remain hidden and unusable until approved.
is_mod_approved BOOLEAN DEFAULT NULL,
-- If a moderator has comments.
maybe_mod_comments VARCHAR(255) DEFAULT NULL,
-- The last moderator that made changes.
maybe_mod_user_token VARCHAR(32) DEFAULT NULL,
-- ========== VECTOR CLOCK ==========
-- Incremented with every update.
version INT NOT NULL DEFAULT 0,
-- ========== TIMESTAMPS ==========
created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
updated_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
-- If the category is deleted and shouldn't be displayed.
-- Only mods can delete categories.
deleted_at TIMESTAMP NULL,
-- INDICES --
PRIMARY KEY (id),
UNIQUE KEY (token),
UNIQUE KEY (uuid_idempotency_token),
KEY fk_maybe_super_category_token (maybe_super_category_token),
KEY fk_creator_user_token (creator_user_token),
KEY index_model_type (model_type),
KEY index_can_directly_have_models (can_directly_have_models),
KEY index_can_have_subcategories (can_have_subcategories),
KEY index_is_mod_approved (is_mod_approved)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin;
-- Join table assigning models to zero or more categories.
CREATE TABLE tts_category_assignments (
-- Not used for anything except replication.
id BIGINT(20) NOT NULL AUTO_INCREMENT,
model_token VARCHAR(32) NOT NULL,
category_token VARCHAR(32) NOT NULL,
-- ========== USER DETAILS ==========
-- The person that created the assignment.
-- This can be the model owner or a moderator.
category_addition_user_token VARCHAR(32) DEFAULT NULL,
-- The person that removed the assignment.
-- This can be the model owner or a moderator.
category_removal_user_token VARCHAR(32) DEFAULT NULL,
-- For abuse tracking.
-- THIS CAN BE A MODERATOR FOR SIMPLICITY.
-- Wide enough for IPv4/6
ip_address_creation VARCHAR(40) NOT NULL,
ip_address_last_update VARCHAR(40) NOT NULL,
-- ========== TIMESTAMPS ==========
created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
updated_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
deleted_at TIMESTAMP NULL,
-- INDICES --
PRIMARY KEY (id),
UNIQUE KEY (model_token, category_token),
KEY fk_model_token (model_token),
KEY fk_category_token (category_token),
KEY index_deleted_at (deleted_at)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin;
-- Join table assigning models to zero or more categories.
CREATE TABLE w2l_category_assignments (
-- Not used for anything except replication.
id BIGINT(20) NOT NULL AUTO_INCREMENT,
model_token VARCHAR(32) NOT NULL,
category_token VARCHAR(32) NOT NULL,
-- ========== USER DETAILS ==========
-- The person that created the assignment.
-- This can be the model owner or a moderator.
category_addition_user_token VARCHAR(32) DEFAULT NULL,
-- The person that removed the assignment.
-- This can be the model owner or a moderator.
category_removal_user_token VARCHAR(32) DEFAULT NULL,
-- For abuse tracking.
-- THIS CAN BE A MODERATOR FOR SIMPLICITY.
-- Wide enough for IPv4/6
ip_address_creation VARCHAR(40) NOT NULL,
ip_address_last_update VARCHAR(40) NOT NULL,
-- ========== TIMESTAMPS ==========
created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
updated_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
deleted_at TIMESTAMP NULL,
-- INDICES --
PRIMARY KEY (id),
UNIQUE KEY (model_token, category_token),
KEY fk_model_token (model_token),
KEY fk_category_token (category_token),
KEY index_deleted_at (deleted_at)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin;
@@ -1,5 +0,0 @@
-- noinspection SqlDialectInspectionForFile
-- noinspection SqlNoDataSourceInspectionForFile
-- noinspection SqlResolveForFile
DROP TABLE twitch_oauth_tokens;
@@ -1,264 +0,0 @@
-- noinspection SqlDialectInspectionForFile
-- noinspection SqlNoDataSourceInspectionForFile
-- noinspection SqlResolveForFile
-- **NOTE ABOUT DESIGN**:
-- This table contains _many_ OAuth tokens for any single user. (many users : many tokens)
-- An entire history of tokens is kept in the table.
-- Apart from "deleted_at", etc., these records should largely be IMMUTABLE.
CREATE TABLE twitch_oauth_tokens(
-- Not used for anything except replication.
id BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
-- Minted on first request and copied on each refresh.
-- This allows us to group access tokens all the way back up the
-- refresh chain.
oauth_refresh_grouping_token VARCHAR(32) NOT NULL,
-- ========== STORYTELLER/FAKEYOU USER ==========
-- Foreign key to user (Storyteller/FakeYou user)
-- If no user is associated (anonymous Twitch user), then this is null.
maybe_user_token VARCHAR(32) DEFAULT NULL,
-- ========== TWITCH USER ==========
-- The user ID / channel ID are the same
-- https://discuss.dev.twitch.tv/t/what-is-the-difference-between-the-stream--id-and-channel--id/4423
-- Several suggest this should be a string and not an integer
-- https://discuss.dev.twitch.tv/t/type-of-user-id-in-api-responses/10205
-- Yep, strings
-- https://discuss.dev.twitch.tv/t/bug-v5-api-returns--id-as-string-for-featured-channels/10310
twitch_user_id VARCHAR(64) NOT NULL,
-- Twitch usernames are between 4 and 25 characters.
-- This is returned in the oauth flow
twitch_username VARCHAR(32) NOT NULL,
-- Twitch username, but lowercase for lookup.
twitch_username_lowercase VARCHAR(32) NOT NULL,
-- ========== OAUTH TOKEN DETAILS ==========
-- The ever important OAuth access token.
access_token VARCHAR(128) NOT NULL,
-- If we can refresh the token, this is the thing to use.
maybe_refresh_token VARCHAR(128) DEFAULT NULL,
-- Should be "bearer". Included in the OAuth redemption.
token_type VARCHAR(32) DEFAULT NULL,
-- When the token expires from time of first grant.
-- (We don't update this field.)
-- Null if it does not expire or we were not informed
expires_in_seconds INT(10) UNSIGNED DEFAULT NULL,
-- Number of times this token has been refreshed
-- The original token creation will be "0", and each
-- subsequent time will bump by one. Mostly for debugging.
refresh_count INT(10) UNSIGNED DEFAULT 0,
-- ======================================================
-- ==================== OAUTH SCOPES ====================
-- ======================================================
-- TODO: Probably could have stored this in a bitfield. Ugh.
-- "analytics:read:extensions"
-- "View analytics data for the Twitch Extensions owned by the authenticated account."
has_analytics_read_extensions BOOLEAN NOT NULL DEFAULT FALSE,
-- scope: "analytics:read:games"
-- "View analytics data for the games owned by the authenticated account."
has_analytics_read_games BOOLEAN NOT NULL DEFAULT FALSE,
-- "bits:read"
-- "View Bits information for a channel."
has_bits_read BOOLEAN NOT NULL DEFAULT FALSE,
-- "channel:edit:commercial"
-- "Run commercials on a channel."
has_channel_edit_commercial BOOLEAN NOT NULL DEFAULT FALSE,
-- "channel:manage:broadcast"
-- "Manage a channel's broadcast configuration, including updating channel configuration and managing stream markers and stream tags."
has_channel_manage_broadcast BOOLEAN NOT NULL DEFAULT FALSE,
-- "channel:manage:extensions"
-- "Manage a channel's Extension configuration, including activating Extensions."
has_channel_manage_extensions BOOLEAN NOT NULL DEFAULT FALSE,
-- "channel:manage:polls"
-- "Manage a channel's polls."
has_channel_manage_polls BOOLEAN NOT NULL DEFAULT FALSE,
-- "channel:manage:predictions"
-- "Manage of channel's Channel Points Predictions"
has_channel_manage_predictions BOOLEAN NOT NULL DEFAULT FALSE,
-- "channel:manage:redemptions"
-- "Manage Channel Points custom rewards and their redemptions on a channel."
has_channel_manage_redemptions BOOLEAN NOT NULL DEFAULT FALSE,
-- "channel:manage:schedule"
-- "Manage a channel's stream schedule."
has_channel_manage_schedule BOOLEAN NOT NULL DEFAULT FALSE,
-- "channel:manage:videos"
-- "Manage a channel's videos, including deleting videos."
has_channel_manage_videos BOOLEAN NOT NULL DEFAULT FALSE,
-- "channel:moderate"
-- "Perform moderation actions in a channel. The user requesting the scope must be a moderator in the channel."
has_channel_moderate BOOLEAN NOT NULL DEFAULT FALSE,
-- "channel:read:editors"
-- "View a list of users with the editor role for a channel."
has_channel_read_editors BOOLEAN NOT NULL DEFAULT FALSE,
-- "channel:read:goals"
-- "View Creator Goals for a channel."
has_channel_read_goals BOOLEAN NOT NULL DEFAULT FALSE,
-- "channel:read:hype_train"
-- "View Hype Train information for a channel."
has_channel_read_hype_train BOOLEAN NOT NULL DEFAULT FALSE,
-- "channel:read:polls"
-- "View a channel's polls."
has_channel_read_polls BOOLEAN NOT NULL DEFAULT FALSE,
-- "channel:read:predictions"
-- "View a channel's Channel Points Predictions."
has_channel_read_predictions BOOLEAN NOT NULL DEFAULT FALSE,
-- "channel:read:redemptions"
-- "View Channel Points custom rewards and their redemptions on a channel."
-- eg. PubSub subscribe to `channel-points-channel-v1.<channel_id>` (channel points spends)
has_channel_read_redemptions BOOLEAN NOT NULL DEFAULT FALSE,
-- "channel:read:stream_key"
-- "View an authorized user's stream key."
has_channel_read_stream_key BOOLEAN NOT NULL DEFAULT FALSE,
-- "channel:read:subscriptions"
-- "View a list of all subscribers to a channel and check if a user is subscribed to a channel."
-- eg. Enumerate list of subscribers for a channel
-- eg. PubSub subscribe to `channel-subscribe-events-v1.<channel ID>` (subscribe, resubscribe, gift)
has_channel_read_subscriptions BOOLEAN NOT NULL DEFAULT FALSE,
-- "channel_subscriptions"
-- "\\[DEPRECATED\\] Read all subscribers to your channel."
has_channel_subscriptions BOOLEAN NOT NULL DEFAULT FALSE,
-- "chat:edit"
-- "Send live stream chat and rooms messages."
has_chat_edit BOOLEAN NOT NULL DEFAULT FALSE,
-- "chat:read"
-- "View live stream chat and rooms messages."
has_chat_read BOOLEAN NOT NULL DEFAULT FALSE,
-- "clips:edit"
-- "Manage Clips for a channel."
has_clips_edit BOOLEAN NOT NULL DEFAULT FALSE,
-- "moderation:read"
-- "View a channel's moderation data including Moderators, Bans, Timeouts, and Automod settings."
has_moderation_read BOOLEAN NOT NULL DEFAULT FALSE,
-- "moderator:manage:automod"
-- "Manage messages held for review by AutoMod in channels where you are a moderator."
has_moderator_manage_auto_mod BOOLEAN NOT NULL DEFAULT FALSE,
-- "user:edit"
-- "Manage a user object."
has_user_edit BOOLEAN NOT NULL DEFAULT FALSE,
-- "user:edit:broadcast"
-- "Edit your channel's broadcast configuration, including extension configuration. (This scope implies user:read:broadcast capability.)"
has_user_edit_broadcast BOOLEAN NOT NULL DEFAULT FALSE,
-- "user:edit:follows"
-- "Edit a user's follows."
has_user_edit_follows BOOLEAN NOT NULL DEFAULT FALSE,
-- "user:manage:blocked_users"
-- "Manage the block list of a user."
has_user_manage_blocked_users BOOLEAN NOT NULL DEFAULT FALSE,
-- "user:read:blocked_users"
-- "View the block list of a user."
has_user_read_blocked_users BOOLEAN NOT NULL DEFAULT FALSE,
-- "user:read:broadcast"
-- "View a user's broadcasting configuration, including Extension configurations."
has_user_read_broadcast BOOLEAN NOT NULL DEFAULT FALSE,
-- "user:read:email"
-- "Read an authorized user's email address."
has_user_read_email BOOLEAN NOT NULL DEFAULT FALSE,
-- "user:read:follows"
-- "View the list of channels a user follows."
-- eg. We can use this to see if a Twitch user follows us.
has_user_read_follows BOOLEAN NOT NULL DEFAULT FALSE,
-- "user:read:subscriptions"
-- "View if an authorized user is subscribed to specific channels."
has_user_read_subscriptions BOOLEAN NOT NULL DEFAULT FALSE,
-- "whispers:edit"
-- "Send whisper messages."
has_whispers_edit BOOLEAN NOT NULL DEFAULT FALSE,
-- "whispers:read"
-- "View your whisper messages."
has_whispers_read BOOLEAN NOT NULL DEFAULT FALSE,
-- ========== SECURITY ==========
-- For abuse tracking.
-- Wide enough for IPv4/6
ip_address_creation VARCHAR(40) DEFAULT NULL,
-- ========== VECTOR CLOCK ==========
-- Incremented with every update.
version INT UNSIGNED NOT NULL DEFAULT 0,
-- ========== TIMESTAMPS ==========
created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
updated_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
-- This is when the OAuth token will expire.
-- While we need to refresh before this time, Twitch recommends against eager
-- refreshes and instead wants the code to lazily refresh.
-- This also has no bearing on the "refresh_token".
-- We'll just use this for bookkeeping.
expires_at TIMESTAMP DEFAULT NULL,
-- If the OAuth token is deleted, we set this.
-- We'll need to set it for all of a user's OAuth tokens since this table stores many tokens.
user_deleted_at TIMESTAMP NULL,
mod_deleted_at TIMESTAMP NULL,
-- INDICES --
PRIMARY KEY (id),
KEY index_oauth_refresh_grouping_token (oauth_refresh_grouping_token),
KEY fk_maybe_user_token (maybe_user_token),
KEY index_twitch_user_id (twitch_user_id),
-- KEY index_twitch_username (twitch_username),
KEY index_twitch_username_lowercase (twitch_username_lowercase),
KEY index_expires_at (expires_at),
KEY index_user_deleted_at (user_deleted_at),
KEY index_mod_deleted_at (mod_deleted_at)
-- KEY index_has_bits_read (has_bits_read),
-- KEY index_creator_ip_address (creator_ip_address)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin;
@@ -1,5 +0,0 @@
-- noinspection SqlDialectInspectionForFile
-- noinspection SqlNoDataSourceInspectionForFile
-- noinspection SqlResolveForFile
DROP TABLE twitch_bits_events;
@@ -1,44 +0,0 @@
-- noinspection SqlDialectInspectionForFile
-- noinspection SqlNoDataSourceInspectionForFile
-- noinspection SqlResolveForFile
-- This is primarily meant to be for analysis.
-- NB: See [_docs/database_schema.md] for details on Twitch-specifics.
CREATE TABLE twitch_bits_events(
-- Not used for anything except replication.
id BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
-- ========== USER / CHANNEL ==========
-- The user sending the bits.
-- We'll need to keep the name and lowercase for lookup.
sender_twitch_user_id VARCHAR(64) NOT NULL,
sender_twitch_username VARCHAR(32) NOT NULL,
sender_twitch_username_lowercase VARCHAR(32) NOT NULL,
-- The channel the bits were being sent to.
-- We technically only need the ID since we can JOIN, but we'll keep
-- the name for convenience.
destination_channel_id VARCHAR(64) NOT NULL,
destination_channel_name VARCHAR(32) NOT NULL,
-- ========== BITS DETAILS ==========
is_anonymous BOOLEAN NOT NULL DEFAULT FALSE,
-- The number of bits just spent
bits_used INT(10) UNSIGNED DEFAULT NULL,
-- The lifetime(?) number of bits spent by the user in this channel.
total_bits_used INT(10) UNSIGNED DEFAULT NULL,
chat_message TEXT NOT NULL,
-- INDICES --
PRIMARY KEY (id),
KEY index_sender_twitch_user_id (sender_twitch_user_id),
KEY index_sender_twitch_username_lowercase (sender_twitch_username_lowercase),
KEY index_destination_channel_id (destination_channel_id)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin;
@@ -1,5 +0,0 @@
-- noinspection SqlDialectInspectionForFile
-- noinspection SqlNoDataSourceInspectionForFile
-- noinspection SqlResolveForFile
DROP TABLE twitch_channel_point_events;
@@ -1,57 +0,0 @@
-- noinspection SqlDialectInspectionForFile
-- noinspection SqlNoDataSourceInspectionForFile
-- noinspection SqlResolveForFile
-- This is primarily meant to be for analysis.
-- NB: See [_docs/database_schema.md] for details on Twitch-specifics.
CREATE TABLE twitch_channel_point_events (
-- Not used for anything except replication.
id BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
-- ========== USER / CHANNEL ==========
-- The user sending the bits.
-- We'll need to keep the name and lowercase for lookup.
sender_twitch_user_id VARCHAR(64) NOT NULL,
sender_twitch_username VARCHAR(32) NOT NULL,
sender_twitch_username_lowercase VARCHAR(32) NOT NULL,
-- The channel the bits were being sent to.
-- We technically only need the ID since we can JOIN, but we'll keep
-- the name for convenience.
destination_channel_id VARCHAR(64) NOT NULL,
destination_channel_name VARCHAR(32) NOT NULL,
-- ========== CHANNEL POINTS DETAILS ==========
-- This is the title used for the reward
-- We'll match on this to do TTS
title VARCHAR(256) NOT NULL,
-- This is the description used for the reward
prompt VARCHAR(256) NOT NULL,
-- This is the text that the user sends
-- This is optional, but we'll coerce null to empty
user_text_input TEXT NOT NULL,
-- A UUID for this instance of reward redemption
redemption_id VARCHAR(36) NOT NULL,
-- A UUID for the reward
reward_id VARCHAR(36) NOT NULL,
reward_cost INT(10) UNSIGNED DEFAULT NULL,
is_sub_only BOOLEAN NOT NULL DEFAULT FALSE,
max_per_stream INT(10) UNSIGNED DEFAULT NULL,
max_per_user_per_stream INT(10) UNSIGNED DEFAULT NULL,
-- INDICES --
PRIMARY KEY (id),
KEY index_sender_twitch_user_id (sender_twitch_user_id),
KEY index_sender_twitch_username_lowercase (sender_twitch_username_lowercase),
KEY index_destination_channel_id (destination_channel_id)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin;
@@ -1,10 +0,0 @@
-- noinspection SqlDialectInspectionForFile
-- noinspection SqlNoDataSourceInspectionForFile
-- noinspection SqlResolveForFile
ALTER TABLE tts_inference_jobs DROP COLUMN is_for_twitch;
ALTER TABLE tts_inference_jobs DROP COLUMN is_from_api;
ALTER TABLE tts_inference_jobs DROP COLUMN priority_level;
ALTER TABLE tts_results DROP COLUMN is_from_api;
ALTER TABLE tts_results DROP COLUMN is_for_twitch;
@@ -1,23 +0,0 @@
-- noinspection SqlDialectInspectionForFile
-- noinspection SqlNoDataSourceInspectionForFile
-- noinspection SqlResolveForFile
ALTER TABLE tts_inference_jobs
ADD COLUMN is_from_api BOOLEAN NOT NULL DEFAULT FALSE
AFTER creator_set_visibility,
ADD COLUMN is_for_twitch BOOLEAN NOT NULL DEFAULT FALSE
AFTER is_from_api,
-- Priority *increases*, so a level of 2 will be higher than 1.
-- By default, all jobs from FakeYou have level 0.
-- Twitch TTS has level 1.
-- Paid Twitch and Paid API have level 2.
ADD COLUMN priority_level TINYINT UNSIGNED NOT NULL DEFAULT 0
AFTER status;
ALTER TABLE tts_results
ADD COLUMN is_from_api BOOLEAN NOT NULL DEFAULT FALSE
AFTER duration_millis,
ADD COLUMN is_for_twitch BOOLEAN NOT NULL DEFAULT FALSE
AFTER is_from_api;
@@ -1,6 +0,0 @@
-- noinspection SqlDialectInspectionForFile
-- noinspection SqlNoDataSourceInspectionForFile
-- noinspection SqlResolveForFile
ALTER TABLE tts_models DROP COLUMN is_front_page_featured;
ALTER TABLE tts_models DROP COLUMN is_twitch_featured;
@@ -1,10 +0,0 @@
-- noinspection SqlDialectInspectionForFile
-- noinspection SqlNoDataSourceInspectionForFile
-- noinspection SqlResolveForFile
ALTER TABLE tts_models
ADD COLUMN is_front_page_featured BOOLEAN NOT NULL DEFAULT FALSE
AFTER version_string,
ADD COLUMN is_twitch_featured BOOLEAN NOT NULL DEFAULT FALSE
AFTER is_front_page_featured;
@@ -1,5 +0,0 @@
-- noinspection SqlDialectInspectionForFile
-- noinspection SqlNoDataSourceInspectionForFile
-- noinspection SqlResolveForFile
DROP TABLE twitch_event_rules;
@@ -1,70 +0,0 @@
-- noinspection SqlDialectInspectionForFile
-- noinspection SqlNoDataSourceInspectionForFile
-- noinspection SqlResolveForFile
-- How to respond to different types of Twitch events.
-- Multiple rows per user
CREATE TABLE twitch_event_rules(
-- Not used for anything except replication.
id BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
-- Idempotency token from client
-- This is so the frontend client doesn't submit duplicate jobs.
uuid_idempotency_token VARCHAR(36) NOT NULL,
-- Effective "primary key" (PUBLIC)
token VARCHAR(32) NOT NULL,
-- Foreign key to user
-- This is a FakeYou/Storyteller account, *NOT* a twitch user id.
user_token VARCHAR(32) NOT NULL,
-- ========== EVENT MATCHING AND BEHAVIOR ==========
-- What type of event we'll be responding to.
event_category ENUM(
'bits',
'channel_points',
'chat_command'
) NOT NULL,
-- A JSON payload containing any predicates we wish to apply to the match.
-- eg. bits_value > 100
-- eg. channel_points_award_name == "Mario Voice"
event_match_predicate MEDIUMTEXT NOT NULL,
-- A JSON payload containing how we wish to respond to the event.
-- eg. tts M:model
event_response MEDIUMTEXT NOT NULL,
-- ========== RULE ORGANIZATION AND MANAGEMENT ==========
-- The user can rearrange the rules in the UI.
-- This will be the order they apply in if matched.
-- NB: There is nothing in MySQL to guarantee unique ordering.
user_specified_rule_order INT(10) UNSIGNED NOT NULL DEFAULT 0,
-- Whether or not the rule is enabled.
-- This is different than deleted. It still shows up in the UI.
rule_is_disabled BOOLEAN NOT NULL DEFAULT FALSE,
-- ========== ABUSE TRACKING, ETC. ==========
-- For abuse tracking.
-- Wide enough for IPv4/6
ip_address_creation VARCHAR(40) NOT NULL,
ip_address_last_update VARCHAR(40) NOT NULL,
created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
updated_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
deleted_at TIMESTAMP DEFAULT NULL,
-- INDICES --
PRIMARY KEY (id),
UNIQUE KEY (uuid_idempotency_token),
UNIQUE KEY (token),
KEY fk_user_token (user_token),
KEY index_event_category (event_category),
KEY index_deleted_at (deleted_at)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin;
@@ -1,5 +0,0 @@
-- noinspection SqlDialectInspectionForFile
-- noinspection SqlNoDataSourceInspectionForFile
-- noinspection SqlResolveForFile
DROP TABLE twitch_general_settings;
@@ -1,38 +0,0 @@
-- noinspection SqlDialectInspectionForFile
-- noinspection SqlNoDataSourceInspectionForFile
-- noinspection SqlResolveForFile
-- One row per user. Contains all of the general (non-repeated) configs.
CREATE TABLE twitch_general_settings (
-- Not used for anything except replication.
id BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
-- Foreign key to user
-- This is a FakeYou/Storyteller account, *NOT* a twitch user id.
user_token VARCHAR(32) NOT NULL,
-- Kill switch for the entire service.
storyteller_is_enabled BOOLEAN NOT NULL DEFAULT FALSE,
-- Kill switch for TTS.
tts_is_enabled BOOLEAN NOT NULL DEFAULT FALSE,
-- Kill switch for W2L.
w2l_is_enabled BOOLEAN NOT NULL DEFAULT FALSE,
-- Can set a fallback voice if a TTS voice goes missing.
maybe_fallback_tts_model_token VARCHAR(32) DEFAULT NULL,
-- For abuse tracking.
-- Wide enough for IPv4/6
ip_address_creation VARCHAR(40) NOT NULL,
ip_address_last_update VARCHAR(40) NOT NULL,
created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
updated_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
-- INDICES --
PRIMARY KEY (id),
UNIQUE KEY (user_token)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin;
@@ -1,5 +0,0 @@
-- noinspection SqlDialectInspectionForFile
-- noinspection SqlNoDataSourceInspectionForFile
-- noinspection SqlResolveForFile
DROP TABLE api_tokens;
@@ -1,47 +0,0 @@
-- noinspection SqlDialectInspectionForFile
-- noinspection SqlNoDataSourceInspectionForFile
-- noinspection SqlResolveForFile
-- We'll use application logic to kill any API keys beyond the most recent 5 "active" a user creates.
CREATE TABLE api_tokens (
-- Not used for anything except replication.
id BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
-- Idempotency token from client
-- This is so the frontend client doesn't submit duplicate jobs.
uuid_idempotency_token VARCHAR(36) NOT NULL,
-- This is a private internal reference to the API token.
-- Not shared with consumers / users.
-- This should be used as the foreign key for the token.
internal_token VARCHAR(32) NOT NULL,
-- This is the secret API token value given to consumers
api_token VARCHAR(32) NOT NULL,
-- Foreign key to user that owns the API token.
-- A user can have several.
user_token VARCHAR(32) NOT NULL,
-- A user-defined short description (optional)
maybe_short_description VARCHAR(32) DEFAULT NULL,
-- For abuse tracking.
-- Wide enough for IPv4/6
ip_address_creation VARCHAR(40) NOT NULL,
ip_address_last_update VARCHAR(40) NOT NULL,
created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
updated_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
deleted_at TIMESTAMP DEFAULT NULL,
-- INDICES --
PRIMARY KEY (id),
UNIQUE KEY (uuid_idempotency_token),
UNIQUE KEY (internal_token),
UNIQUE KEY (api_token),
KEY fk_user_token (user_token),
KEY index_created_at (created_at),
KEY index_deleted_at (deleted_at)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin;
@@ -1,5 +0,0 @@
-- noinspection SqlDialectInspectionForFile
-- noinspection SqlNoDataSourceInspectionForFile
-- noinspection SqlResolveForFile
DROP TABLE voice_clone_requests;
@@ -1,77 +0,0 @@
-- noinspection SqlDialectInspectionForFile
-- noinspection SqlNoDataSourceInspectionForFile
-- noinspection SqlResolveForFile
CREATE TABLE voice_clone_requests(
-- Not used for anything except replication.
id BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
-- Idempotency token from client
-- This is so the frontend client doesn't submit duplicate jobs.
uuid_idempotency_token VARCHAR(36) NOT NULL,
-- Effective "primary key" (PUBLIC)
token VARCHAR(32) NOT NULL,
-- ========== CONTACT ==========
-- Foreign key to user
-- This is a FakeYou/Storyteller account, *NOT* a twitch user id.
maybe_user_token VARCHAR(32) DEFAULT NULL,
email_address VARCHAR(255) NOT NULL,
discord_username VARCHAR(255) NOT NULL,
-- ========== REASON ==========
-- Visibility
is_for_private_use BOOLEAN NOT NULL DEFAULT FALSE,
is_for_public_use BOOLEAN NOT NULL DEFAULT FALSE,
-- How they'll use
is_for_studio BOOLEAN NOT NULL DEFAULT FALSE,
is_for_twitch_tts BOOLEAN NOT NULL DEFAULT FALSE,
is_for_api_use BOOLEAN NOT NULL DEFAULT FALSE,
is_for_music BOOLEAN NOT NULL DEFAULT FALSE,
is_for_games BOOLEAN NOT NULL DEFAULT FALSE,
is_for_other BOOLEAN NOT NULL DEFAULT FALSE,
optional_notes_on_use MEDIUMTEXT DEFAULT NULL,
-- Subject/Ownership
is_own_voice BOOLEAN NOT NULL DEFAULT FALSE,
is_third_party_voice BOOLEAN NOT NULL DEFAULT FALSE,
optional_notes_on_subject VARCHAR(255) DEFAULT NULL,
-- ========== RECORDING QUALITY / EQUIPMENT ==========
has_clean_audio_recordings BOOLEAN NOT NULL DEFAULT FALSE,
has_good_microphone BOOLEAN NOT NULL DEFAULT FALSE,
-- ========== COMMENTS ==========
optional_questions MEDIUMTEXT DEFAULT NULL,
optional_extra_comments MEDIUMTEXT DEFAULT NULL,
-- ========== BUSINESS END / INTERNAL USE ==========
internal_has_been_handled BOOLEAN NOT NULL DEFAULT FALSE,
internal_notes MEDIUMTEXT DEFAULT NULL,
-- ========== ABUSE TRACKING, ETC. ==========
-- For abuse tracking.
-- Wide enough for IPv4/6
ip_address_creation VARCHAR(40) NOT NULL,
created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
updated_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
-- INDICES --
PRIMARY KEY (id),
UNIQUE KEY (uuid_idempotency_token),
UNIQUE KEY (token),
KEY fk_maybe_user_token (maybe_user_token)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin;
@@ -1,9 +0,0 @@
-- noinspection SqlDialectInspectionForFile
-- noinspection SqlNoDataSourceInspectionForFile
-- noinspection SqlResolveForFile
ALTER TABLE tts_models
DROP COLUMN ietf_language_tag;
ALTER TABLE tts_models
DROP COLUMN ietf_primary_language_subtag;
@@ -1,13 +0,0 @@
-- noinspection SqlDialectInspectionForFile
-- noinspection SqlNoDataSourceInspectionForFile
-- noinspection SqlResolveForFile
-- The full IETF BCP47 language tag (eg. en, en-US, es-419, ja-JP, pt, etc.)
ALTER TABLE tts_models
ADD COLUMN ietf_language_tag VARCHAR(64) NOT NULL DEFAULT 'en'
AFTER maybe_default_pretrained_vocoder;
-- The IETF BCP47 language tag's primary language subtag (eg. "es-419" becomes "es")
ALTER TABLE tts_models
ADD COLUMN ietf_primary_language_subtag VARCHAR(12) NOT NULL DEFAULT 'en'
AFTER ietf_language_tag;
@@ -1,6 +0,0 @@
-- noinspection SqlDialectInspectionForFile
-- noinspection SqlNoDataSourceInspectionForFile
-- noinspection SqlResolveForFile
ALTER TABLE tts_models
DROP COLUMN maybe_suggested_unique_bot_command;
@@ -1,14 +0,0 @@
-- noinspection SqlDialectInspectionForFile
-- noinspection SqlNoDataSourceInspectionForFile
-- noinspection SqlResolveForFile
-- A bot command prefix, eg. 'sonic' that could be interpreted as '/sonic' by a TTS system.
-- These are unique strings and can only be applied to one model at a time.
-- Only moderators can set this, and it's only for the best voices.
ALTER TABLE tts_models
ADD COLUMN maybe_suggested_unique_bot_command VARCHAR(255) DEFAULT NULL
AFTER is_twitch_featured;
-- And the unique index.
ALTER TABLE tts_models
ADD UNIQUE INDEX unique_index_maybe_suggested_unique_bot_command (maybe_suggested_unique_bot_command);
@@ -1,6 +0,0 @@
-- noinspection SqlDialectInspectionForFile
-- noinspection SqlNoDataSourceInspectionForFile
-- noinspection SqlResolveForFile
ALTER TABLE twitch_oauth_tokens
DROP COLUMN internal_token;
@@ -1,12 +0,0 @@
-- noinspection SqlDialectInspectionForFile
-- noinspection SqlNoDataSourceInspectionForFile
-- noinspection SqlResolveForFile
-- In case we ever want to query these via an admin interface, it'd be nice to not use IDs
ALTER TABLE twitch_oauth_tokens
ADD COLUMN internal_token VARCHAR(32) NOT NULL
AFTER id;
-- And the unique index.
ALTER TABLE twitch_oauth_tokens
ADD UNIQUE INDEX unique_index_internal_token (internal_token);
@@ -1,9 +0,0 @@
-- noinspection SqlDialectInspectionForFile
-- noinspection SqlNoDataSourceInspectionForFile
-- noinspection SqlResolveForFile
ALTER TABLE twitch_bits_events
DROP COLUMN created_at;
ALTER TABLE twitch_bits_events
DROP COLUMN updated_at;
@@ -1,11 +0,0 @@
-- noinspection SqlDialectInspectionForFile
-- noinspection SqlNoDataSourceInspectionForFile
-- noinspection SqlResolveForFile
ALTER TABLE twitch_bits_events
ADD COLUMN created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP
AFTER chat_message;
ALTER TABLE twitch_bits_events
ADD COLUMN updated_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
AFTER created_at;
@@ -1,9 +0,0 @@
-- noinspection SqlDialectInspectionForFile
-- noinspection SqlNoDataSourceInspectionForFile
-- noinspection SqlResolveForFile
ALTER TABLE twitch_channel_point_events
DROP COLUMN created_at;
ALTER TABLE twitch_channel_point_events
DROP COLUMN updated_at;
@@ -1,11 +0,0 @@
-- noinspection SqlDialectInspectionForFile
-- noinspection SqlNoDataSourceInspectionForFile
-- noinspection SqlResolveForFile
ALTER TABLE twitch_channel_point_events
ADD COLUMN created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP
AFTER max_per_user_per_stream;
ALTER TABLE twitch_channel_point_events
ADD COLUMN updated_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
AFTER created_at;
@@ -1,9 +0,0 @@
-- noinspection SqlDialectInspectionForFile
-- noinspection SqlNoDataSourceInspectionForFile
-- noinspection SqlResolveForFile
ALTER TABLE tts_results
DROP COLUMN is_generated_on_prem;
ALTER TABLE tts_results
DROP COLUMN generated_by_worker;
@@ -1,11 +0,0 @@
-- noinspection SqlDialectInspectionForFile
-- noinspection SqlNoDataSourceInspectionForFile
-- noinspection SqlResolveForFile
ALTER TABLE tts_results
ADD COLUMN is_generated_on_prem BOOLEAN NOT NULL DEFAULT FALSE
AFTER is_for_twitch;
ALTER TABLE tts_results
ADD COLUMN generated_by_worker VARCHAR(255) DEFAULT NULL
AFTER is_generated_on_prem;
@@ -1,10 +0,0 @@
-- noinspection SqlDialectInspectionForFile
-- noinspection SqlNoDataSourceInspectionForFile
-- noinspection SqlResolveForFile
ALTER TABLE tts_inference_jobs
DROP COLUMN is_debug_request;
ALTER TABLE tts_results
DROP COLUMN is_debug_request;
@@ -1,14 +0,0 @@
-- noinspection SqlDialectInspectionForFile
-- noinspection SqlNoDataSourceInspectionForFile
-- noinspection SqlResolveForFile
ALTER TABLE tts_inference_jobs
ADD COLUMN is_debug_request BOOLEAN NOT NULL DEFAULT FALSE
AFTER is_for_twitch;
ALTER TABLE tts_inference_jobs
ADD INDEX index_is_debug_request (is_debug_request);
ALTER TABLE tts_results
ADD COLUMN is_debug_request BOOLEAN NOT NULL DEFAULT FALSE
AFTER is_for_twitch;

Some files were not shown because too many files have changed in this diff Show More