Skip to content

Commit

Permalink
get_assistant interface returning also public assistants
Browse files Browse the repository at this point in the history
  • Loading branch information
mkorpela committed Mar 21, 2024
1 parent 3c6ee47 commit fb74091
Showing 1 changed file with 2 additions and 8 deletions.
10 changes: 2 additions & 8 deletions frontend/src/api/assistants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,11 @@ import { Config } from "../hooks/useConfigList";
export async function getAssistant(
assistantId: string,
): Promise<Config | null> {
console.log("HERE", assistantId)
try {
let response = await fetch(`/assistants/${assistantId}`);
const response = await fetch(`/assistants/${assistantId}`);
if (!response.ok) {
// If the first request fails, try the public assistant endpoint
response = await fetch(`/assistants/public/?shared_id=${assistantId}`);
if (!response.ok) {
return null;
}
return null;
}

return (await response.json()) as Config;
} catch (error) {
console.error("Failed to fetch assistant:", error);
Expand Down

0 comments on commit fb74091

Please sign in to comment.