Add AI chat with skills management and model provider settings
- Model providers for OpenAI and Anthropic message formats (e.g. via Sub2API), with API keys encrypted at rest and never returned - Skills tree with markdown editing, priorities, drafts, publishing and rollback; only published skills enter the chat prompt - Chat page with tool calls over collected news and Binance USD-M klines, a persisted CONTEXT.md, reset, and stop-generation support - Chat may only create skill drafts and update CONTEXT.md; publishing, deleting, moving and priority changes stay with the user
This commit is contained in:
1 parent
f042f27013
commit
5db3ead883
34 files changed
+3196
-12
No files matched your search
@@ -13,6 +13,8 @@ class Settings(BaseSettings):
|
||||
admin_username: str
|
||||
admin_password_hash: str = ""
|
||||
jwt_expire_days: int = 7
|
||||
# Fernet 密钥,加密存库的第三方 API key
|
||||
secret_encryption_key: str
|
||||
|
||||
|
||||
@lru_cache
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
"""存库凭证的加解密;密钥只在 .env 中"""
|
||||
|
||||
from functools import lru_cache
|
||||
|
||||
from cryptography.fernet import Fernet
|
||||
|
||||
from alphapulse.core.config import get_settings
|
||||
|
||||
|
||||
@lru_cache
|
||||
def _fernet() -> Fernet:
|
||||
return Fernet(get_settings().secret_encryption_key)
|
||||
|
||||
|
||||
def encrypt(plain: str) -> bytes:
|
||||
return _fernet().encrypt(plain.encode())
|
||||
|
||||
|
||||
def decrypt(token: bytes) -> str:
|
||||
return _fernet().decrypt(token).decode()
|
||||
Reference in new issue
Block a user