Help implementing AI in my stock market simulator

I am coding a stock market simulator with real stock data and it’s going well but I am trying to add ai but its not working and don’t know how to fix it, I am using Groq API https://console.groq.com/keys and the model

import { Groq } from 'groq-sdk';

const groq = new Groq();

const chatCompletion = await groq.chat.completions.create({
  "messages": [
    {
      "role": "user",
      "content": ""
    }
  ],
  "model": "llama-3.3-70b-versatile",
  "temperature": 1,
  "max_completion_tokens": 1024,
  "top_p": 1,
  "stream": true,
  "stop": null
});

for await (const chunk of chatCompletion) {
  process.stdout.write(chunk.choices[0]?.delta?.content || '');
}

and I implemented it in an edge function in Supabase and also the ai responds with nothing and its still using api usage tokens

here is the link to the Edge function code: https://kuick.io/81NM15

here is the link to the main code: https://kuick.io/X1353Z

here is the website https://stockplex.edgeone.app/#/auth

This sounds like a fantastic use case for Claude Code.

3 Likes

no

although, in general, this forum tends to lean “AI skeptical”, there are very smart people here (not me) who could perhaps be helpful.

but if your response is going to simply be an un-elaborated “no” then you’re probably not going to get much assistance.

6 Likes

Indeed; while there are a lot of people here who don’t like using LLMs to do the coding for them (me included), those people also don’t tend to like using LLMs to do the writing for them. So the set of people who want to do the coding by hand but use LLM-generated text will probably be pretty small.

1 Like

Even if you don’t want to use Claude Code for this, you’d still get a quicker response by pasting your code into ChatGPT and asking for help.

Posting a big pile of HTML+JS and saying “it doesn’t work” is asking us to do a lot of legwork for you, and that’s the kind of thing that AI will do cheerfully even when people won’t.

2 Likes

Also, this forum generally doesn’t specialize in JS/HTML/CSS but niche languages with a single use case. Even if there are a few people here with the motivation and specialties to help you, you’d undoubtedly have better success elsewhere.

Being nice to your forum mates helps, too.

I think I found the problem. :wink:

3 Likes

Have tried posting this question on Stack Overflow? I think you are more likely to find JavaScript experts there.

I tried using chatgpt but it never said the reason to the cause

What’s wrong with it, it is the only ai api that is freemium and that has multiple models that are good

What did it say instead? Better yet, would you care to share a link to the thread with us? This could be a “teach a man to fish” moment.

1 Like