You are browsing as a guest. Sign up (or log in) to start making projects!

4h 57m 16s logged

Devlog 2: XenoDeal | The AI Turns On (And Starts Eating Tokens)

June 22

Since the previous devlog (sorry for missing yesterday), I have gotten the AI System Implemented, and Filtering in order. WhatsApp has caused MORE problems, and luckily I fixed them. (But not the Logout Crash) Besides that, the day (and a half) were easy.

Classifier And Telegram

The Main, MAJOR piece of this devlog and the changes I’ve made since devlog one is src/cron/classifier.js. It’s a background process that does four main things:

  1. Grabs Unprocessed Messages from the DB in Batches
  2. Runs a separate pre-filter file, that removes Obvious Noise and Junk from the Batch
  3. Sends Candidates to AI Provider for full classification
  4. Writes the result to the new deals table and marks the message as processed

Roughly ~150 Messages are still not processed, from my testing batch, gathered from Phase 1, and it is still expanding. This is not just the most important part of the project, it’s the… orchestrator if you will.

The batch size is dynamic, and scales every tick based on backlog and load. This is mainly important during boot after downtime as WWJS just replays missed messages as Live Events, causing a MENTAL wave of messages, and this allows the backlog to finish faster.

async function getBatchSize() {
    const r = await pool.query(
        'SELECT COUNT(*) FROM messages WHERE processed = false'
    );
    const pending = parseInt(r.rows[0].count);
    if (pending > 100) return MAX_BATCH;  // 100
    if (pending > 20)  return 50;
    return MIN_BATCH;  // 20
}

The one architectural decision I have made is to DECOUPLE the poller and message create handlers. They can run without the other, and they work at their own pace, so live messages don’t get blocked from inserting, thus less profit.

For Telegram, I just added a threshold for me to get notified about a listing. If it’s score is above 65, it will send me all the details of the listing, the group name, and the original message. An example is attached as an image.


Bugzilla

Mmmm, my favorite flavor of coding! (No it isn’t) I have a bunch of these (still couldn’t list a, so how about a speed round?:

1.) “Temperature Card”

  • Problem: Same listing was scoring differently
  • Fix: Set Temperature to 0.2

2.) “Sorry, I didn’t understand, please try rephrasing that”

  • Problem: The AI System thought that it was looking for deals for the End Buyer + Hallucinating Good Condition without Evidence
  • Fix: Rewrite Prompt to be more detailed

3.) “Lid, a Big Lid with no Phone # in it”

  • Problem: Whatsapp returns a lid ID instead of a number
  • Fix: Used an approach using client.pupPage and window.require

4.) “Have you seen Chromium anywhere?”

  • Problem: WhatsApp updated and the injection of WWJS made Chromium “Context Crash”
  • Fix: Pin a specific version of WhatsApp

What’s Next

Alright, so next on the agenda, the Dashboard has been pushed back until after the first ship, and as phase 2 has been complete, now phase three is the following:

  • Train and Implement ML for filtering and deals
  • Add Multi-User Support
  • Add Setup Flow to Telegram
  • Add /cmds to Telegram
  • Polish for First Ship

“Anotha One!” - DJ Khaled

0
16

Comments 2

@adamd

W devlog

@xeno3ra

thx!