# This document is used for additional control over the security and privacy of IIB. By default, IIB is already sufficiently secure, and you do not need to take any additional actions.
# Copy this file and rename it to ".env"  . Then, fill in the necessary values for your specific use case.
# Remember to never share your .env file with anyone else as it may contain sensitive information.

# This attribute is used for authentication. If you input a key here, it will be validated for authentication purposes.
# It will be prompted to enter your key when you open the extension. If the authentication fails, all your requests will be rejected.
IIB_SECRET_KEY=

# Configuring the server-side language for this extension,
# including the tab title and most of the server-side error messages returned. Options are 'zh', 'en', or 'auto'.
# If you want to configure the language for the front-end pages, please set it on the extension's global settings page.
IIB_SERVER_LANG=auto

# This configuration parameter specifies the maximum number of database file backups for the IIB .
IIB_DB_FILE_BACKUP_MAX=4

# Set the cache directory for IIB, including image cache and video cover cache.
# The default is the system's temporary directory, but if you want to specify a custom directory, set it here.
# You can use --generate_video_cover and --generate_image_cache to pre-generate the cache.
# IIB_CACHE_DIR=


# ---------------------------- ACCESS_CONTROL ----------------------------

# Used to configure whether to enable access control to the file system.
# If enabled, only access to the provided pre-set folders (including those provided by sd-webui and manually \
# added to Quick Move or specified via IIB_ACCESS_CONTROL_ALLOWED_PATHS) will be allowed.
# The available options are 'enable', 'disable', and 'auto'.
# The default value is 'auto', which will be determined based on the command-line parameters used to start sd-webui (such as --server-name, --share, --listen).
IIB_ACCESS_CONTROL=auto

# This variable is used to define a list of allowed paths for the application to access when access control mode is enabled.
# It can be set to a comma-separated string of file paths or directory paths, representing the resources that are allowed to be accessed by the application.
# In addition, if sd_webui_config or sd_webui_dir has been configured, or if you're running this repository as an extension of sd-webui,
# you can use the following shortcuts (txt2img, img2img, extra, save) as values for the ALLOWED_PATHS variable.
# IIB_ACCESS_CONTROL_ALLOWED_PATHS=save,extra,/output   ...etc

# This variable is used to control fine-grained access control for different types of requests, but only if access control mode is enabled.
# It can be set to a string value that represents a specific permission or set of permissions, such as "read-only", "write-only", "read-write", or "no-access".
# This variable can be used to restrict access to certain API endpoints or data sources based on the permissions required by the user.
# IIB_ACCESS_CONTROL_PERMISSION=read-write



# ---------------------------- PARSER_CONFIG ----------------------------
# This attribute is used to control whether to enable SdWebUIStealthParser.
# Due to the high performance cost of parsing this type of file, it is disabled by default.
# Set to 'true' to enable it.
IIB_ENABLE_SD_WEBUI_STEALTH_PARSER=false

# When parsing ComfyUI images, extract all CLIPTextEncode prompts instead of following the KSampler chain.
# Set to 'true' to enable extracting all prompts at once.
# Note: When enabled, all prompts will be merged into the positive prompt field.
# It cannot automatically distinguish between positive and negative prompts.
# Adjust the parsing logic based on your workflow if needed.
IIB_COMFYUI_EXTRACT_ALL_PROMPTS=false


# ---------------------------- AI / EMBEDDINGS ----------------------------
# OpenAI-compatible API base url.
# - Keep it generic here (do NOT write any provider-specific or personal info into this example file).
# - Typical format: https://your-openai-compatible-host/v1
# - This project uses it for BOTH embeddings (/embeddings) and topic-title chat (/chat/completions).
OPENAI_BASE_URL=

# OpenAI-compatible API key (Bearer token).
# - Put your real key in x.env (or .env) only, never commit it.
OPENAI_API_KEY=

# Embedding model id (OpenAI-compatible).
# - Used for clustering images by prompt semantics.
# - Recommended: start with a small/cheap embedding model; switch to a larger one only if clustering quality is insufficient.
EMBEDDING_MODEL=text-embedding-3-small

# Default chat model id (OpenAI-compatible).
# - Used by the generic /ai_chat endpoint (if you use it) and as a fallback default.
# - If your provider applies content filtering that sometimes returns empty output, try switching to another chat model here.
AI_MODEL=gpt-4o-mini

# Topic title model id (OpenAI-compatible).
# - Used ONLY for generating short cluster titles/keywords (topic naming).
# - If not set, it falls back to AI_MODEL.
# - Tip: if a model frequently violates "JSON only" or gets truncated, switch this model first.
TOPIC_TITLE_MODEL=gpt-4o-mini

# Prompt normalization before embedding/clustering (remove boilerplate but keep distinctiveness).
# - Removes common "quality / camera / resolution" boilerplate from prompts before embedding.
# - Keep enabled for better clustering; disable only for debugging.
IIB_PROMPT_NORMALIZE=1

# Prompt normalization mode:
# - 'balanced' (recommended): remove generic boilerplate but keep some discriminative style words.
# - 'theme_only' (aggressive): focus more on subject/theme nouns; may lose some stylistic distinctiveness.
IIB_PROMPT_NORMALIZE_MODE=balanced
