Skip to content

Commit

Permalink
fix /api/models cache never invalidated
Browse files Browse the repository at this point in the history
  • Loading branch information
yoziru committed May 3, 2024
1 parent 831d1aa commit 91ce631
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 8 deletions.
5 changes: 4 additions & 1 deletion src/app/api/models/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,10 @@ export async function GET(req: NextRequest): Promise<NextResponse> {
headers.set("Authorization", `Bearer ${apiKey}`);
headers.set("api-key", apiKey);
}
const res = await fetch(`${baseUrl}/v1/models`, { headers });
const res = await fetch(`${baseUrl}/v1/models`, {
headers: headers,
cache: "no-store",
});
if (res.status !== 200) {
const statusText = res.statusText;
const responseBody = await res.text();
Expand Down
8 changes: 1 addition & 7 deletions src/components/chat/chat-topbar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -51,13 +51,7 @@ export default function ChatTopbar({
return null;
}
try {
const res = await fetch(basePath + "/api/models", {
method: "GET",
headers: {
"Content-Type": "application/json",
"cache-control": "no-cache",
},
});
const res = await fetch(basePath + "/api/models");

if (!res.ok) {
const errorResponse = await res.json();
Expand Down

0 comments on commit 91ce631

Please sign in to comment.