zhlajiex commited on
Commit
fa1e2bc
·
1 Parent(s): bdb0988

Fix: Update Hugging Face Inference API endpoint to router.huggingface.co and stabilize auth

Browse files
backend/controllers/ai.js CHANGED
@@ -154,7 +154,7 @@ exports.chat = asyncHandler(async (req, res, next) => {
154
  const prompt = message.replace(/make me an image|generate an image|create an image|visualize/gi, "").trim();
155
  const hfToken = process.env.HF_TOKEN;
156
  const response = await axios.post(
157
- `https://api-inference.huggingface.co/models/${MODELS['Codex Vision']}`,
158
  { inputs: prompt },
159
  { headers: { Authorization: `Bearer ${hfToken}` }, responseType: 'arraybuffer' }
160
  );
 
154
  const prompt = message.replace(/make me an image|generate an image|create an image|visualize/gi, "").trim();
155
  const hfToken = process.env.HF_TOKEN;
156
  const response = await axios.post(
157
+ `https://router.huggingface.co/hf-inference/models/${MODELS['Codex Vision']}`,
158
  { inputs: prompt },
159
  { headers: { Authorization: `Bearer ${hfToken}` }, responseType: 'arraybuffer' }
160
  );
backend/public/auth.html CHANGED
@@ -112,6 +112,7 @@
112
 
113
  if (data.success) {
114
  if (isLogin) {
 
115
  localStorage.setItem('token', data.token);
116
  window.location.href = '/chat';
117
  } else {
 
112
 
113
  if (data.success) {
114
  if (isLogin) {
115
+ console.log("Neural Token Received. Length:", data.token.length);
116
  localStorage.setItem('token', data.token);
117
  window.location.href = '/chat';
118
  } else {