You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
24 lines
972 B
24 lines
972 B
# 将手动保存的操作符, 输出为可以直接在提示词使用的格式
|
|
# 操作符不用爬虫, 因为只有一页, 直接在网页复制
|
|
|
|
import json
|
|
import os
|
|
|
|
current_dir = os.path.dirname(os.path.abspath(__file__))
|
|
opreator_file = os.path.join(current_dir, 'operators.json')
|
|
|
|
with open(opreator_file, 'r') as f:
|
|
optrators = json.load(f)
|
|
|
|
optput = ""
|
|
|
|
for optrator in optrators:
|
|
name = optrator.get("name").replace("\n", "").replace("\r", "")
|
|
description = optrator.get("description").replace("\n", "").replace("\r", "")
|
|
category = optrator.get("category").replace("\n", "").replace("\r", "")
|
|
definition = optrator.get("definition").replace("\n", "").replace("\r", "")
|
|
optput += f"name: {name}\ndescription: {description}\ncategory:{category}\ndefinition:{definition}\n\n"
|
|
# print(f"name: {name}\ndescription: {description}\ncategory:{category}\ndefinition:{definition}\n")
|
|
|
|
with open("operators.txt", "w") as f:
|
|
f.write(optput) |