Skip to content

Commit

Permalink
Show results
Browse files Browse the repository at this point in the history
  • Loading branch information
oeway committed Jun 4, 2024
1 parent 7d6e50f commit 63f825e
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
8 changes: 4 additions & 4 deletions bioimageio_chatbot/chatbot.py
Original file line number Diff line number Diff line change
Expand Up @@ -440,11 +440,11 @@ async def ping(context=None):
server_url = server.config["public_base_url"]

service_id = hypha_service_info["id"]
print("=============================\n"
f"To test the BioImage.IO Chatbot locally, visit: {server_url}/chat"
)
print("=============================\n")
if server_url.startswith("http://localhost") or server_url.startswith("http://127.0.0.1"):
print(f"To test the BioImage.IO Chatbot locally, visit: {server_url}/chat")
print(
f"\nOr, you can also visit the public chat client available at: https://bioimage.io/chat?server={server_url}&service_id={service_id}\n"
f"\nThe chat client are available publicly at: https://bioimage.io/chat?server={server_url}&service_id={service_id}\n"
"\n=============================\n"
)

Expand Down
10 changes: 9 additions & 1 deletion bioimageio_chatbot/static/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -1807,14 +1807,22 @@ <h3 class="text-center">Welcome to BioImage.IO Chatbot</h3>

if (detail.kwargs) {
for (let kwarg in detail.kwargs) {
const kwargValue = typeof detail.kwargs[kwarg] === 'string' ? detail.kwargs[kwarg] : JSON.stringify(detail.kwargs[kwarg]);
const kwargValue = typeof detail.kwargs[kwarg] === 'string' ? detail.kwargs[kwarg] : JSON.stringify(detail.kwargs[kwarg], null, 2);
if(kwargValue.includes('\n'))
details += `**- \`${kwarg}\`**:\n\n\`\`\`\n${kwargValue}\n\`\`\`\n\n`;
else
details += `**- \`${kwarg}\`**: \`${kwargValue}\`\n\n`;
}
details += "\n\n";
}

if(detail.result){
const result = typeof detail.result === 'string' ? detail.result : JSON.stringify(detail.result, null, 2);
if(result.includes('\n'))
details += `**Result**:\n\n\`\`\`\n${result}\n\`\`\`\n\n`;
else
details += `**Result**: \`${result}\`\n\n`;
}
}
}
}
Expand Down

0 comments on commit 63f825e

Please sign in to comment.