From df8de787c0bce0a888064eaf920287e34c85e929 Mon Sep 17 00:00:00 2001 From: Gitea Date: Tue, 26 May 2026 12:00:42 +0530 Subject: [PATCH] first --- .env | 2 + controller/handleOrchestration.js | 288 +++++++++++++++------ index.html | 79 ++++++ package-lock.json | 407 +++++++++++++++++++++++++++++- package.json | 5 +- 5 files changed, 708 insertions(+), 73 deletions(-) create mode 100644 .env create mode 100644 index.html diff --git a/.env b/.env new file mode 100644 index 0000000..f369e31 --- /dev/null +++ b/.env @@ -0,0 +1,2 @@ +GOOGLE_API_KEY=АlzaSyBFGЗDLQnaPХ8H413uztWT9Tzcg_yCTNTk +AZURE_OPENAI_KEY=o20WLCQfubbGTo0SnkS70lefG0tHvdZlzcUGHOPDmww0igy94Up0JQQJ99CEAC77bzfXJ3w3AAAAACOGIUYb \ No newline at end of file diff --git a/controller/handleOrchestration.js b/controller/handleOrchestration.js index 21fe179..070f63a 100644 --- a/controller/handleOrchestration.js +++ b/controller/handleOrchestration.js @@ -1,87 +1,233 @@ const axios = require('axios'); -const { GoogleGenerativeAI } = require('@google/generative-ai'); -const ai = new GoogleGenerativeAI({ apiKey: process.env.GEMINI_API_KEY }); +require('dotenv').config(); +const { OpenAI } = require('openai'); + +// 1. FIX: Format base endpoint to match standard Azure OpenAI layout +const azureEndpoint = "https://cpmindiayoda-resource.services.ai.azure.com"; +const deploymentName = "gpt-4o-mini"; +const apiVersion = "2024-08-01-preview"; // Mandatory query param for Azure endpoints + +// Configure the SDK compatibility routing +const client = new OpenAI({ + baseURL: `${azureEndpoint}/openai/deployments/${deploymentName}`, + apiKey: process.env.AZURE_OPENAI_KEY, + defaultHeaders: { 'api-key': process.env.AZURE_OPENAI_KEY }, + // Inject the required api-version parameter into every request automatically + defaultQuery: { 'api-version': apiVersion } +}); + +console.log('Azure OpenAI Client Initialized with Deployment:', deploymentName); const fetchWrenData = async (prompt, tenantId) => { - try { - const url = process.env.WREN_AI_URL || 'http://localhost:5555/api/v1/text-to-sql'; - - const response = await axios.post(url, - { prompt: prompt }, - { - headers: { - - 'X-Wren-Session-Properties': `@user_org_id=${tenantId}`, - 'Content-Type': 'application/json' - } - } - ); - return response.data; - } catch (error) { - console.error('Wren AI Integration Error:', error.message); - throw new Error('Failed to fetch data payload from Wren AI endpoint'); - } + try { + return { + question: "Monthly revenue share across electronics product categories", + sql: ` + SELECT product_category, SUM(revenue) AS total_revenue, order_month + FROM sales_pipeline + WHERE order_year = 2026 + GROUP BY product_category, order_month + ORDER BY order_month ASC, total_revenue DESC; + `, + data: [ + { product_category: "Smartphones", total_revenue: 145000, order_month: "January" }, + { product_category: "Laptops", total_revenue: 210000, order_month: "January" }, + { product_category: "Audio Wearables", total_revenue: 65000, order_month: "January" }, + { product_category: "Smartphones", total_revenue: 160000, order_month: "February" }, + { product_category: "Laptops", total_revenue: 195000, order_month: "February" }, + { product_category: "Audio Wearables", total_revenue: 85000, order_month: "February" } + ] + }; + } catch (error) { + console.error('Wren AI Integration Error:', error.message); + throw new Error('Failed to fetch data payload from Wren AI endpoint'); + } }; + const generateVegaSchema = async (question, dataArray) => { - try { - const model = ai.getGenerativeModel({ - model: 'gemini-2.5-flash', - generationConfig: { responseMimeType: 'application/json' } - }); + try { + const systemPrompt = `You are a data visualization expert. I will provide a user's question and a JSON array of data. Your task is to generate a strictly valid Vega-Lite JSON specification to visualize this data. The data array will be provided to the Vega spec internally. Map the JSON keys to the correct x, y, and color axes. Choose the best chart type (bar, line, arc) based on the question.`; + const userPrompt = `User Question: "${question}"\nData JSON: ${JSON.stringify(dataArray)}`; + const completion = await client.chat.completions.create({ + model: '', + messages: [ + { role: 'system', content: systemPrompt }, + { role: 'user', content: userPrompt } + ], + response_format: { type: "json_object" } + }); - const systemPrompt = `You are a data visualization expert. I will provide a user's question and a JSON array of data. - Your task is to generate a strictly valid Vega-Lite JSON specification to visualize this data. - The data array will be provided to the Vega spec internally. Map the JSON keys to the correct x, y, and color axes. - Choose the best chart type (bar, line, arc) based on the question.`; + const rawText = completion.choices[0].message.content.trim(); + return JSON.parse(rawText); - const userPrompt = `User Question: "${question}"\nData JSON: ${JSON.stringify(dataArray)}`; - - const result = await model.generateContent({ - contents: [{ role: 'user', parts: [{ text: `${systemPrompt}\n\n${userPrompt}` }] }] - }); - - return JSON.parse(result.response.text()); - } catch (error) { - console.error('Gemini Engine Error:', error.message); - throw new Error('Failed to transform data architecture into valid Vega-Lite spec'); - } + } catch (error) { + console.error('Azure OpenAI Engine Error:', error.message); + throw new Error('Failed to transform data architecture into valid Vega-Lite spec'); + } }; - const handleOrchestration = async (req, res) => { - try { - const { prompt } = req.body; + try { + const { prompt } = req.body; + const tenant_id = req.user ? req.user.client_id : null; - - const tenant_id = req.user ? req.user.client_id : null; - return res.status(200).json("ok"); - - if (!prompt) { - return res.status(400).json({ error: 'Prompt field is required in request body' }); - } - if (!tenant_id) { - return res.status(400).json({ error: 'Tenant context (client_id) missing from auth token' }); - } - - - const wrenData = await fetchWrenData(prompt, tenant_id); - - - const vegaSchema = await generateVegaSchema(prompt, wrenData); - - - if (!vegaSchema || !vegaSchema.$schema) { - return res.status(500).json({ error: 'Egress Pipeline Validation Failure: Output missing standard Vega $schema identifier' }); - } - - - return res.status(200).json(vegaSchema); - - } catch (error) { - console.error('API Gateway Orchestrator Crash:', error.message); - return res.status(500).json({ error: error.message }); + if (!prompt) { + return res.status(400).json({ error: 'Prompt field is required in request body' }); } + if (!tenant_id) { + return res.status(400).json({ error: 'Tenant context (client_id) missing from auth token' }); + } + + const wrenData = await fetchWrenData(prompt, tenant_id); + const vegaSchema = await generateVegaSchema(wrenData.question, wrenData.data); + + if (!vegaSchema || !vegaSchema.$schema) { + return res.status(500).json({ error: 'Egress Pipeline Validation Failure: Output missing standard Vega $schema identifier' }); + } + + return res.status(200).json(vegaSchema); + + } catch (error) { + console.error('API Gateway Orchestrator Crash:', error.message); + return res.status(500).json({ error: error.message }); + } }; module.exports = { handleOrchestration }; + + + + + +// const axios = require('axios'); +// const dotenv = require('dotenv'); +// dotenv.config(); +// const { GoogleGenerativeAI } = require('@google/generative-ai'); +// const ai = new GoogleGenerativeAI({ apiKey: process.env.GOOGLE_API_KEY }); +// console.log('Gemini API Key Loaded:', process.env.GOOGLE_API_KEY); + + + + +// const fetchWrenData = async (prompt, tenantId) => { +// try { + +// return { +// question: "Top sales person this month", + +// sql: ` +// SELECT sales_person, +// SUM(amount) AS total_sales +// FROM orders +// WHERE MONTH(created_at)=MONTH(CURRENT_DATE) +// GROUP BY sales_person +// ORDER BY total_sales DESC +// LIMIT 10; +// `, + +// data: [ +// { +// sales_person: "Rahul", +// total_sales: 92000 +// }, +// { +// sales_person: "Amit", +// total_sales: 87000 +// } +// ] +// }; + +// } catch (error) { + +// console.error('Wren AI Integration Error:', error.message); + +// throw new Error('Failed to fetch data payload from Wren AI endpoint'); +// } +// }; + +// const generateVegaSchema = async (question, dataArray) => { +// try { +// const model = ai.getGenerativeModel({ +// model: 'gemini-2.5-flash', +// generationConfig: { responseMimeType: 'application/json' } +// }); + +// const systemPrompt = `You are a data visualization expert. I will provide a user's question and a JSON array of data. +// Your task is to generate a strictly valid Vega-Lite JSON specification to visualize this data. +// The data array will be provided to the Vega spec internally. Map the JSON keys to the correct x, y, and color axes. +// Choose the best chart type (bar, line, arc) based on the question.`; + +// const userPrompt = `User Question: "${question}"\nData JSON: ${JSON.stringify(dataArray)}`; + +// const result = await model.generateContent({ +// contents: [{ role: 'user', parts: [{ text: `${systemPrompt}\n\n${userPrompt}` }] }] +// }); + +// return JSON.parse(result.response.text()); +// } catch (error) { +// console.error('Gemini Engine Error:', error.message); +// throw new Error('Failed to transform data architecture into valid Vega-Lite spec'); +// } +// }; + + +// const handleOrchestration = async (req, res) => { +// try { +// const { prompt } = req.body; + + +// const tenant_id = req.user ? req.user.client_id : null; +// // return res.status(200).json("ok"); + +// if (!prompt) { +// return res.status(400).json({ error: 'Prompt field is required in request body' }); +// } +// if (!tenant_id) { +// return res.status(400).json({ error: 'Tenant context (client_id) missing from auth token' }); +// } + + +// const wrenData = await fetchWrenData(prompt, tenant_id); + + +// const vegaSchema = await generateVegaSchema(prompt, wrenData); + + +// if (!vegaSchema || !vegaSchema.$schema) { +// return res.status(500).json({ error: 'Egress Pipeline Validation Failure: Output missing standard Vega $schema identifier' }); +// } + + +// return res.status(200).json(vegaSchema); + +// } catch (error) { +// console.error('API Gateway Orchestrator Crash:', error.message); +// return res.status(500).json({ error: error.message }); +// } +// }; + +// module.exports = { handleOrchestration }; + + + +// const fetchWrenData = async (prompt, tenantId) => { +// try { +// const url = process.env.WREN_AI_URL || 'http://localhost:5555/api/v1/text-to-sql'; + +// const response = await axios.post(url, +// { prompt: prompt }, +// { +// headers: { + +// 'X-Wren-Session-Properties': `@user_org_id=${tenantId}`, +// 'Content-Type': 'application/json' +// } +// } +// ); +// return response.data; +// } catch (error) { +// console.error('Wren AI Integration Error:', error.message); +// throw new Error('Failed to fetch data payload from Wren AI endpoint'); +// } +// }; \ No newline at end of file diff --git a/index.html b/index.html new file mode 100644 index 0000000..0afc578 --- /dev/null +++ b/index.html @@ -0,0 +1,79 @@ + + + + + + Fixed Vega-Lite Revenue Share Chart + + + + + + + + + +
+ + + + diff --git a/package-lock.json b/package-lock.json index 2109d4b..36ae581 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9,13 +9,173 @@ "version": "1.0.0", "license": "ISC", "dependencies": { + "@azure/identity": "^4.13.1", "@clickhouse/client": "^1.18.5", "@google/generative-ai": "^0.24.1", "axios": "^1.16.1", "cors": "^2.8.6", + "dotenv": "^17.4.2", "express": "^5.2.1", "jsonwebtoken": "^9.0.3", - "nodemon": "^3.1.14" + "nodemon": "^3.1.14", + "openai": "^6.39.0" + } + }, + "node_modules/@azure/abort-controller": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/@azure/abort-controller/-/abort-controller-2.1.2.tgz", + "integrity": "sha512-nBrLsEWm4J2u5LpAPjxADTlq3trDgVZZXHNKabeXZtpq3d3AbN/KGO82R87rdDz5/lYB024rtEf10/q0urNgsA==", + "license": "MIT", + "dependencies": { + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=18.0.0" + } + }, + "node_modules/@azure/core-auth": { + "version": "1.10.1", + "resolved": "https://registry.npmjs.org/@azure/core-auth/-/core-auth-1.10.1.tgz", + "integrity": "sha512-ykRMW8PjVAn+RS6ww5cmK9U2CyH9p4Q88YJwvUslfuMmN98w/2rdGRLPqJYObapBCdzBVeDgYWdJnFPFb7qzpg==", + "license": "MIT", + "dependencies": { + "@azure/abort-controller": "^2.1.2", + "@azure/core-util": "^1.13.0", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=20.0.0" + } + }, + "node_modules/@azure/core-client": { + "version": "1.10.1", + "resolved": "https://registry.npmjs.org/@azure/core-client/-/core-client-1.10.1.tgz", + "integrity": "sha512-Nh5PhEOeY6PrnxNPsEHRr9eimxLwgLlpmguQaHKBinFYA/RU9+kOYVOQqOrTsCL+KSxrLLl1gD8Dk5BFW/7l/w==", + "license": "MIT", + "dependencies": { + "@azure/abort-controller": "^2.1.2", + "@azure/core-auth": "^1.10.0", + "@azure/core-rest-pipeline": "^1.22.0", + "@azure/core-tracing": "^1.3.0", + "@azure/core-util": "^1.13.0", + "@azure/logger": "^1.3.0", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=20.0.0" + } + }, + "node_modules/@azure/core-rest-pipeline": { + "version": "1.23.0", + "resolved": "https://registry.npmjs.org/@azure/core-rest-pipeline/-/core-rest-pipeline-1.23.0.tgz", + "integrity": "sha512-Evs1INHo+jUjwHi1T6SG6Ua/LHOQBCLuKEEE6efIpt4ZOoNonaT1kP32GoOcdNDbfqsD2445CPri3MubBy5DEQ==", + "license": "MIT", + "dependencies": { + "@azure/abort-controller": "^2.1.2", + "@azure/core-auth": "^1.10.0", + "@azure/core-tracing": "^1.3.0", + "@azure/core-util": "^1.13.0", + "@azure/logger": "^1.3.0", + "@typespec/ts-http-runtime": "^0.3.4", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=20.0.0" + } + }, + "node_modules/@azure/core-tracing": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/@azure/core-tracing/-/core-tracing-1.3.1.tgz", + "integrity": "sha512-9MWKevR7Hz8kNzzPLfX4EAtGM2b8mr50HPDBvio96bURP/9C+HjdH3sBlLSNNrvRAr5/k/svoH457gB5IKpmwQ==", + "license": "MIT", + "dependencies": { + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=20.0.0" + } + }, + "node_modules/@azure/core-util": { + "version": "1.13.1", + "resolved": "https://registry.npmjs.org/@azure/core-util/-/core-util-1.13.1.tgz", + "integrity": "sha512-XPArKLzsvl0Hf0CaGyKHUyVgF7oDnhKoP85Xv6M4StF/1AhfORhZudHtOyf2s+FcbuQ9dPRAjB8J2KvRRMUK2A==", + "license": "MIT", + "dependencies": { + "@azure/abort-controller": "^2.1.2", + "@typespec/ts-http-runtime": "^0.3.0", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=20.0.0" + } + }, + "node_modules/@azure/identity": { + "version": "4.13.1", + "resolved": "https://registry.npmjs.org/@azure/identity/-/identity-4.13.1.tgz", + "integrity": "sha512-5C/2WD5Vb1lHnZS16dNQRPMjN6oV/Upba+C9nBIs15PmOi6A3ZGs4Lr2u60zw4S04gi+u3cEXiqTVP7M4Pz3kw==", + "license": "MIT", + "dependencies": { + "@azure/abort-controller": "^2.0.0", + "@azure/core-auth": "^1.9.0", + "@azure/core-client": "^1.9.2", + "@azure/core-rest-pipeline": "^1.17.0", + "@azure/core-tracing": "^1.0.0", + "@azure/core-util": "^1.11.0", + "@azure/logger": "^1.0.0", + "@azure/msal-browser": "^5.5.0", + "@azure/msal-node": "^5.1.0", + "open": "^10.1.0", + "tslib": "^2.2.0" + }, + "engines": { + "node": ">=20.0.0" + } + }, + "node_modules/@azure/logger": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/@azure/logger/-/logger-1.3.0.tgz", + "integrity": "sha512-fCqPIfOcLE+CGqGPd66c8bZpwAji98tZ4JI9i/mlTNTlsIWslCfpg48s/ypyLxZTump5sypjrKn2/kY7q8oAbA==", + "license": "MIT", + "dependencies": { + "@typespec/ts-http-runtime": "^0.3.0", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=20.0.0" + } + }, + "node_modules/@azure/msal-browser": { + "version": "5.11.0", + "resolved": "https://registry.npmjs.org/@azure/msal-browser/-/msal-browser-5.11.0.tgz", + "integrity": "sha512-zkGNYS3TwY8lUpPIafAmsFCYZbgFixY9y/LZB9GUg0IILoHTqpN26j5OrkL1AQThh/YdZsawe4iWXfp85lFVxg==", + "license": "MIT", + "dependencies": { + "@azure/msal-common": "16.6.2" + }, + "engines": { + "node": ">=0.8.0" + } + }, + "node_modules/@azure/msal-common": { + "version": "16.6.2", + "resolved": "https://registry.npmjs.org/@azure/msal-common/-/msal-common-16.6.2.tgz", + "integrity": "sha512-hQjjsekAjB00cM1EmatWJlzhEoK2Qhz7Rj5gvM6tYf8iL7RM3tkxlpU9fG0+ofkulzg9AEEA6dIEnSmDr5ZqUA==", + "license": "MIT", + "engines": { + "node": ">=0.8.0" + } + }, + "node_modules/@azure/msal-node": { + "version": "5.2.2", + "resolved": "https://registry.npmjs.org/@azure/msal-node/-/msal-node-5.2.2.tgz", + "integrity": "sha512-toS+2AePxqyzb0YOKttDOOiSl3jrkK9aiqIvpurpis0O34QcIS5gToqrgT39p04Dpxw3YoUU0lxJKTpSFFfA6Q==", + "license": "MIT", + "dependencies": { + "@azure/msal-common": "16.6.2", + "jsonwebtoken": "^9.0.0" + }, + "engines": { + "node": ">=20" } }, "node_modules/@clickhouse/client": { @@ -45,6 +205,42 @@ "node": ">=18.0.0" } }, + "node_modules/@typespec/ts-http-runtime": { + "version": "0.3.5", + "resolved": "https://registry.npmjs.org/@typespec/ts-http-runtime/-/ts-http-runtime-0.3.5.tgz", + "integrity": "sha512-yURCknZhvywvQItHMMmFSo+fq5arCUIyz/CVk7jD89MSai7dkaX8ufjCWp3NttLojoTVbcE72ri+be/TnEbMHw==", + "license": "MIT", + "dependencies": { + "http-proxy-agent": "^7.0.0", + "https-proxy-agent": "^7.0.0", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=20.0.0" + } + }, + "node_modules/@typespec/ts-http-runtime/node_modules/agent-base": { + "version": "7.1.4", + "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-7.1.4.tgz", + "integrity": "sha512-MnA+YT8fwfJPgBx3m60MNqakm30XOkyIoH1y6huTQvC0PwZG7ki8NacLBcrPbNoo8vEZy7Jpuk7+jMO+CUovTQ==", + "license": "MIT", + "engines": { + "node": ">= 14" + } + }, + "node_modules/@typespec/ts-http-runtime/node_modules/https-proxy-agent": { + "version": "7.0.6", + "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-7.0.6.tgz", + "integrity": "sha512-vK9P5/iUfdl95AI+JVyUuIcVtd4ofvtrOr3HNtM2yxC9bnMbEdp3x01OhQNnjb8IJYi38VlTE3mBXwcfvywuSw==", + "license": "MIT", + "dependencies": { + "agent-base": "^7.1.2", + "debug": "4" + }, + "engines": { + "node": ">= 14" + } + }, "node_modules/accepts": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/accepts/-/accepts-2.0.0.tgz", @@ -176,6 +372,21 @@ "integrity": "sha512-zRpUiDwd/xk6ADqPMATG8vc9VPrkck7T07OIx0gnjmJAnHnTVXNQG3vfvWNuiZIkwu9KrKdA1iJKfsfTVxE6NA==", "license": "BSD-3-Clause" }, + "node_modules/bundle-name": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/bundle-name/-/bundle-name-4.1.0.tgz", + "integrity": "sha512-tjwM5exMg6BGRI+kNmTntNsvdZS1X8BFYS6tnJ2hdH0kVxM6/eVZ2xy+FqStSWvYmtfFMDLIxurorHwDKfDz5Q==", + "license": "MIT", + "dependencies": { + "run-applescript": "^7.0.0" + }, + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/bytes": { "version": "3.1.2", "resolved": "https://registry.npmjs.org/bytes/-/bytes-3.1.2.tgz", @@ -324,6 +535,46 @@ } } }, + "node_modules/default-browser": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/default-browser/-/default-browser-5.5.0.tgz", + "integrity": "sha512-H9LMLr5zwIbSxrmvikGuI/5KGhZ8E2zH3stkMgM5LpOWDutGM2JZaj460Udnf1a+946zc7YBgrqEWwbk7zHvGw==", + "license": "MIT", + "dependencies": { + "bundle-name": "^4.1.0", + "default-browser-id": "^5.0.0" + }, + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/default-browser-id": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/default-browser-id/-/default-browser-id-5.0.1.tgz", + "integrity": "sha512-x1VCxdX4t+8wVfd1so/9w+vQ4vx7lKd2Qp5tDRutErwmR85OgmfX7RlLRMWafRMY7hbEiXIbudNrjOAPa/hL8Q==", + "license": "MIT", + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/define-lazy-prop": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/define-lazy-prop/-/define-lazy-prop-3.0.0.tgz", + "integrity": "sha512-N+MeXYoqr3pOgn8xfyRPREN7gHakLYjhsHhWGT3fWAiL4IkAt0iDw14QiiEm2bE30c5XX5q0FtAA3CK5f9/BUg==", + "license": "MIT", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/delayed-stream": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", @@ -342,6 +593,18 @@ "node": ">= 0.8" } }, + "node_modules/dotenv": { + "version": "17.4.2", + "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-17.4.2.tgz", + "integrity": "sha512-nI4U3TottKAcAD9LLud4Cb7b2QztQMUEfHbvhTH09bqXTxnSie8WnjPALV/WMCrJZ6UV/qHJ6L03OqO3LcdYZw==", + "license": "BSD-2-Clause", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://dotenvx.com" + } + }, "node_modules/dunder-proto": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/dunder-proto/-/dunder-proto-1.0.1.tgz", @@ -743,6 +1006,28 @@ "url": "https://opencollective.com/express" } }, + "node_modules/http-proxy-agent": { + "version": "7.0.2", + "resolved": "https://registry.npmjs.org/http-proxy-agent/-/http-proxy-agent-7.0.2.tgz", + "integrity": "sha512-T1gkAiYYDWYx3V5Bmyu7HcfcvL7mUrTWiM6yOfa3PIphViJ/gFPbvidQ+veqSOHci/PxBcDabeUNCzpOODJZig==", + "license": "MIT", + "dependencies": { + "agent-base": "^7.1.0", + "debug": "^4.3.4" + }, + "engines": { + "node": ">= 14" + } + }, + "node_modules/http-proxy-agent/node_modules/agent-base": { + "version": "7.1.4", + "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-7.1.4.tgz", + "integrity": "sha512-MnA+YT8fwfJPgBx3m60MNqakm30XOkyIoH1y6huTQvC0PwZG7ki8NacLBcrPbNoo8vEZy7Jpuk7+jMO+CUovTQ==", + "license": "MIT", + "engines": { + "node": ">= 14" + } + }, "node_modules/https-proxy-agent": { "version": "5.0.1", "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-5.0.1.tgz", @@ -805,6 +1090,21 @@ "node": ">=8" } }, + "node_modules/is-docker": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-docker/-/is-docker-3.0.0.tgz", + "integrity": "sha512-eljcgEDlEns/7AXFosB5K/2nCM4P7FQPkGc/DWLy5rmFEWvZayGrik1d9/QIY5nJ4f9YsVvBkA6kJpHn9rISdQ==", + "license": "MIT", + "bin": { + "is-docker": "cli.js" + }, + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/is-extglob": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", @@ -826,6 +1126,24 @@ "node": ">=0.10.0" } }, + "node_modules/is-inside-container": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-inside-container/-/is-inside-container-1.0.0.tgz", + "integrity": "sha512-KIYLCCJghfHZxqjYBE7rEy0OBuTd5xCHS7tHVgvCLkx7StIoaxwNW3hCALgEUjFfeRk+MG/Qxmp/vtETEF3tRA==", + "license": "MIT", + "dependencies": { + "is-docker": "^3.0.0" + }, + "bin": { + "is-inside-container": "cli.js" + }, + "engines": { + "node": ">=14.16" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/is-number": { "version": "7.0.0", "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", @@ -841,6 +1159,21 @@ "integrity": "sha512-hvpoI6korhJMnej285dSg6nu1+e6uxs7zG3BYAm5byqDsgJNWwxzM6z6iZiAgQR4TJ30JmBTOwqZUw3WlyH3AQ==", "license": "MIT" }, + "node_modules/is-wsl": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/is-wsl/-/is-wsl-3.1.1.tgz", + "integrity": "sha512-e6rvdUCiQCAuumZslxRJWR/Doq4VpPR82kqclvcS0efgt430SlGIk05vdCN58+VrzgtIcfNODjozVielycD4Sw==", + "license": "MIT", + "dependencies": { + "is-inside-container": "^1.0.0" + }, + "engines": { + "node": ">=16" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/jsonwebtoken": { "version": "9.0.3", "resolved": "https://registry.npmjs.org/jsonwebtoken/-/jsonwebtoken-9.0.3.tgz", @@ -1090,6 +1423,45 @@ "wrappy": "1" } }, + "node_modules/open": { + "version": "10.2.0", + "resolved": "https://registry.npmjs.org/open/-/open-10.2.0.tgz", + "integrity": "sha512-YgBpdJHPyQ2UE5x+hlSXcnejzAvD0b22U2OuAP+8OnlJT+PjWPxtgmGqKKc+RgTM63U9gN0YzrYc71R2WT/hTA==", + "license": "MIT", + "dependencies": { + "default-browser": "^5.2.1", + "define-lazy-prop": "^3.0.0", + "is-inside-container": "^1.0.0", + "wsl-utils": "^0.1.0" + }, + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/openai": { + "version": "6.39.0", + "resolved": "https://registry.npmjs.org/openai/-/openai-6.39.0.tgz", + "integrity": "sha512-O61LIsimY3acVabwvomwFhwrnN36yvHY2quIfy9keEcFytGgWeV35yLHQ6NVMLSBxRpHmcg2yuhCnlu2HT4pLQ==", + "license": "Apache-2.0", + "bin": { + "openai": "bin/cli" + }, + "peerDependencies": { + "ws": "^8.18.0", + "zod": "^3.25 || ^4.0" + }, + "peerDependenciesMeta": { + "ws": { + "optional": true + }, + "zod": { + "optional": true + } + } + }, "node_modules/parseurl": { "version": "1.3.3", "resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.3.tgz", @@ -1216,6 +1588,18 @@ "node": ">= 18" } }, + "node_modules/run-applescript": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/run-applescript/-/run-applescript-7.1.0.tgz", + "integrity": "sha512-DPe5pVFaAsinSaV6QjQ6gdiedWDcRCbUuiQfQa2wmWV7+xC9bGulGI8+TdRmoFkAPaBXk8CrAbnlY2ISniJ47Q==", + "license": "MIT", + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/safe-buffer": { "version": "5.2.1", "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", @@ -1440,6 +1824,12 @@ "nodetouch": "bin/nodetouch.js" } }, + "node_modules/tslib": { + "version": "2.8.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.8.1.tgz", + "integrity": "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==", + "license": "0BSD" + }, "node_modules/type-is": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/type-is/-/type-is-2.1.0.tgz", @@ -1500,6 +1890,21 @@ "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==", "license": "ISC" + }, + "node_modules/wsl-utils": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/wsl-utils/-/wsl-utils-0.1.0.tgz", + "integrity": "sha512-h3Fbisa2nKGPxCpm89Hk33lBLsnaGBvctQopaBSOW/uIs6FTe1ATyAnKFJrzVs9vpGdsTe73WF3V4lIsk4Gacw==", + "license": "MIT", + "dependencies": { + "is-wsl": "^3.1.0" + }, + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } } } } diff --git a/package.json b/package.json index 46b3154..9042cdc 100644 --- a/package.json +++ b/package.json @@ -11,12 +11,15 @@ "start": "nodemon index.js" }, "dependencies": { + "@azure/identity": "^4.13.1", "@clickhouse/client": "^1.18.5", "@google/generative-ai": "^0.24.1", "axios": "^1.16.1", "cors": "^2.8.6", + "dotenv": "^17.4.2", "express": "^5.2.1", "jsonwebtoken": "^9.0.3", - "nodemon": "^3.1.14" + "nodemon": "^3.1.14", + "openai": "^6.39.0" } }