This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -34,6 +34,7 @@ env/
|
|||||||
*~
|
*~
|
||||||
.cursorrules
|
.cursorrules
|
||||||
.cursorignore
|
.cursorignore
|
||||||
|
.kiro/
|
||||||
|
|
||||||
# OS
|
# OS
|
||||||
.DS_Store
|
.DS_Store
|
||||||
|
|||||||
@@ -49,6 +49,7 @@ LLM_PRESETS: List[Dict[str, Any]] = [
|
|||||||
"base_url": "http://localhost:11434/v1",
|
"base_url": "http://localhost:11434/v1",
|
||||||
"model": "llama3.2",
|
"model": "llama3.2",
|
||||||
"api_key_url": "https://ollama.com/download",
|
"api_key_url": "https://ollama.com/download",
|
||||||
|
"default_api_key": "ollama", # Required by OpenAI SDK but ignored by Ollama
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "Moonshot",
|
"name": "Moonshot",
|
||||||
|
|||||||
@@ -60,14 +60,15 @@ class LLMService:
|
|||||||
Initialize LLM service
|
Initialize LLM service
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
config: Full application config dict
|
config: Full application config dict (kept for backward compatibility)
|
||||||
"""
|
"""
|
||||||
self.config = config.get("llm", {})
|
# Note: We no longer cache config here to support hot reload
|
||||||
|
# Config is read dynamically from config_manager in _get_config_value()
|
||||||
self._client: Optional[AsyncOpenAI] = None
|
self._client: Optional[AsyncOpenAI] = None
|
||||||
|
|
||||||
def _get_config_value(self, key: str, default=None):
|
def _get_config_value(self, key: str, default=None):
|
||||||
"""
|
"""
|
||||||
Get config value from config file
|
Get config value dynamically from config_manager (supports hot reload)
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
key: Config key name
|
key: Config key name
|
||||||
@@ -76,7 +77,8 @@ class LLMService:
|
|||||||
Returns:
|
Returns:
|
||||||
Config value
|
Config value
|
||||||
"""
|
"""
|
||||||
return self.config.get(key, default)
|
from pixelle_video.config import config_manager
|
||||||
|
return getattr(config_manager.config.llm, key, default)
|
||||||
|
|
||||||
def _create_client(
|
def _create_client(
|
||||||
self,
|
self,
|
||||||
|
|||||||
@@ -80,8 +80,8 @@ def render_advanced_settings():
|
|||||||
# Same preset as saved config: keep API key
|
# Same preset as saved config: keep API key
|
||||||
default_api_key = current_llm["api_key"]
|
default_api_key = current_llm["api_key"]
|
||||||
else:
|
else:
|
||||||
# Different preset: clear API key
|
# Different preset: use default_api_key if provided (e.g., Ollama), otherwise clear
|
||||||
default_api_key = ""
|
default_api_key = preset_config.get("default_api_key", "")
|
||||||
|
|
||||||
default_base_url = preset_config.get("base_url", "")
|
default_base_url = preset_config.get("base_url", "")
|
||||||
default_model = preset_config.get("model", "")
|
default_model = preset_config.get("model", "")
|
||||||
|
|||||||
Reference in New Issue
Block a user