| import { getMachineId } from "@/shared/utils/machine";
|
|
|
|
|
| export function getCloudUrl(machineId) {
|
|
|
| const cloudUrl = process.env.NEXT_PUBLIC_CLOUD_URL || "http://localhost:8787";
|
| return `${cloudUrl}/${machineId}/v1/chat/completions`;
|
| }
|
|
|
|
|
| export async function callCloudWithMachineId(request) {
|
| const machineId = await getMachineId();
|
| if (!machineId) {
|
| throw new Error("Could not get machine ID");
|
| }
|
|
|
| const cloudUrl = getCloudUrl(machineId);
|
|
|
|
|
| const body = await request.json();
|
| const headers = new Headers(request.headers);
|
|
|
|
|
| headers.delete("authorization");
|
|
|
|
|
| const response = await fetch(cloudUrl, {
|
| method: "POST",
|
| headers: headers,
|
| body: JSON.stringify(body),
|
| });
|
|
|
| return response;
|
| }
|
|
|
|
|
| export function startProviderSync(cloudUrl, intervalMs = 900000) {
|
|
|
| console.log("Frontend sync is disabled. Use backend sync instead.");
|
| return null;
|
| }
|
|
|