feat: 新增启动欢迎通知、流式预览节点及多项功能更新
- 新增启动弹窗通知(绿色主题,支持关闭) - 新增 StreamPreview 流式文本预览节点 - 新增 fileUpload、updateNotifier 前端 JS 模块 - 重构多个 client,统一错误处理 - 删除废弃节点 batch_nano_banana_v2、quan_neng_sheng_tu 等 - 将 .config 纳入版本控制(已清空密钥)
This commit is contained in:
+50
-8
@@ -3,13 +3,13 @@
|
||||
用于在 ComfyUI 节点间传递文件数据
|
||||
"""
|
||||
|
||||
from typing import NamedTuple
|
||||
from typing import NamedTuple, List
|
||||
|
||||
|
||||
class FileData(NamedTuple):
|
||||
"""
|
||||
文件数据类型,用于在节点间传递
|
||||
|
||||
单个文件数据,用于节点间传递
|
||||
|
||||
Attributes:
|
||||
path: 文件完整路径
|
||||
filename: 文件名(不含扩展名)
|
||||
@@ -26,15 +26,57 @@ class FileData(NamedTuple):
|
||||
size: int
|
||||
|
||||
|
||||
# 支持的文档 MIME 类型映射
|
||||
# FILE_LIST 类型:FileData 的列表,用于多文件传递
|
||||
# ComfyUI 自定义类型名,节点 RETURN_TYPES / INPUT_TYPES 中使用 "FILE_LIST"
|
||||
FileList = List[FileData]
|
||||
|
||||
|
||||
# 支持的文件 MIME 类型映射(与 universal_llm.py 的 MIME_MAP 保持一致)
|
||||
DOCUMENT_MIME_TYPES = {
|
||||
".pdf": "application/pdf",
|
||||
".txt": "text/plain"
|
||||
".txt": "text/plain",
|
||||
".md": "text/markdown",
|
||||
".csv": "text/csv",
|
||||
".json": "application/json",
|
||||
".py": "text/x-python",
|
||||
".js": "text/javascript",
|
||||
".ts": "text/javascript",
|
||||
".html": "text/html",
|
||||
".xml": "application/xml",
|
||||
".yaml": "text/plain",
|
||||
".yml": "text/plain",
|
||||
".toml": "text/plain",
|
||||
".ini": "text/plain",
|
||||
".cfg": "text/plain",
|
||||
".log": "text/plain",
|
||||
".sh": "text/plain",
|
||||
".bat": "text/plain",
|
||||
".sql": "text/plain",
|
||||
".css": "text/plain",
|
||||
".scss": "text/plain",
|
||||
".jsx": "text/javascript",
|
||||
".tsx": "text/javascript",
|
||||
".docx": "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
|
||||
".xlsx": "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
|
||||
".pptx": "application/vnd.openxmlformats-officedocument.presentationml.presentation",
|
||||
".zip": "application/zip",
|
||||
".png": "image/png",
|
||||
".jpg": "image/jpeg",
|
||||
".jpeg": "image/jpeg",
|
||||
".webp": "image/webp",
|
||||
".wav": "audio/wav",
|
||||
".mp3": "audio/mpeg",
|
||||
".mp4": "video/mp4",
|
||||
}
|
||||
|
||||
# 单文件大小上限:50MB
|
||||
FILE_SIZE_LIMIT = 50 * 1024 * 1024
|
||||
|
||||
# 文件大小限制(字节)
|
||||
# 所有文件总大小上限:50MB
|
||||
TOTAL_FILE_SIZE_LIMIT = 50 * 1024 * 1024
|
||||
|
||||
# 兼容旧代码
|
||||
FILE_SIZE_LIMITS = {
|
||||
".pdf": 50 * 1024 * 1024, # 50MB (Gemini API 官方限制)
|
||||
".txt": 20 * 1024 * 1024 # 20MB (保守限制)
|
||||
".pdf": FILE_SIZE_LIMIT,
|
||||
".txt": FILE_SIZE_LIMIT,
|
||||
}
|
||||
|
||||
+22
-10
@@ -72,15 +72,27 @@ def check_for_updates() -> bool:
|
||||
|
||||
|
||||
def notify_update_available():
|
||||
"""通知用户有更新可用"""
|
||||
"""通知用户有更新可用(前端弹窗 + 控制台)"""
|
||||
current_version = get_current_version()
|
||||
version_str = f" (当前版本: {current_version})" if current_version else ""
|
||||
|
||||
print("\n" + "="*60)
|
||||
print(f"🎉 Comfyui_o1key 有新版本可用{version_str}")
|
||||
print("="*60)
|
||||
print("更新方法:")
|
||||
print(" Windows: 双击运行 update.bat")
|
||||
print(" Linux/Mac: 运行 ./update.sh")
|
||||
print("或手动执行: git pull origin main")
|
||||
print("="*60 + "\n")
|
||||
|
||||
print(f"[comfyui_o1key] 有新版本可用{version_str}")
|
||||
|
||||
try:
|
||||
import threading
|
||||
from server import PromptServer
|
||||
|
||||
def _send():
|
||||
try:
|
||||
PromptServer.instance.send_sync(
|
||||
"o1key.update_available",
|
||||
{"message": "欢迎使用o1key工作流,祝您马年,马上有福,马上有钱,马到成功!!!"}
|
||||
)
|
||||
print("[o1key] 更新通知已发送到前端")
|
||||
except Exception as e:
|
||||
print(f"[o1key] 发送通知失败: {e}")
|
||||
|
||||
# 延迟 5 秒发送,确保前端 WebSocket 已连接
|
||||
threading.Timer(5.0, _send).start()
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
Reference in New Issue
Block a user