mirror of
https://github.com/zhayujie/chatgpt-on-wechat.git
synced 2026-07-17 11:07:11 +08:00
feat(desktop): redirect writable data to ~/.cow for packaged app
Introduce get_data_root() driven by the COW_DATA_DIR env var so the packaged desktop build stores config.json, run.log, user data and WeChat credentials under ~/.cow — surviving app updates and keeping the app bundle read-only. Source deployments leave COW_DATA_DIR unset and fall back to the repo root, so existing behavior is unchanged.
This commit is contained in:
@@ -12,6 +12,7 @@ from dashscope import MultiModalConversation
|
||||
|
||||
from bridge.reply import Reply, ReplyType
|
||||
from common.log import logger
|
||||
from common.tmp_dir import TmpDir
|
||||
from config import conf
|
||||
from voice import audio_convert
|
||||
from voice.voice import Voice
|
||||
@@ -121,8 +122,7 @@ class DashScopeVoice(Voice):
|
||||
@staticmethod
|
||||
def _download_audio(url: str) -> Optional[str]:
|
||||
try:
|
||||
tmp_dir = os.path.join(os.getcwd(), "tmp")
|
||||
os.makedirs(tmp_dir, exist_ok=True)
|
||||
tmp_dir = TmpDir().path()
|
||||
ts = datetime.datetime.now().strftime("%Y%m%d%H%M%S")
|
||||
ext = os.path.splitext(url.split("?", 1)[0])[1].lower() or ".wav"
|
||||
if ext not in (".mp3", ".wav", ".m4a", ".aac", ".opus"):
|
||||
|
||||
Reference in New Issue
Block a user