Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion static/js/agent-detail.js
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ async function fetchAgentData(agentId) {
const timeoutId = setTimeout(() => controller.abort(), 195000); // 15 segundos

try {
const response = await fetch('https://softwareai-library-hub.rshare.io/api/agents', {
const response = await fetch('https://www.softwareai-library-hub.site/api/agents', {
signal: controller.signal,
});

Expand Down
4 changes: 2 additions & 2 deletions static/js/list-tools.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ function copiarTexto(texto, botao) {
});
}
async function carregarFerramentas() {
const resposta = await fetch('https://softwareai-library-hub.rshare.io/api/list-tools');
const resposta = await fetch('https://www.softwareai-library-hub.site/api/list-tools');
const ferramentas = await resposta.json();
window.allTools = ferramentas;
renderTools(ferramentas);
Expand All @@ -53,7 +53,7 @@ function renderTools(tools) {

const pythonCodewithApi_import_libs = `import requests\nimport yaml\nimport os\nimport json\nimport zipfile\nimport importlib`;

const pythonCodewithApi_download_tools_with_api = `def download_tools_zip(tool_ids: list, output_path: str = 'tools_code.zip', base_url: str = 'https://softwareai-library-hub.rshare.io') -> bool:\n joined_ids = ','.join(tool_ids)\n url = f'{base_url}/api/tool-code/{joined_ids}'\n try:\n response = requests.get(url)\n if response.status_code == 200:\n with open(output_path, 'wb') as f:\n f.write(response.content)\n print(f\"ZIP baixado com sucesso: {output_path}\")\n extract_dir = os.path.join(os.path.dirname(__file__), 'Functions')\n os.makedirs(extract_dir, exist_ok=True)\n with zipfile.ZipFile(output_path, 'r') as zip_ref:\n zip_ref.extractall(extract_dir)\n print(f\"Arquivos extraídos para: {extract_dir}\")\n return True\n else:\n print(f\"Erro {response.status_code}: {response.json()}\")\n return False\n except Exception as e:\n print(f\"Erro durante o download ou extração: {e}\")\n return False`;
const pythonCodewithApi_download_tools_with_api = `def download_tools_zip(tool_ids: list, output_path: str = 'tools_code.zip', base_url: str = 'https://www.softwareai-library-hub.site') -> bool:\n joined_ids = ','.join(tool_ids)\n url = f'{base_url}/api/tool-code/{joined_ids}'\n try:\n response = requests.get(url)\n if response.status_code == 200:\n with open(output_path, 'wb') as f:\n f.write(response.content)\n print(f\"ZIP baixado com sucesso: {output_path}\")\n extract_dir = os.path.join(os.path.dirname(__file__), 'Functions')\n os.makedirs(extract_dir, exist_ok=True)\n with zipfile.ZipFile(output_path, 'r') as zip_ref:\n zip_ref.extractall(extract_dir)\n print(f\"Arquivos extraídos para: {extract_dir}\")\n return True\n else:\n print(f\"Erro {response.status_code}: {response.json()}\")\n return False\n except Exception as e:\n print(f\"Erro durante o download ou extração: {e}\")\n return False`;

const pythonCodewithApi_import_tool = `def import_tool(tool_name: str, base_dir: str = 'Functions'):\n module_path = os.path.join(base_dir, tool_name, f\"{tool_name}.py\")\n spec = importlib.util.spec_from_file_location(tool_name, module_path)\n if spec and spec.loader:\n module = importlib.util.module_from_spec(spec)\n spec.loader.exec_module(module)\n for attr_name in dir(module):\n attr = getattr(module, attr_name)\n if hasattr(attr, \"name\") and hasattr(attr, \"description\"):\n return attr\n raise ImportError(f\"Nenhuma função decorada com @function_tool encontrada em {tool_name}.py\")\n else:\n raise ImportError(f\"Não foi possível importar a ferramenta: {tool_name}\")`;

Expand Down
2 changes: 1 addition & 1 deletion static/js/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ async function fetchAgents() {
`;


const response = await fetch('https://softwareai-library-hub.rshare.io/api/agents');
const response = await fetch('https://www.softwareai-library-hub.site/api/agents');
if (!response.ok) {
throw new Error('Failed to fetch agents');
}
Expand Down
4 changes: 2 additions & 2 deletions static/js/tool_detail.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ document.addEventListener("DOMContentLoaded", async function() {

const toolId = typeof TOOL_ID !== "undefined" ? TOOL_ID : null;
console.log("toolId =", toolId);
const response = await fetch("https://softwareai-library-hub.rshare.io/api/list-tools");
const response = await fetch("https://www.softwareai-library-hub.site/api/list-tools");
const allTools = await response.json();
const tool = allTools.find(t => t.id === toolId);
console.log(`tool ${tool}`);
Expand All @@ -85,7 +85,7 @@ document.addEventListener("DOMContentLoaded", async function() {
document.getElementById("tool-description").textContent = `Purpose of the tool: ${tool.fullDescription}`;

// Carregar metadata antes do clique
const metaResp = await fetch(`https://softwareai-library-hub.rshare.io/api/tool-metadata/${toolId}`);
const metaResp = await fetch(`https://www.softwareai-library-hub.site/api/tool-metadata/${toolId}`);
const metadata = await metaResp.json();
console.info(metadata);
console.info(metadata.code);
Expand Down