ref:让MaiSaka使用麦麦原有的pompt系统,配置系统

This commit is contained in:
SengokuCola
2026-03-11 21:25:35 +08:00
parent 6c32d17e21
commit 664f900f43
40 changed files with 230 additions and 221 deletions

40
saka.py Normal file
View File

@@ -0,0 +1,40 @@
"""
MaiSaka - 程序入口
使用方法:
python saka.py
环境变量 (可通过 .env 文件设置):
OPENAI_API_KEY - API 密钥
OPENAI_BASE_URL - API 基地址 (可选, 默认 https://api.openai.com/v1)
OPENAI_MODEL - 模型名称 (可选, 默认 gpt-4o)
ENABLE_THINKING - 是否启用思考模式 (可选, true/false, 不设置则不发送该参数)
"""
import asyncio
import sys
from pathlib import Path
# 添加项目根目录和 src/maisaka 到 Python 路径
_root = Path(__file__).parent
_maisaka_path = _root / "src" / "maisaka"
if str(_root) not in sys.path:
sys.path.insert(0, str(_root))
if str(_maisaka_path) not in sys.path:
sys.path.insert(0, str(_maisaka_path))
from config import console
from cli import BufferCLI
def main():
cli = BufferCLI()
try:
asyncio.run(cli.run())
except KeyboardInterrupt:
console.print("\n[muted]程序已终止[/muted]")
finally:
cli._debug_viewer.close()
if __name__ == "__main__":
main()