Skip to content

Commit

Permalink
Add support for self hosted web (#311)
Browse files Browse the repository at this point in the history
  • Loading branch information
langchain-infra authored Nov 30, 2023
2 parents 309f9d9 + 9d501d0 commit 60edd3f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
3 changes: 3 additions & 0 deletions js/src/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,9 @@ export class Client {
} else if (isLocalhost(this.apiUrl)) {
this.webUrl = "http://localhost";
return "http://localhost";
} else if (this.apiUrl.includes("/api")) {
this.webUrl = this.apiUrl.replace("/api", "");
return this.webUrl;
} else if (this.apiUrl.split(".", 1)[0].includes("dev")) {
this.webUrl = "https://dev.smith.langchain.com";
return "https://dev.smith.langchain.com";
Expand Down
2 changes: 2 additions & 0 deletions python/langsmith/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -318,6 +318,8 @@ def _host_url(self) -> str:
link = self._web_url
elif _is_localhost(self.api_url):
link = "http://localhost"
elif "/api" in self.api_url:
link = self.api_url.replace("/api", "")
elif "dev" in self.api_url.split(".", maxsplit=1)[0]:
link = "https://dev.smith.langchain.com"
else:
Expand Down

0 comments on commit 60edd3f

Please sign in to comment.