feat: OpenAI compatibility improvements & build fixes

- Fix hydration mismatches and initialization errors
- Add /v1/models endpoint for OpenAI clients
- Add Codex response translator (Responses → OpenAI)
- Fix circular dependencies and PropTypes
- Add Material Symbols font and CSS fixes
- Update README with deployment guide

Co-merged from PR #18 (14/15 commits, skipped debug)
This commit is contained in:
decolua
2026-01-20 13:16:34 +07:00
parent 0848dd5d13
commit d9b8e48725
15 changed files with 761 additions and 170 deletions
@@ -1,6 +1,7 @@
"use client";
import { useState, useEffect } from "react";
import PropTypes from "prop-types";
import { Card, Button, Input, Modal, CardSkeleton } from "@/shared/components";
import { useCopyToClipboard } from "@/shared/hooks/useCopyToClipboard";
@@ -198,10 +199,16 @@ export default function APIPageClient({ machineId }) {
}
};
const baseUrl = typeof window !== "undefined" ? `${window.location.origin}/v1` : "/v1";
// New format: /v1 (machineId in key), Old format: /{machineId}/v1
const [baseUrl, setBaseUrl] = useState("/v1");
const cloudEndpointNew = `${CLOUD_URL}/v1`;
// Hydration fix: Only access window on client side
useEffect(() => {
if (typeof window !== "undefined") {
setBaseUrl(`${window.location.origin}/v1`);
}
}, []);
if (loading) {
return (
<div className="flex flex-col gap-8">
@@ -601,5 +608,5 @@ export default function APIPageClient({ machineId }) {
}
APIPageClient.propTypes = {
machineId: import("prop-types").string.isRequired,
machineId: PropTypes.string.isRequired,
};