Skip to content

Conversation

@voodoohop
Copy link
Member

No description provided.

- Set default seed value to 42 for consistency
- Enhance prompt instructions for clarity
- Improve content extraction logic from text
- Ensure generation number is displayed and incremented
- Introduce `.state-block` class for styling state displays
- Add iteration labels above each state in the history
- Ensure each state is wrapped in code blocks for clarity
- Improve UI by grouping iteration labels with state blocks
- Insert a line break for better readability
- No functional changes made
- Related to code formatting improvements
- Extract content before </think> with removeThink function
- Simplify extractDisplayContent by using removeThink
- Comment out unnecessary console logs
- Add detailed log for message generation
- Ensure currentState is cleaned before processing
@devloai
Copy link
Contributor

devloai bot commented Jan 29, 2025

Automatic code review is enabled for this repository. Reviewing this PR now.

@mentatbot
Copy link
Contributor

mentatbot bot commented Jan 29, 2025

I'm getting to work. See my steps and track my cost here.

  • Wake on any new activity.

I always see new activity while actively working. When paused, I'll only respond when tagged unless this box is checked.

@github-actions
Copy link
Contributor

🚀 PR Preview deployed!

Preview URL: https://pollinations.github.io/hive/pr-159/

1 similar comment
@github-actions
Copy link
Contributor

🚀 PR Preview deployed!

Preview URL: https://pollinations.github.io/hive/pr-159/

@github-actions
Copy link
Contributor

Testing .mentat

Testing ai-chat

Testing static HTML app: ai-chat

Testing graphics-editor

Testing static HTML app: graphics-editor

Testing llm-feedback

Testing static HTML app: llm-feedback

Testing millionaire-game

Testing static HTML app: millionaire-game

Testing placeholder-generator

Testing Node.js app: placeholder-generator

Installing dependencies



added 274 packages, and audited 275 packages in 8s

109 packages are looking for funding
  run `npm fund` for details

found 0 vulnerabilities

npm warn deprecated [email protected]: Glob versions prior to v9 are no longer supported
npm warn deprecated [email protected]: This module is not supported, and leaks memory. Do not use it. Check out lru-cache if you want a good and tested way to coalesce async requests by a key value, which is much more comprehensive and powerful.
npm warn deprecated [email protected]: Rimraf versions prior to v4 are no longer supported
npm warn deprecated @humanwhocodes/[email protected]: Use @eslint/object-schema instead
npm warn deprecated @humanwhocodes/[email protected]: Use @eslint/config-array instead
npm warn deprecated [email protected]: This version is no longer supported. Please see https://eslint.org/version-support for other options.

ℹ️ No tests found

Building



> [email protected] build
> vite build

�[36mvite v5.4.14 �[32mbuilding for production...�[36m�[39m
transforming...
�[32m✓�[39m 32 modules transformed.
rendering chunks...
computing gzip size...
�[2mdist/�[22m�[32mindex.html                 �[39m�[1m�[2m  0.45 kB�[22m�[1m�[22m�[2m │ gzip:  0.28 kB�[22m
�[2mdist/�[22m�[2massets/�[22m�[35mindex-Xy5EDiQ3.css  �[39m�[1m�[2m  1.25 kB�[22m�[1m�[22m�[2m │ gzip:  0.61 kB�[22m
�[2mdist/�[22m�[2massets/�[22m�[36mindex-BAcusHwb.js   �[39m�[1m�[2m144.97 kB�[22m�[1m�[22m�[2m │ gzip: 46.73 kB�[22m
�[32m✓ built in 771ms�[39m


Testing pollinations-image-show

Testing Node.js app: pollinations-image-show

Installing dependencies



added 315 packages, and audited 316 packages in 11s

119 packages are looking for funding
  run `npm fund` for details

found 0 vulnerabilities


ℹ️ No tests found

Building



> [email protected] build
> vite build

�[36mvite v6.0.11 �[32mbuilding for production...�[36m�[39m
transforming...
�[32m✓�[39m 969 modules transformed.
rendering chunks...
computing gzip size...
�[2mdist/�[22m�[32mindex.html                 �[39m�[1m�[2m  0.46 kB�[22m�[1m�[22m�[2m │ gzip:   0.29 kB�[22m
�[2mdist/�[22m�[2massets/�[22m�[35mindex-Ck1XBn8h.css  �[39m�[1m�[2m  0.56 kB�[22m�[1m�[22m�[2m │ gzip:   0.32 kB�[22m
�[2mdist/�[22m�[2massets/�[22m�[36mindex-tb6_o98D.js   �[39m�[1m�[2m314.28 kB�[22m�[1m�[22m�[2m │ gzip: 104.66 kB�[22m
�[32m✓ built in 2.59s�[39m


Testing prompt-guessing-game

Testing Node.js app: prompt-guessing-game

Installing dependencies



added 61 packages, and audited 62 packages in 2s

7 packages are looking for funding
  run `npm fund` for details

found 0 vulnerabilities


ℹ️ No tests found

Building



> [email protected] build
> vite build

�[36mvite v5.4.14 �[32mbuilding for production...�[36m�[39m
transforming...
�[32m✓�[39m 33 modules transformed.
rendering chunks...
computing gzip size...
�[2mdist/�[22m�[32mindex.html                 �[39m�[1m�[2m  0.46 kB�[22m�[1m�[22m�[2m │ gzip:  0.29 kB�[22m
�[2mdist/�[22m�[2massets/�[22m�[35mindex-Dcj2S7H_.css  �[39m�[1m�[2m  1.71 kB�[22m�[1m�[22m�[2m │ gzip:  0.76 kB�[22m
�[2mdist/�[22m�[2massets/�[22m�[36mindex-DycsOj9-.js   �[39m�[1m�[2m146.36 kB�[22m�[1m�[22m�[2m │ gzip: 47.33 kB�[22m
�[32m✓ built in 796ms�[39m


Testing svg-feedback

Testing static HTML app: svg-feedback

❌ HTML tests failed for svg-feedback

Testing tarot-reader

Testing Node.js app: tarot-reader

Installing dependencies



added 324 packages, and audited 325 packages in 3s

155 packages are looking for funding
  run `npm fund` for details

1 moderate severity vulnerability

To address all issues, run:
  npm audit fix

Run `npm audit` for details.


ℹ️ No tests found

Building



> [email protected] build
> vite build

�[36mvite v6.0.7 �[32mbuilding for production...�[36m�[39m
transforming...
�[32m✓�[39m 34 modules transformed.
rendering chunks...
computing gzip size...
�[2mdist/�[22m�[32mindex.html                 �[39m�[1m�[2m  0.56 kB�[22m�[1m�[22m�[2m │ gzip:  0.33 kB�[22m
�[2mdist/�[22m�[2massets/�[22m�[35mindex-tTF554dA.css  �[39m�[1m�[2m  2.48 kB�[22m�[1m�[22m�[2m │ gzip:  1.03 kB�[22m
�[2mdist/�[22m�[2massets/�[22m�[36mindex-BxXiSpNq.js   �[39m�[1m�[2m149.43 kB�[22m�[1m�[22m�[2m │ gzip: 48.71 kB�[22m
�[32m✓ built in 857ms�[39m


Copy link
Contributor

@devloai devloai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've reviewed the changes to the LLM feedback system. The code organization improvements and addition of thinking steps are good changes. I've suggested some enhancements around input validation, error handling, and LLM instruction clarity that would further improve the robustness and user experience of the system.

function extractDisplayContent(text) {

// Then check for content before </think>
function removeThink(text) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good refactoring to extract removeThink into a separate function for better code organization and reusability. However, consider adding input validation to handle cases where text might be undefined or null.



console.log('Generating text... for message:', JSON.stringify(messages, null, 2));
const response = await fetch('https://text.pollinations.ai/', {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider adding more specific error handling around the API call. While you're logging the messages for debugging, it would be helpful to display user-friendly error messages in the UI when text generation fails. This would improve the user experience.

- If there is an input state, transform it gradually according to the prompt.
- If there is no input state, use the prompt to come up with a starting state. Be creative
- Maintain consistent style and theme
- Before outputting anything spend some time thinking between <think> </think> tags. Please think step by step maybe decomposing the job.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The new thinking instruction is a good addition for better LLM responses. However, consider adding an example of the <think> tag usage in the instructions to make it clearer for the LLM. For example:

Example:
<think>
1. First, I'll analyze the current state
2. Then, I'll apply the transformation rules
3. Finally, I'll format the output
</think>

Copy link
Contributor

@mentatbot mentatbot bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall the changes look good and improve code organization and reliability. Here are a few specific comments:

The changes look solid and improve both code quality and functionality. The separation of concerns with the new text processing functions makes the code more maintainable, and the improved logging will help with debugging. The changes appear ready to merge.

function extractDisplayContent(text) {

// Then check for content before </think>
function removeThink(text) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good refactoring to separate this into its own function. One suggestion would be to also handle the opening tag to be more robust - in case there's content after the closing tag. Something like:

const thinkPattern = /<think>[\s\S]*?<\/think>/;
return text.replace(thinkPattern, '').trim();




console.log('Generating text... for message:', JSON.stringify(messages, null, 2));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good addition for debugging, but consider wrapping this in a debug flag or environment variable since it could log sensitive prompt data in production.

- If there is an input state, transform it gradually according to the prompt.
- If there is no input state, use the prompt to come up with a starting state. Be creative
- Maintain consistent style and theme
- Before outputting anything spend some time thinking between <think> </think> tags. Please think step by step maybe decomposing the job.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice addition to the format instructions. This should help get more structured and thoughtful responses from the model.

Copy link
Contributor

@mentatbot mentatbot bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are some issues that need to be addressed:

These changes would improve error handling, input validation, and clarity of the LLM instructions. Additionally, the failing tests for svg-feedback need to be addressed, but since those files aren't part of this PR's changes, that should be handled in a separate issue.

function extractDisplayContent(text) {

// Then check for content before </think>
function removeThink(text) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider adding input validation and error handling:

function removeThink(text) {
    if (!text) return '';
    try {
        const thinkMatch = text.split('</think>');
        if (thinkMatch.length > 1) 
            return thinkMatch[1].trim();
        return text;
    } catch (error) {
        console.error('Error processing think tags:', error);
        return text;
    }
}




console.log('Generating text... for message:', JSON.stringify(messages, null, 2));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add error handling and user feedback:

try {
    console.log('Generating text... for message:', JSON.stringify(messages, null, 2));
    const response = await fetch('https://text.pollinations.ai/', {
        // ... existing config
    });
    if (!response.ok) {
        throw new Error(`HTTP error! status: ${response.status}`);
    }
    // ... process response
} catch (error) {
    console.error('Text generation failed:', error);
    elements.start.textContent = 'Failed to generate text. Please try again.';
    throw error;
}

- If there is an input state, transform it gradually according to the prompt.
- If there is no input state, use the prompt to come up with a starting state. Be creative
- Maintain consistent style and theme
- Before outputting anything spend some time thinking between <think> </think> tags. Please think step by step maybe decomposing the job.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider adding an example in the instructions to make it clearer for the LLM:

Example:
<think>
1. First, I'll analyze the current state
2. Then, I'll apply the transformation rules
3. Finally, I'll format the output
</think>

This will help ensure consistent and well-structured responses.

@voodoohop voodoohop merged commit 1ced023 into main Jan 30, 2025
5 of 6 checks passed
github-actions bot pushed a commit that referenced this pull request Jan 30, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants