-
Notifications
You must be signed in to change notification settings - Fork 212
Add some intelligence to the API results #39
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
gustav0d
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess it would be great if you just keep the singleQuote format
the rest of the code lgtm
index.js
Outdated
|
|
||
| const app = express(); | ||
| app.set('trust proxy', true); | ||
| app.set("trust proxy", true); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@celo-rod maybe use singleQuote to match the current formatting?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done @gustav0d
cbc5964 to
f96f340
Compare
f96f340 to
789468b
Compare
README.md
Outdated
| "author": "hotheadhacker", | ||
| "license": "MIT", | ||
| "dependencies": { | ||
| "axios": "^1.10.0", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
one more thing actually, I guess it would be better if you just use fetch instead of adding axios
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Alright, I removed the axios usage & dependency @gustav0d
index.js
Outdated
| if (response.ok) { | ||
| const reason = data.choices?.[0]?.message?.content?.trim(); | ||
| if (reason) { | ||
| return res.json({ reason, theme, source: 'llm' }); | ||
| } | ||
| console.warn('LLM response was empty, falling back to local reasons.'); | ||
| } else { | ||
| console.error('Fetch failed, falling back to local reasons:', data.error.message); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This could be a lot better using early return https://dev.to/arikaturika/one-concept-a-day-early-return-pattern-in-javascript-3pol
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're right, done! @gustav0d
|
I would make the LLM an optional thing. Not everyone needs the power of 4 suns for saying no. I |
This PR introduces optional support for LLM (Large Language Model)-generated excuses using OpenRouter.ai, while preserving the existing offline behavior as fallback.
Changes
Related issues
Closes: #27