-
-
Notifications
You must be signed in to change notification settings - Fork 319
Expand file tree
/
Copy path__init__.py
More file actions
66 lines (56 loc) · 2.18 KB
/
__init__.py
File metadata and controls
66 lines (56 loc) · 2.18 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
'''
Author: ai-business-hql qingli.hql@alibaba-inc.com
Date: 2025-02-17 20:53:45
LastEditors: ai-business-hql ai.bussiness.hql@gmail.com
LastEditTime: 2025-11-20 20:03:20
FilePath: /comfyui_copilot/__init__.py
Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
'''
# Copyright (C) 2025 AIDC-AI
# Licensed under the MIT License.
import sys
import asyncio
# Ensure 'agents' resolves to openai-agents (not legacy RL package)
try:
import importlib.metadata as _im
from pathlib import Path as _Path
try:
_dist = _im.distribution("openai-agents")
except _im.PackageNotFoundError:
_dist = None
if _dist and _dist.files:
_init_rel = next((f for f in _dist.files if str(f).replace("\\", "/").endswith("agents/__init__.py")), None)
if _init_rel:
_init_path = _dist.locate_file(_init_rel)
_agents_parent = _Path(_init_path).parent.parent
_pp = str(_agents_parent)
if _pp not in sys.path:
sys.path.insert(0, _pp)
# If an incompatible 'agents' was already imported, drop it so the correct one can load
m = sys.modules.get("agents")
if m is not None and not hasattr(m, "Agent"):
sys.modules.pop("agents", None)
except Exception:
# Fail-open: never block plugin loading if aliasing fails
pass
import asyncio
import server
from aiohttp import web
import folder_paths
from .backend.controller.conversation_api import *
from .backend.controller.llm_api import *
from .backend.controller.expert_api import *
WEB_DIRECTORY = "entry"
NODE_CLASS_MAPPINGS = {}
__all__ = ['NODE_CLASS_MAPPINGS']
version = "V2.1.0"
workspace_path = os.path.join(os.path.dirname(__file__))
comfy_path = os.path.dirname(folder_paths.__file__)
db_dir_path = os.path.join(workspace_path, "db")
dist_path = os.path.join(workspace_path, 'dist/copilot_web')
if os.path.exists(dist_path):
server.PromptServer.instance.app.add_routes([
web.static('/copilot_web/', dist_path),
])
else:
print(f"🦄🦄🔴🔴Error: Web directory not found: {dist_path}")