Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make localhost use localhost for ai #2363

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions src/lib/sockets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,13 @@ if (
// if we're developing locally but connecting to the production system, use our local system for estimation
ai_host = `http://localhost:13284`;
console.log("AI Host set to: ", ai_host);
} else if (process.env.OGS_BACKEND === "LOCAL") {
// if we're a developer using a local server, then use it for ai
ai_host = "http://localhost:13284";
} else if (
// The CI doesn't work with beta. Note that jest in the CI has NODE_ENV==="test".
// the .org exception is for anoek's development environment
// This logic causes web developers who are _not_ using a local server to use Beta for AI.
(process.env.NODE_ENV === "development" && window.location.hostname.indexOf(".org") < 0) ||
window.location.hostname.indexOf("beta") >= 0 ||
window.location.hostname.indexOf("dev") >= 0
Expand All @@ -42,8 +46,8 @@ if (
ai_host = "https://ai.online-go.com";
} else if (window.location.hostname.indexOf("ogs") >= 0) {
ai_host = `${window.location.protocol}//ai-${window.location.hostname}`;
} else if (window.location.hostname === "localhost") {
// automated test code stubs in localhost, no need to connect to the AI or warn
} else if (process.env.NODE_ENV === "test") {
// don't set ai host because we dont use it in tests (stubbed)
} else {
console.warn("AI Host not set, AI reviews will not work", window.location.hostname);
}
Expand Down
Loading