Skip to content

Commit 7bea0ff

Browse files
authored
hotfix: use app.ferndocs.com host for chat streaming (#1970)
1 parent d2080ed commit 7bea0ff

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

packages/fern-docs/ui/src/search/SearchV2.tsx

+8-2
Original file line numberDiff line numberDiff line change
@@ -86,8 +86,13 @@ export function SearchV2(): ReactElement | false {
8686
});
8787

8888
const facetApiEndpoint = useApiRoute("/api/fern-docs/search/v2/facet");
89-
const chatEndpoint = useApiRoute("/api/fern-docs/search/v2/chat");
90-
const suggestEndpoint = useApiRoute("/api/fern-docs/search/v2/suggest");
89+
let chatEndpoint = useApiRoute("/api/fern-docs/search/v2/chat");
90+
let suggestEndpoint = useApiRoute("/api/fern-docs/search/v2/suggest");
91+
92+
if (process.env.NODE_ENV === "production") {
93+
chatEndpoint = `https://app.ferndocs.com/api/fern-docs/search/v2/chat`;
94+
suggestEndpoint = `https://app.ferndocs.com/api/fern-docs/search/v2/suggest`;
95+
}
9196

9297
const router = useRouter();
9398

@@ -160,6 +165,7 @@ export function SearchV2(): ReactElement | false {
160165
askAI={askAi}
161166
setAskAI={setAskAi}
162167
api={chatEndpoint}
168+
headers={{ "X-Fern-Host": domain }}
163169
suggestionsApi={suggestEndpoint}
164170
initialInput={initialInput}
165171
setInitialInput={setInitialInput}

0 commit comments

Comments
 (0)