mirror of
https://git.datalinker.icu/comfyanonymous/ComfyUI
synced 2026-08-16 02:30:02 +08:00
frp params in script.sh & insert data to notion db
This commit is contained in:
parent
38f0fbae1b
commit
ef052905ea
7
main.py
7
main.py
@ -12,6 +12,8 @@ import utils.extra_config
|
||||
import logging
|
||||
import sys
|
||||
|
||||
import notion
|
||||
|
||||
if __name__ == "__main__":
|
||||
#NOTE: These do not do anything on core ComfyUI, they are for custom nodes.
|
||||
os.environ['HF_HUB_DISABLE_TELEMETRY'] = '1'
|
||||
@ -112,6 +114,11 @@ if os.name == "nt":
|
||||
logging.getLogger("xformers").addFilter(lambda record: 'A matching Triton is not available' not in record.getMessage())
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
# 向 Notion 数据库插入记录:目前使用的frp服务商
|
||||
notion.add_record_to_notion_database("http://111.170.148.226:21663/")
|
||||
notion.add_record_to_notion_database("http://111.170.148.226:21664/")
|
||||
|
||||
if args.cuda_device is not None:
|
||||
os.environ['CUDA_VISIBLE_DEVICES'] = str(args.cuda_device)
|
||||
os.environ['HIP_VISIBLE_DEVICES'] = str(args.cuda_device)
|
||||
|
||||
43
notion.py
Normal file
43
notion.py
Normal file
@ -0,0 +1,43 @@
|
||||
import os
|
||||
from notion_client import Client
|
||||
from datetime import datetime
|
||||
|
||||
# 设置你的 Notion API Token 和 数据库 ID
|
||||
NOTION_TOKEN = "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"
|
||||
NOTION_DATABASE_ID = "230de91f217680388daed107820a5dc8"
|
||||
|
||||
if not NOTION_TOKEN or not NOTION_DATABASE_ID:
|
||||
print("请设置 NOTION_TOKEN 和 NOTION_DATABASE_ID 环境变量。")
|
||||
exit()
|
||||
|
||||
# 初始化 Notion 客户端
|
||||
notion = Client(auth=NOTION_TOKEN)
|
||||
|
||||
def add_record_to_notion_database(url):
|
||||
"""
|
||||
向 Notion 数据库插入一条新记录。
|
||||
|
||||
"""
|
||||
current_datetime = datetime.now()
|
||||
formatted_datetime = current_datetime.strftime("%Y-%m-%d %H:%M:%S")
|
||||
|
||||
try:
|
||||
new_page = notion.pages.create(
|
||||
parent={"database_id": NOTION_DATABASE_ID},
|
||||
properties={
|
||||
"更新时间": {
|
||||
"title": [
|
||||
{
|
||||
"text": {"content": formatted_datetime}
|
||||
}
|
||||
]
|
||||
},
|
||||
"地址": {
|
||||
"url": url # <<--- 传递一个简单的 URL 字符串
|
||||
}
|
||||
# 根据你的数据库结构添加更多属性
|
||||
},
|
||||
)
|
||||
print(f"成功插入记录: {url}")
|
||||
except Exception as e:
|
||||
print(f"插入记录失败: {e}")
|
||||
@ -22,6 +22,7 @@ tqdm
|
||||
psutil
|
||||
alembic
|
||||
SQLAlchemy
|
||||
notion-client
|
||||
|
||||
#non essential dependencies:
|
||||
kornia>=0.7.1
|
||||
|
||||
25
script.sh
25
script.sh
@ -102,3 +102,28 @@ cd /kaggle/ComfyUI
|
||||
cd custom_nodes
|
||||
git clone https://github.com/Vander-Bilt/MyHTMLNode.git
|
||||
cd /kaggle/ComfyUI
|
||||
|
||||
|
||||
REMOTE_PORT="$1"
|
||||
|
||||
# 传入参数1,2... 这样便于扩展,如果以后用了其他的frp,也好调整。
|
||||
|
||||
# frp execution binary only. 这里放frpc执行文件,如果版本有变也好改。配置文件模版,也在项目中, 模版文件名为template_frpc
|
||||
wget -O /kaggle/working/frp_0.54.0_linux_amd64.tar.gz https://github.com/fatedier/frp/releases/download/v0.54.0/frp_0.54.0_linux_amd64.tar.gz
|
||||
tar -xzvf /kaggle/working/frp_0.54.0_linux_amd64.tar.gz -C /kaggle/working
|
||||
cp -p /kaggle/working/frp_0.54.0_linux_amd64/frpc /kaggle/working/frpc
|
||||
cp -p /kaggle/ComfyUI/template_frpc /kaggle/working/frpc.toml
|
||||
|
||||
FRP_CONFIG_FILE="/kaggle/working/frpc.toml"
|
||||
CHOICE="$1"
|
||||
if [ "$CHOICE" -eq 1 ]; then
|
||||
TARGET_REMOTE_PORT="21663"
|
||||
elif [ "$CHOICE" -eq 2 ]; then
|
||||
TARGET_REMOTE_PORT="21664"
|
||||
else
|
||||
echo "Invalid CHOICE: $CHOICE"
|
||||
echo "Only 1 or 2 are supported."
|
||||
exit 1 # 退出并返回错误码
|
||||
fi
|
||||
sed -i "s/^remote_port = .*/remote_port = $TARGET_REMOTE_PORT/" "$FRP_CONFIG_FILE"
|
||||
sleep 2
|
||||
|
||||
11
template_frpc
Normal file
11
template_frpc
Normal file
@ -0,0 +1,11 @@
|
||||
serverAddr = '111.170.148.226'
|
||||
serverPort = 21661
|
||||
auth.method = "token"
|
||||
auth.token = "072083"
|
||||
|
||||
[[proxies]]
|
||||
name = 'web-REMOTE_PORT'
|
||||
type = 'tcp'
|
||||
localIP = '127.0.0.1'
|
||||
localPort = 8188
|
||||
remotePort = REMOTE_PORT
|
||||
Loading…
x
Reference in New Issue
Block a user