1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950 |
- import argparse
- import os.path
- import threading
- from core.api_app import app, start_flask
- from core.monitor_file import start_watchdog
- from tools.serve_client import ServerClient
- from tools.logger_handle import logger
- # 初始化 Flask 应用
- # 初始化桌面通知工具
- # 存储文档内容和推荐内容
- current_text = ""
- recommendation = "这是默认推荐内容"
- # 启动所有后台服务
- def start_all_services(serve_client, work_path):
- # 启动 Flask 服务
- threading.Thread(target=start_flask, args=[serve_client, work_path], daemon=True).start()
- # 启动文件监控
- # threading.Thread(target=start_watchdog, args=[serve_client, work_path], daemon=True).start()
- # 启动文档内容检查
- # threading.Thread(target=check_for_changes, daemon=True).start()
- logger.info('server running')
- while True:
- a = 0
- if __name__ == "__main__":
- parser = argparse.ArgumentParser(description='办公助手')
- parser.add_argument('--worker_path', type=str, required=True, help='文件下载目录。')
- parser.add_argument('--username', type=str, required=True, help='用户名')
- parser.add_argument('--password', type=str, required=True, help='密码')
- parser.add_argument('--server', type=str, required=True, help='密码')
- args = parser.parse_args()
- client = ServerClient(args.server, args.username, args.password)
- if not os.path.exists(os.path.join(args.worker_path, args.username)):
- os.makedirs(os.path.join(args.worker_path, args.username))
- start_all_services(client, os.path.join(args.worker_path, args.username))
|