Skip to content

Commit 350baa2

Browse files
committed
feat(console): add /api prefix support
1 parent df78aff commit 350baa2

File tree

7 files changed

+16
-10
lines changed

7 files changed

+16
-10
lines changed

frontend/playgrounds/studio/app/(llm)/playground/hooks/useChat.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ export const useChat = (): (() => Promise<void>) => {
1515
async function chatCompletions() {
1616
try {
1717
const providerResponse = await fetch(
18-
`${BASE_URL}/v1/providers/${provider}`
18+
`${BASE_URL}/api/v1/providers/${provider}`
1919
);
2020
const providerData = await providerResponse.json();
2121
const apikey = pathOr("", ["provider", "config", "auth", "api_key"])(
@@ -25,7 +25,7 @@ export const useChat = (): (() => Promise<void>) => {
2525
if (!apikey)
2626
return toast.error(`Provide API key for provider - ${provider}`);
2727

28-
const response = await fetch(`${BASE_URL}/v1/chat/completions`, {
28+
const response = await fetch(`${BASE_URL}/api/v1/chat/completions`, {
2929
method: "post",
3030
headers: {
3131
"x-ms-provider": provider,

frontend/playgrounds/studio/app/(llm)/playground/hooks/useLogsFetch.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ export function useLogsFetch() {
99
useEffect(() => {
1010
async function fetchLogs() {
1111
try {
12-
const response = await fetch(`${BASE_URL}/v1/tracking/logs`);
12+
const response = await fetch(`${BASE_URL}/api/v1/tracking/logs`);
1313
const { logs = [] } = await response.json();
1414
setLogs(logs);
1515
} catch (e) {

frontend/playgrounds/studio/app/(llm)/playground/hooks/useModelFetch.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ export function useModelFetch() {
1818
useEffect(() => {
1919
async function fetchModels() {
2020
try {
21-
const response = await fetch(`${BASE_URL}/v1/models`);
21+
const response = await fetch(`${BASE_URL}/api/v1/models`);
2222
const { models } = await response.json();
2323
const fetchedProviders: ModelType[] = Object.keys(models).map(
2424
(key) => ({

frontend/playgrounds/studio/app/(llm)/providers/[providerId]/page.tsx

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ export default function SingleProvider() {
6666
try {
6767
const data = getValues();
6868
const response = await fetch(
69-
`${BASE_URL}/v1/providers/${params.providerId}`,
69+
`${BASE_URL}/api/v1/providers/${params.providerId}`,
7070
{
7171
method: "put",
7272
body: JSON.stringify(data),
@@ -75,7 +75,13 @@ export default function SingleProvider() {
7575
},
7676
}
7777
);
78-
await response.json();
78+
var res = await response.json();
79+
if (!response.ok) {
80+
return toast.error("Something went wrong", {
81+
description: res.message,
82+
});
83+
}
84+
7985
toast.info("Updated", {
8086
description: "Configuration has been updated",
8187
});

frontend/playgrounds/studio/app/(llm)/providers/hooks/useProviderFetch.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ export function useProviderFetch(pname: string) {
1515
useEffect(() => {
1616
async function fetchProvider() {
1717
try {
18-
const response = await fetch(`${BASE_URL}/v1/providers/${pname}`);
18+
const response = await fetch(`${BASE_URL}/api/v1/providers/${pname}`);
1919
const { provider } = await response.json();
2020

2121
setProvider(provider);
@@ -30,7 +30,7 @@ export function useProviderFetch(pname: string) {
3030
async function fetchProviderConfig() {
3131
try {
3232
const response = await fetch(
33-
`${BASE_URL}/v1/providers/${pname}/config`
33+
`${BASE_URL}/api/v1/providers/${pname}/config`
3434
);
3535
const { config } = await response.json();
3636

frontend/playgrounds/studio/app/(llm)/providers/hooks/useProvidersFetch.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ export function useProvidersFetch() {
1414
useEffect(() => {
1515
async function fetchModels() {
1616
try {
17-
const response = await fetch(`${BASE_URL}/v1/providers`);
17+
const response = await fetch(`${BASE_URL}/api/v1/providers`);
1818
const { providers } = await response.json();
1919

2020
setProviders(providers);

frontend/playgrounds/studio/tailwind.config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ const config = {
55
content: [
66
"./app/**/*.{js,ts,jsx,tsx}",
77
"./components/**/*.{js,ts,jsx,tsx}",
8-
"../../packages/ui/**/*.{js,ts,jsx,tsx}",
8+
"../../node_modules/@missingstudio/ui/**/*.{js,ts,jsx,tsx}",
99
],
1010
prefix: "",
1111
theme: {

0 commit comments

Comments
 (0)