#Can't get Scrimba to run

1 messages · Page 1 of 1 (latest)

rose leaf
#

I am taking the Intro to AI Engineering course.
I set up and triple-checked my ENV variables. All are correct.

Nothing happens in the console when I try to run.

I attached screenshots of my setup.

Even more annoyingly, the run buttons circles green and then greys out. Nothing appears in console.

I tried this on Chrome.

PLease help.

(import OpenAI from "openai"
import { checkEnvironment } from "./utils.js"

const openai = new OpenAI({
apiKey: process.env.AI_KEY,
baseURL: process.env.AI_URL,
dangerouslyAllowBrowser: true
})

checkEnvironment();
/**

  • Challenge: Modify the prompt
  • Run the code, then update the prompt so the AI suggests gifts for:
    • you, or
    • someone you actually know
  • Run it again and observe how the output changes.
    */

const prompt = "give me some basic gift ideas for me as a runner";

console.log("Prompt:", prompt);
console.log("Making AI request...");

try {
const response = await openai.chat.completions.create({
model: process.env.AI_MODEL,
messages: [
{
role: "user",
content: prompt,
},
],
});

console.log("AI response:");
console.log(response.choices[0].message.content);

} catch (error) {
if (error.status === 401 || error.status === 403) {
console.error(
"Authentication error: Check your AI_KEY and make sure it’s valid."
);
} else if (error.status >= 500) {
console.error(
"AI provider error: Something went wrong on the provider side. Try again shortly."
);
} else {
console.error(
"Unexpected error:",
error.message || error
);
}
}
)

indigo swallow
#

happened with me
and what worked was i clicked the browser preview button and the console worked

silver quail
#

@indigo swallow Thank you for your comment this is an occasional bug on Scrimba and clicking the browser preview then the console is the fix

queen ore
#

Hi, I am having the same issue and clicking the browser preview button did not work. I can also see that the "runner is idle". Are there any other fixes?

silver quail
#

Which scrim is this happening on? Please drop the link and I'll look into it

queen ore
#

I had the issues with the "Shorter Responses with Tokens" scrim and "The system message" scrim. Do you need the actual link to my scrim? Is it okay to share it here or can the link contain any private information?