"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.createServer = createServer;
const express_1 = __importDefault(require("express"));
const path_1 = __importDefault(require("path"));
const account_manager_1 = require("./accounts/account-manager");
const openai_compat_1 = require("./proxy/openai-compat");
function createServer(port = 20129) {
    const app = (0, express_1.default)();
    const accountManager = new account_manager_1.AccountManager();
    const proxy = new openai_compat_1.OpenAICompatibleProxy(accountManager, port);
    const webDistPath = path_1.default.join(__dirname, '../web/dist');
    app.use(express_1.default.static(webDistPath));
    app.get('/api/accounts', (req, res) => {
        res.json(accountManager.listAccounts());
    });
    app.get('/api/status', (req, res) => {
        res.json({ status: 'running', port });
    });
    return { app, proxy };
}
//# sourceMappingURL=server.js.map