feat: auto-detect image aspect ratio from prompt#125
Open
TriTue2011 wants to merge 496 commits into
Open
Conversation
Author
|
I have pushed two additional commits to this PR:
|
…codes Status codes: 正常→active, 限流→limited, 异常→error, 禁用→disabled Auto-migration in _normalize_account for backward compatibility All UI text translated: settings, accounts, image pages
…se body and headers
… original_token ref
…t filters exact match
- auto → gpt-4o (better instruction following than gpt-4.1-mini) - OpenCode/Gemini/Codex/NVIDIA RTK threshold: 80KB Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
- openai_default_model config (default: gpt-4o) - UI input in Settings for custom model name - Used when chatgpt/auto routes through api.openai.com Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Web session routes through api.openai.com and needs gpt-4o, gpt-4o-mini, etc. Now always merged into chatgpt provider models. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Added complete guide for new users: HA integration via Local OpenAI LLM, recommended prompts, model prefixes, combo fallback, and image generation. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
_ensure_openai_provider() creates the required custom provider config if missing. No manual setup needed for addon. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
New addon installs now have api.openai.com provider configured out of the box. No manual setup needed for web session routing. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
When API key is sk-auto-created or sk-placeholder, automatically uses first active JWT token from account pool. Makes addon work without manual API key configuration. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Shows token preview, model, message count when OpenAI returns errors to help diagnose addon 500 issue. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
DATA_DIR auto-uses /data/chatgpt2api when running as HA addon. Config copied from default on first run. Accounts survive rebuilds. Debug logs for auto-JWT key injection and error details. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Previously only first JWT token was used, causing "All API keys rate limited" when that single key hit rate limit. Now all active JWT tokens are available for rotation. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
gpt-4o returns 500 on free plan JWT tokens via OpenAI API. gpt-4o-mini is available on all plans. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Remove OpenAI API routing to match original repo behavior. Fixes JWT token 500 errors on addon (ARM64/IP restricted). Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Previously search was skipped for chatgpt provider. Now chatgpt/auto uses chatgpt.com backend without browsing, so search injection is needed for real-time results. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Auto-detect architecture: AMD64 uses OpenAI API (native tools), ARM64/addon uses chatgpt.com backend (avoids JWT 500 errors). Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
When ARM64 + tools, route via openai_relay_url config. force_base_url overrides custom provider base URL. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
ARM64 routes: relay if openai_relay_url set, else prompt-based tool loop. AMD64 unchanged (OpenAI API direct). Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
…64/ARM64 split - Remove _handle_chatgpt_tool_loop (prompt-based tool calling) - Remove force_base_url parameter (relay remnant) - Keep simple: AMD64 → OpenAI API, ARM64 → chatgpt.com backend Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
- Check /data/options.json as definitive HA addon signal - Works even if /data/chatgpt2api doesn't exist yet on first boot Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
- /config/chatgpt2api survives uninstall, included in HA backups - Auto-migrate from old /data/chatgpt2api location - Read-only config map for web UI managed settings Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
- BackendRouter.route(): auto resolution checks model_settings.enabled_models - openai_oauth: cx/auto fallback chain filtered to enabled models only - _handle_chatgpt_chat: chatgpt/auto on AMD64 respects enabled filter - If default model not enabled, falls back to first enabled model Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
…counts) - _extract_xml_tool_calls_from_text: parse <tool_call> XML blocks from AI text - _stream_chatgpt_addon: streaming wrapper with tool call extraction - _chatgpt_addon_completion: non-streaming wrapper with tool call extraction - Chatgpt.com path in _handle_chatgpt_chat now calls these wrappers - Shared functions (stream_text_chat_completion, completion_response) unchanged - No impact on AMD64 OpenAI API path or Anthropic protocol Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Keyword detection for Vietnamese smart home terms injects MUST call GetLiveContext FIRST hint into system prompt. Works in both streaming and sync wrappers. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
…I on all archs Paid accounts (codex, go, plus, business) now route to OpenAI API native tools regardless of architecture. Free accounts still use chatgpt.com backend with XML parsing + force hint. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Docker free accounts keep original chatgpt.com backend behavior. Only addon free accounts get XML parsing + force hint for HA tools. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
enabled_models contains auto entries which are UI placeholders, not real API models. Filter them out before picking model. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Enabled models have chatgpt/ prefix but default_model is bare name. Normalize prefix before comparison to correctly detect if default is enabled. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
…tent detected When needs_search() matches, skip OpenAI API routing and use chatgpt.com backend which has primary_assistant mode with web_search tool built in. Paid accounts still use OpenAI API for non-search queries. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Cho phép tự động nhận diện tỷ lệ khung hình (ví dụ 16:9, 1:1, 4:3) từ nội dung của prompt để ghi đè lên cấu hình mặc định (khi kích thước bị Home Assistant hoặc các client khác gửi lên mặc định). Điều này cho phép ghi đè tham số \size\ bằng những keyword tìm thấy trong yêu cầu gốc của người dùng.