Hi all,
looking for some advice. I’ve successfully build an extension to use Ollama-hosted LLMs. It works in that system prompt / user message are passed in via a table and the node runs inference with a local LLM and outputs the original table with an added column “Answer”.
I’ve started developing a second node that should allow the user to “Chat” with an Ollama hosted LLM.
I already managed to get working that on node execution a subprocess is spun up which runs a flask-based chat interface build using Googles MESOP and the interface can be accessed if the right URL:Port is put into one’s browser.
In a perfect world I want to access and show that in the node view.
So I have tried:
- to generate basic html and pass it to knext.view_html():
html = f"""
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Chat Application</title>
</head>
<body>
<iframe src="http://localhost:5000/chat" width="100%" height="600px"></iframe>
</body>
</html>
"""
return knext.view_html(html)
==> results in:
(Uncaught TypeError: Cannot assign to read only property '__read' of object '[object Window]'
)
- As backup option I tried to generate html with a clickable link:
html = f"""
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Chat Application</title>
</head>
<body>
<p>Click the link below to open the chat application in your browser:</p>
<a href="http://localhost:32123/chat" target="_blank">Open Chat Application</a>
</body>
</html>
"""
return knext.view_html(html)
==> getting error:
ERROR CEFNodeView Blocked opening ‘http://localhost:32123/chat’ in a new window because the request was made in a sandboxed frame whose ‘allow-popups’ permission is not set.
So right now only the undesired backup option 3 works, where the view just shows a message including the URL that needs to be copy & pasted into a browser…
Question: Any ideas on how to resolve the errors (honestly at this stage I assume that what I am doing is not meant to be done…). Any alternative ideas? Or is this in general just a bad idea? :-).
6 posts - 2 participants