gptscript-ai / gptscript

Build AI assistants that interact with your systems
https://gptscript.ai
Apache License 2.0
3.07k stars 270 forks source link

feat: add standalone mode to SDKServer and server options #835

Closed rinor closed 1 month ago

rinor commented 2 months ago

Added a new Standalone boolean field to the SDKServer and Options structs to support running the server in standalone mode. Updated the server run logic to conditionally skip the stdin read hack when in standalone mode.

Why: because I need to run a single instance of the server on my own, but the hack prevents the server to start in environments where stdin is 'closed' (reading returns EOF immediately), ie:

$ gptscript sys.sdkserver --listen-address=0.0.0.0:9090  < /dev/null
[::]:9090
08:23:24 Shutting down server
08:23:24 Server stopped