26 lines
959 B
GDScript
26 lines
959 B
GDScript
class_name ProxyConfig
|
|
extends RefCounted
|
|
## The client's one piece of network config: the proxy base URL. Never a key,
|
|
## never a model name (charter §4). Overridable per environment via project
|
|
## settings; defaults to the dev proxy.
|
|
|
|
const SETTING := "coc_rpg/proxy_base_url"
|
|
const DEFAULT := "http://localhost:8000"
|
|
|
|
const TIMEOUT_SETTING := "coc_rpg/proxy_request_timeout_seconds"
|
|
const TIMEOUT_DEFAULT := 35.0
|
|
|
|
|
|
static func base_url() -> String:
|
|
var v = ProjectSettings.get_setting(SETTING, DEFAULT)
|
|
var s := str(v)
|
|
return s if s != "" else DEFAULT
|
|
|
|
|
|
static func request_timeout_seconds() -> float:
|
|
# Just above the server's OLLAMA_TIMEOUT_SECONDS (30) so a slow model surfaces
|
|
# the server's own error first, while a fully-hung proxy is still bounded. A
|
|
# non-positive value would re-enable the infinite hang, so reject it.
|
|
var v := float(ProjectSettings.get_setting(TIMEOUT_SETTING, TIMEOUT_DEFAULT))
|
|
return v if v > 0.0 else TIMEOUT_DEFAULT
|