a7e580407c
* feat: add desktop wrapper with frontend-only packaging * docs: add desktop build docs and track dashboard lockfile * fix: track desktop lockfile for npm ci * fix: allow custom install directory for windows installer * chore: migrate desktop workflow to pnpm * fix(desktop): build AppImage only on Linux * fix(desktop): harden packaged startup and backend bundling * fix(desktop): adapt packaged restart and plugin dependency flow * fix(desktop): prevent backend respawn race on quit * fix(desktop): prefer pyproject version for desktop packaging * fix(desktop): improve startup loading UX and reduce flicker * ci: add desktop multi-platform release workflow * ci: fix desktop release build and mac runner labels * ci: disable electron-builder auto publish in desktop build * ci: avoid electron-builder publish path in build matrix * ci: normalize desktop release artifact names * ci: exclude blockmap files from desktop release assets * ci: prefix desktop release assets with AstrBot and purge blockmaps * feat: add electron bridge types and expose backend control methods in preload script * Update startup screen assets and styles - Changed the icon from PNG to SVG format for better scalability. - Updated the border color from #d0d0d0 to #eeeeee for a softer appearance. - Adjusted the width of the startup screen from 460px to 360px for improved responsiveness. * Update .gitignore to include package.json * chore: remove desktop gitkeep ignore exceptions * docs: update desktop troubleshooting for current runtime behavior * refactor(desktop): modularize runtime and harden startup flow --------- Co-authored-by: Soulter <905617992@qq.com> Co-authored-by: Soulter <37870767+Soulter@users.noreply.github.com>
86 lines
2.9 KiB
Python
86 lines
2.9 KiB
Python
"""Astrbot统一路径获取
|
|
|
|
项目路径:固定为源码所在路径
|
|
根目录路径:默认为当前工作目录,可通过环境变量 ASTRBOT_ROOT 指定
|
|
数据目录路径:固定为根目录下的 data 目录
|
|
配置文件路径:固定为数据目录下的 config 目录
|
|
插件目录路径:固定为数据目录下的 plugins 目录
|
|
插件数据目录路径:固定为数据目录下的 plugin_data 目录
|
|
T2I 模板目录路径:固定为数据目录下的 t2i_templates 目录
|
|
WebChat 数据目录路径:固定为数据目录下的 webchat 目录
|
|
临时文件目录路径:固定为数据目录下的 temp 目录
|
|
Skills 目录路径:固定为数据目录下的 skills 目录
|
|
第三方依赖目录路径:固定为数据目录下的 site-packages 目录
|
|
"""
|
|
|
|
import os
|
|
|
|
|
|
def get_astrbot_path() -> str:
|
|
"""获取Astrbot项目路径"""
|
|
return os.path.realpath(
|
|
os.path.join(os.path.dirname(os.path.abspath(__file__)), "../../../"),
|
|
)
|
|
|
|
|
|
def get_astrbot_root() -> str:
|
|
"""获取Astrbot根目录路径"""
|
|
if path := os.environ.get("ASTRBOT_ROOT"):
|
|
return os.path.realpath(path)
|
|
return os.path.realpath(os.getcwd())
|
|
|
|
|
|
def get_astrbot_data_path() -> str:
|
|
"""获取Astrbot数据目录路径"""
|
|
return os.path.realpath(os.path.join(get_astrbot_root(), "data"))
|
|
|
|
|
|
def get_astrbot_config_path() -> str:
|
|
"""获取Astrbot配置文件路径"""
|
|
return os.path.realpath(os.path.join(get_astrbot_data_path(), "config"))
|
|
|
|
|
|
def get_astrbot_plugin_path() -> str:
|
|
"""获取Astrbot插件目录路径"""
|
|
return os.path.realpath(os.path.join(get_astrbot_data_path(), "plugins"))
|
|
|
|
|
|
def get_astrbot_plugin_data_path() -> str:
|
|
"""获取Astrbot插件数据目录路径"""
|
|
return os.path.realpath(os.path.join(get_astrbot_data_path(), "plugin_data"))
|
|
|
|
|
|
def get_astrbot_t2i_templates_path() -> str:
|
|
"""获取Astrbot T2I 模板目录路径"""
|
|
return os.path.realpath(os.path.join(get_astrbot_data_path(), "t2i_templates"))
|
|
|
|
|
|
def get_astrbot_webchat_path() -> str:
|
|
"""获取Astrbot WebChat 数据目录路径"""
|
|
return os.path.realpath(os.path.join(get_astrbot_data_path(), "webchat"))
|
|
|
|
|
|
def get_astrbot_temp_path() -> str:
|
|
"""获取Astrbot临时文件目录路径"""
|
|
return os.path.realpath(os.path.join(get_astrbot_data_path(), "temp"))
|
|
|
|
|
|
def get_astrbot_skills_path() -> str:
|
|
"""获取Astrbot Skills 目录路径"""
|
|
return os.path.realpath(os.path.join(get_astrbot_data_path(), "skills"))
|
|
|
|
|
|
def get_astrbot_site_packages_path() -> str:
|
|
"""获取Astrbot第三方依赖目录路径"""
|
|
return os.path.realpath(os.path.join(get_astrbot_data_path(), "site-packages"))
|
|
|
|
|
|
def get_astrbot_knowledge_base_path() -> str:
|
|
"""获取Astrbot知识库根目录路径"""
|
|
return os.path.realpath(os.path.join(get_astrbot_data_path(), "knowledge_base"))
|
|
|
|
|
|
def get_astrbot_backups_path() -> str:
|
|
"""获取Astrbot备份目录路径"""
|
|
return os.path.realpath(os.path.join(get_astrbot_data_path(), "backups"))
|