fiel1986 commited on
Commit
f1634b4
·
verified ·
1 Parent(s): 5194809

Update index.html

Browse files
Files changed (1) hide show
  1. index.html +2 -2
index.html CHANGED
@@ -70,11 +70,11 @@ async function callAI(prompt){
70
  if(cfg.api==="groq"){
71
  const key = localStorage.getItem('groq_key') || document.getElementById('groqKey').value;
72
  if(!key) throw "Pon tu gsk_... Groq key arriba";
73
- const r = await fetch("https://api.groq.com/openai/v1/chat/completions",{method:"POST", headers:{"Content-Type":"application/json", Authorization:`Bearer ${key}`}, body:JSON.stringify({model:cfg.model, messages:[{role:"user", content:prompt}], max_tokens:300, temperature:0.2})});
74
  const d = await r.json(); return d.choices[0].message.content;
75
  } else {
76
  const key = localStorage.getItem('hf_key') || document.getElementById('hfKey').value;
77
- const r = await fetch(`https://router.huggingface.co/hf-inference/models/${cfg.model}`,{method:"POST", headers:{"Content-Type":"application/json",...(key?{Authorization:`Bearer ${key}`}:{})}, body:JSON.stringify({inputs:prompt, parameters:{max_new_tokens:120, return_full_text:false}})});
78
  const d = await r.json(); return d[0]?.generated_text || "";
79
  }
80
  }
 
70
  if(cfg.api==="groq"){
71
  const key = localStorage.getItem('groq_key') || document.getElementById('groqKey').value;
72
  if(!key) throw "Pon tu gsk_... Groq key arriba";
73
+ const r = await fetch("https://api.groq.com/openai/v1/chat/completions",{method:"POST", headers:{"Content-Type":"application/json", Authorization:`Bearer ${key}`}, body:JSON.stringify({model:cfg.model, messages:[{role:"user", content:prompt}], max_tokens:4096, temperature:0.2})});
74
  const d = await r.json(); return d.choices[0].message.content;
75
  } else {
76
  const key = localStorage.getItem('hf_key') || document.getElementById('hfKey').value;
77
+ const r = await fetch(`https://router.huggingface.co/hf-inference/models/${cfg.model}`,{method:"POST", headers:{"Content-Type":"application/json",...(key?{Authorization:`Bearer ${key}`}:{})}, body:JSON.stringify({inputs:prompt, parameters:{max_new_tokens:2040, return_full_text:false}})});
78
  const d = await r.json(); return d[0]?.generated_text || "";
79
  }
80
  }