feat: update plugin loading

pull/282/head^2
Zack 1 year ago
parent fd7807507b
commit bd31ec498d

@ -115,17 +115,16 @@ tools_mappings = {
"walmart": "http://127.0.0.1:8079/tools/walmart", "walmart": "http://127.0.0.1:8079/tools/walmart",
} }
# # Load the JSON file data = json.load(open('swarms/tools/openai.json')) # Load the JSON file
# with open('swarms/tools/openai.json', 'r') as f: items = data['items'] # Get the list of items
# data = json.load(f)
# for plugin in data: for plugin in items: # Iterate over items, not data
# url = plugin['manifest']['api']['url'].replace('/.well-known/openapi.yaml', '') url = plugin['manifest']['api']['url']
# tool_name = plugin['namespace'] tool_name = plugin['namespace']
# tools_mappings[tool_name] = url tools_mappings[tool_name] = url[:-len('/.well-known/openai.yaml')]
# valid_tools_info = []
print(tools_mappings)
all_tools_list = [] all_tools_list = []
# print(data)
# print(plugin)
gr.close_all() gr.close_all()
@ -151,6 +150,8 @@ def download_model(model_url: str, memory_utilization: int , model_dir: str):
# Update the dropdown choices with the new available_models list # Update the dropdown choices with the new available_models list
model_chosen.update(choices=available_models) model_chosen.update(choices=available_models)
valid_tools_info = {}
def load_tools(): def load_tools():
global valid_tools_info global valid_tools_info
global all_tools_list global all_tools_list
@ -369,7 +370,6 @@ with gr.Blocks() as demo:
# iface = gr.Interface(fn=serve_iframe, inputs=[], outputs=gr.outputs.HTML()) # iface = gr.Interface(fn=serve_iframe, inputs=[], outputs=gr.outputs.HTML())
iface.launch()
key_set_btn.click(fn=set_environ, inputs=[ key_set_btn.click(fn=set_environ, inputs=[
OPENAI_API_KEY, OPENAI_API_KEY,
WOLFRAMALPH_APP_ID, WOLFRAMALPH_APP_ID,

Loading…
Cancel
Save