codeproject / CodeProject.AI-Server

CodeProject.AI Server is a self contained service that software developers can include in, and distribute with, their applications in order to augment their apps with the power of AI.
Other
605 stars 141 forks source link

Feature Request Set Service API Url via env variable #2

Closed scho0ck closed 2 years ago

scho0ck commented 2 years ago

Running SenseAI on a remote Server could we implement a variable to set "Service API Url"

Thanks

ChrisMaunder commented 2 years ago

If CodeProject.AI is running on a remote server you should be able to access the API via http://:5000/v1/...

kars85 commented 2 years ago

If I understand correctly, by default the API field defaults to http://localhost:5000 which is inconvenient to have to set each time the page is loaded/refreshed. An environment variable to set the html to load a defined IP/hostname would be convenient.

image

ChrisMaunder commented 2 years ago

That page is launched by the AI server itself, so "localhost" is the correct location for that window.

I'm assuming what you are looking to do is launch the dashboard from a different machine and have the URL populated automatically. An environment variable on the server won't help a webpage on a different server (different machines) but there's also the issue with a webpage not having access to a system's environment variables.

What we could do is sniff the URL of the dashboard page and use that as the URL for the server (the IPs must be the same given the server is serving the dashboard page)

kars85 commented 2 years ago

That page is launched by the AI server itself, so "localhost" is the correct location for that window.

I'm assuming what you are looking to do is launch the dashboard from a different machine and have the URL populated automatically. An environment variable on the server won't help a webpage on a different server (different machines) but there's also the issue with a webpage not having access to a system's environment variables.

What we could do is sniff the URL of the dashboard page and use that as the URL for the server (the IPs must be the same given the server is serving the dashboard page)

I think that approach would work great. Another option would be to have that field be a saved property. In other words, serve the html up with that field to be have a Set/Configure button and then persistently save that input on the webserver code side

scho0ck commented 2 years ago

With the latest release this seem to be solved

ChrisMaunder commented 2 years ago

Yes, for v1.5.1 this feature has been added.