Skip to content

Add promo_code and disabled columns, update triggers, and refine UI components#511

Merged
AndlerRL merged 6 commits intodevelopfrom
chore-upt-mb-logo-slogan
Jun 17, 2025
Merged

Add promo_code and disabled columns, update triggers, and refine UI components#511
AndlerRL merged 6 commits intodevelopfrom
chore-upt-mb-logo-slogan

Conversation

@AndlerRL
Copy link
Member

@AndlerRL AndlerRL commented Jun 17, 2025

Summary by Sourcery

Add database schema changes for promo codes and chatbot disabling, automatic thread timestamp updates via triggers, and refine UI/UX and logging behavior across the application

New Features:

  • Add promo_code column to user table and disabled column to chatbot table via Hasura migrations
  • Introduce PostgreSQL triggers to automatically update thread's updated_at timestamp on message insert, update, and delete

Bug Fixes:

  • Prevent undefined experimental_attachments by defaulting to an empty array in the chat hook

Enhancements:

  • Guard console.error calls in URL builders behind a devMode feature flag
  • Refine default accordion open state, enforce full-width styling in chat and image components
  • Update SEO metadata, Open Graph images, and PWA manifest for MasterbotsAI branding
  • Enhance chat hook to default experimental_attachments to an empty array and tailor message prompts for new chats
  • Change GraphQL queries to sort threads by updatedAt and include user bio field
  • Allow optional userAttachments and pass threadQuestionSlug for sub-thread support in chat options
  • Update page metadata descriptions to use “topic” terminology instead of “category”

Summary by CodeRabbit

  • New Features

    • Added "promo_code" field to user profiles, allowing users to have an associated promo code.
    • Introduced a "disabled" field for chatbots, enabling chatbots to be marked as disabled.
  • Improvements

    • Threads are now sorted by most recently updated, making active conversations easier to find.
    • User bios are now included in user info displays.
    • SEO and app metadata descriptions have been updated for clearer messaging and improved branding.
    • Open Graph and manifest details have been refreshed for better sharing and discoverability.
  • Bug Fixes

    • Improved handling of optional file attachments in chat, reducing potential errors.
    • Enhanced error logging to only display in development mode.
  • Style

    • Updated several components to ensure full-width layouts for better visual consistency.
  • Chores

    • Database triggers and functions were updated to keep thread timestamps current with message changes.
    • Documentation comments added to clarify known issues and migration steps.

@AndlerRL AndlerRL requested a review from Copilot June 17, 2025 01:33
@AndlerRL AndlerRL self-assigned this Jun 17, 2025
@vercel
Copy link

vercel bot commented Jun 17, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
masterbots ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 17, 2025 1:39am

@sourcery-ai
Copy link

sourcery-ai bot commented Jun 17, 2025

Reviewer's Guide

This PR extends the database with promo_code and disabled flags plus triggers for auto-timestamping threads, wraps URL builder logging in devMode checks, refines chat UI layouts and logic, fixes attachment fallbacks, updates GraphQL ordering and user fields, refreshes site metadata for new branding, and annotates prompt code with known bug comments.

Entity Relationship diagram for new promo_code and disabled columns

erDiagram
    USER {
        text promo_code
    }
    CHATBOT {
        boolean disabled
    }
    THREAD {
        timestamp updated_at
    }
    MESSAGE {
        int thread_id
    }
    USER ||--o{ THREAD : "creates"
    CHATBOT ||--o{ THREAD : "has"
    THREAD ||--o{ MESSAGE : "contains"
Loading

Entity Relationship diagram for thread auto-timestamping triggers

erDiagram
    THREAD {
        timestamp updated_at
    }
    MESSAGE {
        int thread_id
    }
    THREAD ||--o{ MESSAGE : "contains"
    MESSAGE }o--|| THREAD : "updates updated_at via trigger"
Loading

Class diagram for updated User and Chatbot types

classDiagram
    class User {
        +string username
        +string profilePicture
        +string bio
        +string promo_code
    }
    class Chatbot {
        +string name
        +string avatar
        +boolean disabled
    }
Loading

Class diagram for thread and message timestamp trigger logic

classDiagram
    class Thread {
        +int thread_id
        +timestamp updated_at
    }
    class Message {
        +int message_id
        +int thread_id
    }
    class UpdateThreadTimestampTrigger {
        +update_thread_timestamp()
    }
    Message --|> UpdateThreadTimestampTrigger : triggers
    UpdateThreadTimestampTrigger ..> Thread : updates updated_at
Loading

File-Level Changes

Change Details Files
Add promo_code and disabled columns and thread timestamp triggers
  • Add SQL migrations to alter user and chatbot tables with new columns
  • Implement update_thread_timestamp function and attach triggers on message insert/update/delete
apps/hasura/migrations/masterbots/1750112413158_alter_table_public_user_add_column_promo_code/up.sql
apps/hasura/migrations/masterbots/1750112474878_alter_table_public_chatbot_add_column_disabled/up.sql
apps/hasura/migrations/masterbots/1750105008677_function_update_thread_on_new_message/up.sql
Gate url builder console.error calls behind devMode
  • Wrap all console.error calls in devMode feature flag checks
apps/masterbots.ai/lib/url.ts
Refine chat UI layouts and behavior
  • Add full-width classes to ChatMessage, ReasoningChatMessage, ImageMessage, and SharedAccordion
  • Adjust MessagePairAccordion default open state logic
  • Introduce delayed click reset in ChatMessage to prevent instant re-click
apps/masterbots.ai/components/routes/chat/chat-message.tsx
apps/masterbots.ai/components/routes/chat/reasoning/reasoning-chat-message.tsx
apps/masterbots.ai/components/shared/image-message.tsx
apps/masterbots.ai/components/shared/shared-accordion.tsx
apps/masterbots.ai/components/routes/chat/chat-list/message-pair-accordion.tsx
Enhance chat logic and attachment handling
  • Fallback to empty arrays for experimental_attachments and userAttachments
  • Use new-chat condition to pick initial content in MBChatProvider
  • Pass threadQuestionSlug for sub-threads in ChatOptions
apps/masterbots.ai/lib/hooks/use-mb-chat.tsx
apps/masterbots.ai/components/routes/chat/chat-list/message-pairs.tsx
apps/masterbots.ai/components/routes/chat/chat-options.tsx
apps/masterbots.ai/components/routes/chat/chat-list/index.tsx
Switch thread fetch ordering and include user bio
  • Change GraphQL orderBy from createdAt to updatedAt
  • Add bio field to getUserInfoFromBrowse query
apps/masterbots.ai/services/hasura/hasura.service.ts
Refresh site metadata and SEO for new branding
  • Update descriptions, slogans, and image settings in layout.tsx, manifest.ts, and OG route
  • Adjust generateMetadata descriptions across browse, category, and user pages
apps/masterbots.ai/app/layout.tsx
apps/masterbots.ai/app/manifest.ts
apps/masterbots.ai/app/api/og/route.tsx
apps/masterbots.ai/app/(browse)/[category]/[domain]/page.tsx
apps/masterbots.ai/app/(browse)/[category]/page.tsx
apps/masterbots.ai/app/c/[category]/[domain]/page.tsx
apps/masterbots.ai/app/c/[category]/page.tsx
apps/masterbots.ai/app/u/[userSlug]/t/page.tsx
Annotate prompt logic for continuous response edge case
  • Add bug/analysis comments in followingQuestionsPrompt around last question handling
apps/masterbots.ai/lib/constants/prompts.ts

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jun 17, 2025

Walkthrough

This update introduces new database migrations to add columns for "promo_code" and "disabled" in user and chatbot tables, respectively. It also adds and removes triggers and functions for updating thread timestamps. Several UI components receive styling tweaks, improved type handling, and metadata updates, while error logging is now conditional on development mode.

Changes

File(s) Change Summary
.../migrations/masterbots/1750105008677_function_update_thread_on_new_message/up.sql, down.sql Adds/drops a trigger function and related triggers to update thread.updated_at on message insert/update/delete.
.../migrations/masterbots/1750112413158_alter_table_public_user_add_column_promo_code/up.sql, down.sql Adds a nullable promo_code column to public.user; down migration is a placeholder comment.
.../migrations/masterbots/1750112474878_alter_table_public_chatbot_add_column_disabled/up.sql, down.sql Adds a nullable boolean disabled column to public.chatbot with default false; down migration is a placeholder comment.
.../app/(browse)/[category]/[domain]/page.tsx, [category]/page.tsx, c/[category]/[domain]/page.tsx, c/[category]/page.tsx SEO metadata description strings updated: "category" replaced with "topic".
.../app/api/og/route.tsx Updates default OG image avatar, question, answer, and username strings.
.../app/layout.tsx, manifest.ts Updates site and manifest descriptions, app name, and image metadata for branding consistency.
.../app/u/[userSlug]/t/page.tsx Metadata description now uses user's bio instead of username.
.../components/routes/chat/chat-list/index.tsx, message-pairs.tsx userAttachments prop type changed to allow undefined; code updated for safe access.
.../components/routes/chat/chat-list/message-pair-accordion.tsx Refines accordion open state logic and adds w-full class for width styling.
.../components/routes/chat/chat-message.tsx Adds delay to clickable state reset; adds w-full class to containers for full width.
.../components/routes/chat/chat-options.tsx Moves isSubThread declaration for earlier use; removes redundancy.
.../components/routes/chat/reasoning/reasoning-chat-message.tsx, shared/image-message.tsx, shared/shared-accordion.tsx Adds w-full class to root/container divs for consistent full-width styling.
.../components/shared/og-image.tsx Changes zIndex style value from number to string.
.../components/routes/subscription/subscription-page.tsx Removes unused import of cn utility.
.../lib/constants/prompts.ts Adds comments describing a bug in followingQuestionsPrompt logic; no code changes.
.../lib/hooks/use-mb-chat.tsx Refines logic for appending new messages, especially content selection and attachment fallback.
.../lib/url.ts Error logging is now conditional on devMode feature flag.
.../services/hasura/hasura.service.ts Threads are now ordered by updatedAt instead of createdAt; user query includes bio field.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant DB (Postgres)
    participant Hasura API
    participant App

    User->>App: Inserts/Updates/Deletes a message
    App->>Hasura API: Sends mutation
    Hasura API->>DB (Postgres): Executes message operation
    DB (Postgres)-->>DB (Postgres): Trigger fires update_thread_timestamp()
    DB (Postgres)->>DB (Postgres): Updates thread.updated_at to NOW()
    DB (Postgres)-->>Hasura API: Returns result
    Hasura API-->>App: Returns response
    App-->>User: UI updates with latest thread ordering
Loading

Suggested labels

chore

Poem

In fields of code where triggers hop,
New columns bloom, old ones drop.
Threads now update when messages fly,
And "topic" replaces "category"—oh my!
With full-width style and bios in view,
This rabbit says: the site feels new! 🐇✨

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

apps/masterbots.ai/app/(browse)/[category]/[domain]/page.tsx

Oops! Something went wrong! :(

ESLint: 8.57.1

ESLint couldn't find the config "next/core-web-vitals" to extend from. Please check that the name of the config is correct.

The config "next/core-web-vitals" was referenced from the config file in "/apps/masterbots.ai/.eslintrc.json".

If you still have problems, please stop by https://eslint.org/chat/help to chat with the team.

apps/masterbots.ai/app/(browse)/[category]/page.tsx

Oops! Something went wrong! :(

ESLint: 8.57.1

ESLint couldn't find the config "next/core-web-vitals" to extend from. Please check that the name of the config is correct.

The config "next/core-web-vitals" was referenced from the config file in "/apps/masterbots.ai/.eslintrc.json".

If you still have problems, please stop by https://eslint.org/chat/help to chat with the team.

apps/masterbots.ai/app/api/og/route.tsx

Oops! Something went wrong! :(

ESLint: 8.57.1

ESLint couldn't find the config "next/core-web-vitals" to extend from. Please check that the name of the config is correct.

The config "next/core-web-vitals" was referenced from the config file in "/apps/masterbots.ai/.eslintrc.json".

If you still have problems, please stop by https://eslint.org/chat/help to chat with the team.

  • 18 others
✨ Finishing Touches
  • 📝 Generate Docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR updates layout styling, brand messaging, and adds database migrations and triggers.

  • Adds full-width styling to chat message components
  • Updates branding slogans, manifest, metadata, and OG assets
  • Introduces disabled and promo_code columns plus a trigger for thread timestamp updates

Reviewed Changes

Copilot reviewed 30 out of 30 changed files in this pull request and generated 8 comments.

Show a summary per file
File Description
apps/masterbots.ai/components/routes/chat/reasoning/reasoning-chat-message.tsx Added w-full to the wrapper for full-width layout
apps/masterbots.ai/components/routes/chat/chat-options.tsx Consolidated isSubThread logic before URL construction
apps/masterbots.ai/components/routes/chat/chat-message.tsx Added click-delay logic and w-full styling
apps/masterbots.ai/components/routes/chat/chat-list/message-pairs.tsx Made userAttachments optional and null-safe
apps/masterbots.ai/components/routes/chat/chat-list/message-pair-accordion.tsx Refactored accordion default/open state logic
apps/masterbots.ai/components/routes/chat/chat-list/index.tsx Updated userAttachments prop typing to allow undefined
apps/masterbots.ai/app/u/[userSlug]/t/page.tsx Changed SEO description from username to bio
apps/masterbots.ai/app/manifest.ts Updated PWA name, short_name, and description
apps/masterbots.ai/app/layout.tsx Updated metadata description and OG images array
apps/masterbots.ai/app/c/[category]/page.tsx Revised page description wording (categorytopic)
apps/masterbots.ai/app/c/[category]/[domain]/page.tsx Revised page description wording (categorytopic)
apps/masterbots.ai/app/api/og/route.tsx Swapped avatar URL, updated slogan and username
apps/masterbots.ai/app/(browse)/[category]/page.tsx Revised browse description (categorytopic)
apps/masterbots.ai/app/(browse)/[category]/[domain]/page.tsx Revised browse description (categorytopic)
apps/hasura/migrations/masterbots/1750112474878_alter_table_public_chatbot_add_column_disabled/up.sql Added disabled boolean column
apps/hasura/migrations/masterbots/1750112474878_alter_table_public_chatbot_add_column_disabled/down.sql Down migration placeholder
apps/hasura/migrations/masterbots/1750112413158_alter_table_public_user_add_column_promo_code/up.sql Added promo_code text column
apps/hasura/migrations/masterbots/1750112413158_alter_table_public_user_add_column_promo_code/down.sql Down migration placeholder
apps/hasura/migrations/masterbots/1750105008677_function_update_thread_on_new_message/up.sql Creates trigger and function to update thread timestamp
apps/hasura/migrations/masterbots/1750105008677_function_update_thread_on_new_message/down.sql Drops trigger and function for rollback
Comments suppressed due to low confidence (1)

apps/masterbots.ai/app/manifest.ts:5

  • [nitpick] The manifest name (MasterbotsAI) doesn’t match the layout metadata (Masterbots). Align naming across manifest and metadata to avoid confusion.
name: 'MasterbotsAI',

const session = useSession()
const jwt = session?.data?.user?.hasuraJwt

const isSubThread = pair && pair !== undefined
Copy link

Copilot AI Jun 17, 2025

Choose a reason for hiding this comment

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

[nitpick] The expression pair && pair !== undefined is redundant; you can simplify this to const isSubThread = Boolean(pair) or const isSubThread = pair !== undefined for clarity.

Suggested change
const isSubThread = pair && pair !== undefined
const isSubThread = Boolean(pair)

Copilot uses AI. Check for mistakes.
<SharedAccordion
defaultState={defaultAccordionState}
isOpen={isAccordionFocused || defaultAccordionState}
isOpen={isAccordionFocused}
Copy link

Copilot AI Jun 17, 2025

Choose a reason for hiding this comment

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

The defaultAccordionState is no longer considered in isOpen, so all accordions will be closed by default. You likely want isOpen={isAccordionFocused || defaultAccordionState} to honor the intended initial state.

Suggested change
isOpen={isAccordionFocused}
isOpen={isAccordionFocused || defaultAccordionState}

Copilot uses AI. Check for mistakes.
Comment on lines +52 to +55
// ? Case for when we have the first message in the conversation or last and both are not previous
// ((!index || index === arrayLength - 1) && !isPrevious) ||
// ? Case for when we have the first message in the previous conversation
// (!index && isPrevious)
Copy link

Copilot AI Jun 17, 2025

Choose a reason for hiding this comment

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

[nitpick] There are several commented-out blocks of logic for alternate accordion behaviors. Consider removing dead code to improve readability.

Suggested change
// ? Case for when we have the first message in the conversation or last and both are not previous
// ((!index || index === arrayLength - 1) && !isPrevious) ||
// ? Case for when we have the first message in the previous conversation
// (!index && isPrevious)

Copilot uses AI. Check for mistakes.
chatbot: {
name: 'masterbots',
avatar: `${process.env.BASE_URL}/masterbots_og.png`,
// avatar: `${process.env.BASE_URL}/masterbots_og.png`,
Copy link

Copilot AI Jun 17, 2025

Choose a reason for hiding this comment

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

[nitpick] Consider removing or relocating this commented-out avatar URL to reduce clutter in the code.

Suggested change
// avatar: `${process.env.BASE_URL}/masterbots_og.png`,

Copilot uses AI. Check for mistakes.
},
description:
'Elevating AI Beyond ChatGPT: Specialized Chatbots, Social Sharing and User-Friendly Innovation',
description: 'Where your Ai expertise goes public',
Copy link

Copilot AI Jun 17, 2025

Choose a reason for hiding this comment

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

[nitpick] The capitalization of “Ai” is inconsistent with the brand’s use of “AI.” Adjust to Where your AI expertise goes public for consistency.

Suggested change
description: 'Where your Ai expertise goes public',
description: 'Where your AI expertise goes public',

Copilot uses AI. Check for mistakes.
@@ -0,0 +1,4 @@
-- Could not auto-generate a down migration.
Copy link

Copilot AI Jun 17, 2025

Choose a reason for hiding this comment

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

The down migration is incomplete. Add the corresponding ALTER TABLE public.chatbot DROP COLUMN disabled; to ensure the migration can be rolled back.

Copilot uses AI. Check for mistakes.
@@ -0,0 +1,4 @@
-- Could not auto-generate a down migration.
Copy link

Copilot AI Jun 17, 2025

Choose a reason for hiding this comment

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

The down migration is incomplete. Add the corresponding ALTER TABLE public.user DROP COLUMN promo_code; to allow rollback.

Copilot uses AI. Check for mistakes.
// ? Adding delay to avoid instant re-clicks and state reset callbacks
const timeout = setTimeout(() => {
setClicked(false)
clearTimeout(timeout)
Copy link

Copilot AI Jun 17, 2025

Choose a reason for hiding this comment

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

[nitpick] Calling clearTimeout(timeout) inside the timeout callback is unnecessary since the timer has already fired; you can remove it to simplify the code.

Suggested change
clearTimeout(timeout)

Copilot uses AI. Check for mistakes.
Copy link

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey @AndlerRL - I've reviewed your changes - here's some feedback:

  • There’s a lot of repeated if (appConfig.features.devMode) console.error… logic in urlBuilders—consider extracting that into a helper to reduce duplication.
  • You’ve left a “BUG FOUND” comment in prompts.ts without an actual fix; either implement the fix for the lastQuestion logic or remove the debug comment before merging.
  • The down migrations for adding promo_code and disabled columns are placeholder stubs—please provide proper SQL so rollbacks work correctly.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- There’s a lot of repeated `if (appConfig.features.devMode) console.error…` logic in urlBuilders—consider extracting that into a helper to reduce duplication.
- You’ve left a “BUG FOUND” comment in prompts.ts without an actual fix; either implement the fix for the lastQuestion logic or remove the debug comment before merging.
- The down migrations for adding `promo_code` and `disabled` columns are placeholder stubs—please provide proper SQL so rollbacks work correctly.

## Individual Comments

### Comment 1
<location> `apps/masterbots.ai/components/routes/chat/chat-message.tsx:66` </location>
<code_context>
 			() => {
-				setClicked(false)
+				// ? Adding delay to avoid instant re-clicks and state reset callbacks
+				const timeout = setTimeout(() => {
+					setClicked(false)
+					clearTimeout(timeout)
</code_context>

<issue_to_address>
Cleanup timeout on unmount to avoid leaks

Use a ref or the cleanup function in `useEffect` to ensure the timeout is cleared if the component unmounts before it completes.

Suggested implementation:

```typescript
			() => {
				// ? Adding delay to avoid instant re-clicks and state reset callbacks
				if (!timeoutRef.current) {
					timeoutRef.current = setTimeout(() => {
						setClicked(false)
						timeoutRef.current = null
					}, 1250)
				}
			},

```

```typescript
	}
		}

		const timeoutRef = React.useRef<NodeJS.Timeout | null>(null)

		React.useEffect(() => {
			return () => {
				if (timeoutRef.current) {
					clearTimeout(timeoutRef.current)
					timeoutRef.current = null
				}
			}
		}, [])

		return (
			<div className="mt-4 space-y-4 w-full">
				{images.map((image, i) => {

```
</issue_to_address>

### Comment 2
<location> `apps/masterbots.ai/components/routes/chat/chat-list/message-pair-accordion.tsx:52` </location>
<code_context>
+	const defaultAccordionState =
+		// ? Case to show only the last message in the conversation and it is not previous
+		index === arrayLength - 1 && !isPrevious
+	// ? Case for when we have the first message in the conversation or last and both are not previous
+	// ((!index || index === arrayLength - 1) && !isPrevious) ||
+	// ? Case for when we have the first message in the previous conversation
</code_context>

<issue_to_address>
Remove commented-out logic blocks

Removing outdated commented code will help keep the codebase clear and maintainable.
</issue_to_address>

### Comment 3
<location> `apps/hasura/migrations/masterbots/1750112413158_alter_table_public_user_add_column_promo_code/down.sql:1` </location>
<code_context>
+-- Could not auto-generate a down migration.
+-- Please write an appropriate down migration for the SQL below:
+-- alter table "public"."user" add column "promo_code" text
</code_context>

<issue_to_address>
Implement proper down migration for user.promo_code

Replace the placeholder with a statement to drop the `promo_code` column for a complete down migration.
</issue_to_address>

### Comment 4
<location> `apps/hasura/migrations/masterbots/1750112474878_alter_table_public_chatbot_add_column_disabled/down.sql:1` </location>
<code_context>
+-- Could not auto-generate a down migration.
+-- Please write an appropriate down migration for the SQL below:
+-- alter table "public"."user" add column "promo_code" text
</code_context>

<issue_to_address>
Implement proper down migration for chatbot.disabled

Replace the placeholder with a statement to drop the `disabled` column in the down migration.
</issue_to_address>

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

() => {
setClicked(false)
// ? Adding delay to avoid instant re-clicks and state reset callbacks
const timeout = setTimeout(() => {
Copy link

Choose a reason for hiding this comment

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

suggestion (bug_risk): Cleanup timeout on unmount to avoid leaks

Use a ref or the cleanup function in useEffect to ensure the timeout is cleared if the component unmounts before it completes.

Suggested implementation:

			() => {
				// ? Adding delay to avoid instant re-clicks and state reset callbacks
				if (!timeoutRef.current) {
					timeoutRef.current = setTimeout(() => {
						setClicked(false)
						timeoutRef.current = null
					}, 1250)
				}
			},
	}
		}

		const timeoutRef = React.useRef<NodeJS.Timeout | null>(null)

		React.useEffect(() => {
			return () => {
				if (timeoutRef.current) {
					clearTimeout(timeoutRef.current)
					timeoutRef.current = null
				}
			}
		}, [])

		return (
			<div className="mt-4 space-y-4 w-full">
				{images.map((image, i) => {

const defaultAccordionState =
// ? Case to show only the last message in the conversation and it is not previous
index === arrayLength - 1 && !isPrevious
// ? Case for when we have the first message in the conversation or last and both are not previous
Copy link

Choose a reason for hiding this comment

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

nitpick: Remove commented-out logic blocks

Removing outdated commented code will help keep the codebase clear and maintainable.

@@ -0,0 +1,4 @@
-- Could not auto-generate a down migration.
Copy link

Choose a reason for hiding this comment

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

issue: Implement proper down migration for user.promo_code

Replace the placeholder with a statement to drop the promo_code column for a complete down migration.

@@ -0,0 +1,4 @@
-- Could not auto-generate a down migration.
Copy link

Choose a reason for hiding this comment

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

issue: Implement proper down migration for chatbot.disabled

Replace the placeholder with a statement to drop the disabled column in the down migration.

@coderabbitai coderabbitai bot changed the title Chore upt mb logo slogan | @coderabbitai Chore upt mb logo slogan | Add promo_code and disabled columns, update triggers, and refine UI components Jun 17, 2025
@AndlerRL AndlerRL changed the title Chore upt mb logo slogan | Add promo_code and disabled columns, update triggers, and refine UI components Add promo_code and disabled columns, update triggers, and refine UI components Jun 17, 2025
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 3

🔭 Outside diff range comments (3)
apps/hasura/migrations/masterbots/1750112413158_alter_table_public_user_add_column_promo_code/down.sql (1)

1-5: Add an executable down migration. The current file only contains comments. To enable rollback, replace or complement them with:

ALTER TABLE "public"."user"
  DROP COLUMN IF EXISTS "promo_code";
apps/masterbots.ai/components/routes/chat/chat-list/message-pairs.tsx (1)

71-77: useMemo misses activeThread – stale attachments risk

filteredUserAttachments falls back to activeThread?.metadata?.attachments, but activeThread is not in the dependency array of either previousPairsElements or currentPairsElements.
If the user switches threads, the memo will keep using the old attachments until some other tracked dependency changes.

- }, [
-   messagesData.previous,
-   userAttachments,
-   isThread,
-   isNewResponse,
-   chatTitleClass,
-   chatContentClass,
- ])
+ }, [
+   messagesData.previous,
+   userAttachments,
+   activeThread,          // ✅ keep memo in sync with thread changes
+   isThread,
+   isNewResponse,
+   chatTitleClass,
+   chatContentClass,
+ ])

Do the same for the currentPairsElements memo.

Also applies to: 124-126

apps/masterbots.ai/components/routes/chat/chat-list/message-pair-accordion.tsx (1)

235-252: Accidentally rendering a boolean literal

{isAccordionFocused} is rendered inside the div, leaking true/false to the UI.

-					{isAccordionFocused}

Remove it or wrap it with a conditional meant for development only.

-{isAccordionFocused}
+# (nothing – value should not be rendered)
🧹 Nitpick comments (17)
apps/hasura/migrations/masterbots/1750112413158_alter_table_public_user_add_column_promo_code/up.sql (1)

1-2: Add promo_code column to public.user
Introduced a new nullable promo_code text column for tracking promotions. Ensure there’s a corresponding down migration to drop this column for proper rollback support.

apps/masterbots.ai/components/shared/og-image.tsx (1)

206-206: Prefer numeric zIndex for inline styles. React’s CSSProperties supports numeric values for zIndex, and using a number is more idiomatic and avoids unnecessary string parsing. If you needed a string for a specific reason, please document it.

apps/hasura/migrations/masterbots/1750112474878_alter_table_public_chatbot_add_column_disabled/up.sql (1)

1-2: Use unquoted boolean literal for default. Replace default 'false' with DEFAULT false to avoid an unnecessary string-to-boolean cast in PostgreSQL and follow SQL conventions.

apps/masterbots.ai/components/routes/chat/chat-options.tsx (1)

50-55: Simplify isSubThread boolean expression.

pair && pair !== undefined is redundant; !!pair conveys the intent more clearly and cannot return the object reference itself.

-const isSubThread = pair && pair !== undefined
+const isSubThread = !!pair
apps/masterbots.ai/components/routes/chat/chat-list/index.tsx (1)

155-156: Avoid the unnecessary type assertion.

userAttachments is already typed by the hook; forcing a cast hides potential type drift. If the hook can return undefined, encode that in its return type and pass it directly:

-	userAttachments={userAttachments as FileAttachment[] | undefined}
+	userAttachments={userAttachments}
apps/masterbots.ai/app/u/[userSlug]/t/page.tsx (1)

92-93: Fallback for empty bio may hurt SEO.

If user.bio is absent you send an empty string, producing <meta name="description" content="">. Consider falling back to user.username or a default sentence to avoid empty descriptions.

-	description: user?.bio || '',
+	description: user?.bio || user?.username || '',
apps/masterbots.ai/app/manifest.ts (1)

5-7: Capitalize “AI” for brand consistency

The description now reads “Where your Ai expertise goes public”. Everywhere else in the repo we use the capitalised “AI”.

- description: 'Where your Ai expertise goes public',
+ description: 'Where your AI expertise goes public',

Same applies if you want the short/long name to contain “AI”.

apps/masterbots.ai/components/routes/chat/chat-message.tsx (2)

124-142: Tailwind width utility already covered

w-full is added both to the images wrapper (line 124) and the outer div (line 147).
The outer container already spans full width; adding w-full to children is usually redundant. Verify you actually need both declarations.


146-149: Prefer cn for conditional class composition

Passing literal 'group relative flex items-start p-1 w-full' is fine, but if more width-related toggles appear, wrap them in cn(...) the same way other parts of the file do for consistency.

apps/masterbots.ai/services/hasura/hasura.service.ts (1)

315-316: Ordering by updatedAt – add DB index

Switching the sort key to updatedAt is correct given the new trigger, but the column may be un-indexed. Large datasets will regress in performance.

Consider adding:

CREATE INDEX IF NOT EXISTS idx_thread_updated_at ON thread (updated_at DESC);
apps/masterbots.ai/app/layout.tsx (2)

64-84: Brand name mismatch with manifest

Here the default title remains “Masterbots”, whereas manifest.ts now uses “MasterbotsAI”. Align both files to keep branding coherent across metadata and PWA manifest.


70-71: Capitalisation of “AI”

Same nit as in manifest.ts: capitalise “AI” in the description for consistency.

- description: 'Where your Ai expertise goes public',
+ description: 'Where your AI expertise goes public',

Also applies to: 80-81

apps/masterbots.ai/app/api/og/route.tsx (1)

20-27: BASE_URL may be undefined at runtime

The new avatar path is constructed with ${process.env.BASE_URL}.
Inside the Edge runtime process.env often contains only explicitly-exposed variables; if BASE_URL is missing you’ll end up with URLs that begin with undefined/…, breaking the OG image.

- avatar: `${process.env.BASE_URL}/images/mb-logo-short-round.png`,
+ avatar: `${process.env.BASE_URL ?? ''}/images/mb-logo-short-round.png`,

Alternatively, fall back to an absolute path (https://masterbots.ai/...) or throw early when the variable is absent.

apps/masterbots.ai/lib/url.ts (1)

141-147: Minor logging quality & safety improvements

  1. Each console.error message still says “profile URL” inside helpers that build thread URLs. This is confusing during debugging.
  2. The new if (appConfig.features.devMode) console.error(...) style omits braces.
    When someone later adds another statement the guard can subtly break. Add braces for future-proofing.
- if (appConfig.features.devMode)
-   console.error(
-     `Missing required parameters for profile URL: ${missing}`,
-   )
+ if (appConfig.features.devMode) {
+   console.error(
+     `Missing required parameters for thread URL: ${missing}`,
+   )
+ }

(The same tweak applies to the other guarded log statements shown in the hunks.)

Also applies to: 163-166, 173-175, 207-211, 226-228, 240-242

apps/masterbots.ai/lib/constants/prompts.ts (1)

104-108: Convert in-line bug narrative into a tracked TODO

The explanatory block is valuable, but burying a multi-line investigation inside the function will age quickly.
Consider a succinct // TODO(Andler): fix lastResponseString – see issue #XYZ and move the long description to the issue tracker or JSDoc above the function. This keeps the hot path readable.

apps/masterbots.ai/components/routes/chat/chat-list/message-pairs.tsx (1)

71-77: Edge-case: empty userAttachments array

The check userAttachments?.length ? userAttachments : fallback treats an empty array the same as “no attachments supplied”, causing fallback attachments to appear unexpectedly.
Use userAttachments !== undefined instead.

- (userAttachments?.length ? userAttachments : fallback)
+ (userAttachments !== undefined ? userAttachments : fallback)
apps/masterbots.ai/components/routes/chat/chat-list/message-pair-accordion.tsx (1)

49-56: Commented-out logic can be safely removed

The large block of commented-out conditions makes it harder to parse the current rule.
If the old logic is no longer required, delete it; otherwise document why it is retained.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 9cb1809 and 7de0633.

⛔ Files ignored due to path filters (2)
  • apps/masterbots.ai/public/images/mb-logo-short-round.png is excluded by !**/*.png
  • apps/masterbots.ai/public/images/x.svg is excluded by !**/*.svg
📒 Files selected for processing (28)
  • apps/hasura/migrations/masterbots/1750105008677_function_update_thread_on_new_message/down.sql (1 hunks)
  • apps/hasura/migrations/masterbots/1750105008677_function_update_thread_on_new_message/up.sql (1 hunks)
  • apps/hasura/migrations/masterbots/1750112413158_alter_table_public_user_add_column_promo_code/down.sql (1 hunks)
  • apps/hasura/migrations/masterbots/1750112413158_alter_table_public_user_add_column_promo_code/up.sql (1 hunks)
  • apps/hasura/migrations/masterbots/1750112474878_alter_table_public_chatbot_add_column_disabled/down.sql (1 hunks)
  • apps/hasura/migrations/masterbots/1750112474878_alter_table_public_chatbot_add_column_disabled/up.sql (1 hunks)
  • apps/masterbots.ai/app/(browse)/[category]/[domain]/page.tsx (1 hunks)
  • apps/masterbots.ai/app/(browse)/[category]/page.tsx (1 hunks)
  • apps/masterbots.ai/app/api/og/route.tsx (1 hunks)
  • apps/masterbots.ai/app/c/[category]/[domain]/page.tsx (1 hunks)
  • apps/masterbots.ai/app/c/[category]/page.tsx (1 hunks)
  • apps/masterbots.ai/app/layout.tsx (1 hunks)
  • apps/masterbots.ai/app/manifest.ts (1 hunks)
  • apps/masterbots.ai/app/u/[userSlug]/t/page.tsx (1 hunks)
  • apps/masterbots.ai/components/routes/chat/chat-list/index.tsx (1 hunks)
  • apps/masterbots.ai/components/routes/chat/chat-list/message-pair-accordion.tsx (3 hunks)
  • apps/masterbots.ai/components/routes/chat/chat-list/message-pairs.tsx (2 hunks)
  • apps/masterbots.ai/components/routes/chat/chat-message.tsx (3 hunks)
  • apps/masterbots.ai/components/routes/chat/chat-options.tsx (1 hunks)
  • apps/masterbots.ai/components/routes/chat/reasoning/reasoning-chat-message.tsx (1 hunks)
  • apps/masterbots.ai/components/routes/subscription/subscription-page.tsx (0 hunks)
  • apps/masterbots.ai/components/shared/image-message.tsx (1 hunks)
  • apps/masterbots.ai/components/shared/og-image.tsx (1 hunks)
  • apps/masterbots.ai/components/shared/shared-accordion.tsx (1 hunks)
  • apps/masterbots.ai/lib/constants/prompts.ts (1 hunks)
  • apps/masterbots.ai/lib/hooks/use-mb-chat.tsx (1 hunks)
  • apps/masterbots.ai/lib/url.ts (23 hunks)
  • apps/masterbots.ai/services/hasura/hasura.service.ts (3 hunks)
💤 Files with no reviewable changes (1)
  • apps/masterbots.ai/components/routes/subscription/subscription-page.tsx
🧰 Additional context used
🧬 Code Graph Analysis (12)
apps/masterbots.ai/components/shared/image-message.tsx (1)
apps/masterbots.ai/lib/utils.ts (1)
  • cn (9-11)
apps/masterbots.ai/app/(browse)/[category]/[domain]/page.tsx (1)
packages/mb-drizzle/src/drizzle/schema.ts (1)
  • category (29-36)
apps/masterbots.ai/app/c/[category]/[domain]/page.tsx (1)
packages/mb-drizzle/src/drizzle/schema.ts (1)
  • category (29-36)
apps/masterbots.ai/components/routes/chat/reasoning/reasoning-chat-message.tsx (1)
apps/masterbots.ai/lib/utils.ts (1)
  • cn (9-11)
apps/masterbots.ai/app/u/[userSlug]/t/page.tsx (1)
packages/mb-drizzle/src/drizzle/schema.ts (1)
  • user (214-256)
apps/masterbots.ai/components/routes/chat/chat-list/index.tsx (1)
apps/masterbots.ai/lib/hooks/use-chat-attachments.ts (1)
  • FileAttachment (12-24)
apps/masterbots.ai/app/c/[category]/page.tsx (1)
packages/mb-drizzle/src/drizzle/schema.ts (1)
  • category (29-36)
apps/masterbots.ai/app/api/og/route.tsx (1)
packages/mb-genql/generated/schema.ts (2)
  • Thread (2218-2249)
  • Chatbot (201-244)
apps/masterbots.ai/components/routes/chat/chat-message.tsx (1)
apps/masterbots.ai/lib/utils.ts (1)
  • cn (9-11)
apps/masterbots.ai/lib/hooks/use-mb-chat.tsx (2)
apps/masterbots.ai/lib/hooks/use-chat-attachments.ts (1)
  • FileAttachment (12-24)
apps/masterbots.ai/lib/constants/prompts.ts (1)
  • followingQuestionsPrompt (84-133)
apps/masterbots.ai/components/routes/chat/chat-list/message-pairs.tsx (1)
apps/masterbots.ai/lib/hooks/use-chat-attachments.ts (1)
  • FileAttachment (12-24)
apps/masterbots.ai/app/(browse)/[category]/page.tsx (1)
packages/mb-drizzle/src/drizzle/schema.ts (1)
  • category (29-36)
🔇 Additional comments (13)
apps/masterbots.ai/app/c/[category]/[domain]/page.tsx (1)

41-41: Consistent SEO terminology update
Replaced “category” with “topic” in the metadata description to align with site-wide terminology.

apps/masterbots.ai/app/(browse)/[category]/page.tsx (1)

49-49: SEO description terminology alignment
Changed “category” to “topic” in the browse metadata description for consistency across pages.

apps/masterbots.ai/app/c/[category]/page.tsx (1)

55-55: SEO metadata wording update
Updated description string to use “topic” instead of “category” on the chat category page.

apps/masterbots.ai/app/(browse)/[category]/[domain]/page.tsx (1)

37-37: SEO description terminology update
Replaced “category” with “topic” in the domain browse page metadata to maintain consistent language.

apps/masterbots.ai/components/shared/image-message.tsx (1)

26-26: Full-width layout applied correctly. Adding w-full via cn aligns with other components and ensures the image message container spans the full width as intended.

apps/masterbots.ai/components/shared/shared-accordion.tsx (1)

404-404: Styling update is correct. Adding w-full ensures the accordion trigger content spans the full width, maintaining consistency with other components. No functional changes introduced.

apps/masterbots.ai/components/routes/chat/reasoning/reasoning-chat-message.tsx (1)

51-54: w-full addition looks good.

Extending the wrapper to full width aligns this component with the rest of the chat list changes and avoids unexpected right-side padding. No further concerns.

apps/hasura/migrations/masterbots/1750105008677_function_update_thread_on_new_message/down.sql (1)

2-7: Down-migration looks solid

The trigger/function names and the order of drops match the typical reverse of the up-migration.
No issues spotted.

apps/masterbots.ai/services/hasura/hasura.service.ts (2)

315-316: Null updatedAt values may surface

Existing rows created before this migration have updated_at = NULL. Ordering DESC will push them to the bottom in Postgres, which is fine, but any NOT NULL constraint or default should be set to avoid inconsistent sort behaviour.

Confirm an UPDATE thread SET updated_at = created_at WHERE updated_at IS NULL; is executed in the corresponding up-migration.

Also applies to: 850-851


1008-1011: Type widening: new bio field

Adding bio is harmless, but ensure types/User includes the optional bio?: string property; otherwise TypeScript consumers will complain.

apps/masterbots.ai/lib/hooks/use-mb-chat.tsx (1)

965-982: Good catch making attachments always an array

Replacing a possible undefined with [] for messageAttachments.current avoids several ?. gymnastics later and keeps the type invariant (FileAttachment[]).
The new ternary for the prompt selection also reads clearer.

No other concerns here.

apps/hasura/migrations/masterbots/1750105008677_function_update_thread_on_new_message/up.sql (1)

6-8: Confirm column name – thread_id may not exist on thread table

The UPDATE statement targets thread.thread_id, yet in most schemas the primary key column is simply id.
If the column is actually id, this migration will fail at runtime.

-UPDATE thread 
-SET updated_at = NOW() 
-WHERE thread_id = COALESCE(NEW.thread_id, OLD.thread_id);
+UPDATE thread
+SET    updated_at = NOW()
+WHERE  id = COALESCE(NEW.thread_id, OLD.thread_id);

Please verify the exact column name in the thread table before running the migration.

apps/masterbots.ai/components/routes/chat/chat-list/message-pair-accordion.tsx (1)

162-165: Controlled vs uncontrolled prop collision

<SharedAccordion> receives both defaultState and the controlled isOpen prop.
React components generally expect one or the other; passing both can trigger a controlled/uncontrolled warning if SharedAccordion forwards the props directly to a native element or to @radix-ui/accordion.

Verify that SharedAccordion explicitly supports this dual-prop pattern, otherwise drop defaultState and rely solely on isOpen / onToggle.

Comment on lines +1 to +4
-- Could not auto-generate a down migration.
-- Please write an appropriate down migration for the SQL below:
-- alter table "public"."chatbot" add column "disabled" boolean
-- null default 'false';
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue

Supply the missing down-migration.

Without a reversible step, rolling back this migration will fail and leave the database in an inconsistent state.

-- Please write an appropriate down migration for the SQL below:
-- alter table "public"."chatbot" add column "disabled" boolean
--  null default 'false';
+alter table "public"."chatbot" drop column if exists "disabled";
🤖 Prompt for AI Agents
In
apps/hasura/migrations/masterbots/1750112474878_alter_table_public_chatbot_add_column_disabled/down.sql
at lines 1 to 4, the down migration is missing for the added "disabled" boolean
column. To fix this, write a SQL statement that drops the "disabled" column from
the "public"."chatbot" table, ensuring the migration can be rolled back cleanly.

Comment on lines +65 to 70
// ? Adding delay to avoid instant re-clicks and state reset callbacks
const timeout = setTimeout(() => {
setClicked(false)
clearTimeout(timeout)
}, 1250)
},
Copy link
Contributor

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Timer cleanup & redundant clearTimeout

  1. clearTimeout(timeout) is called inside the callback after the timer has already fired – redundant.
  2. If the component unmounts before 1.25 s, the timeout is never cleared, causing a minor memory leak.

Proposed refactor:

- const timeout = setTimeout(() => {
-   setClicked(false)
-   clearTimeout(timeout)
- }, 1250)
+ const id = window.setTimeout(() => setClicked(false), 1250)

…and store id in a useRef with a useEffect cleanup:

const timeoutRef = useRef<number>()
useEffect(() => () => clearTimeout(timeoutRef.current), [])
🤖 Prompt for AI Agents
In apps/masterbots.ai/components/routes/chat/chat-message.tsx around lines 65 to
70, remove the redundant clearTimeout call inside the timeout callback since the
timer has already fired. Instead, store the timeout ID in a useRef and add a
useEffect hook with a cleanup function that clears the timeout on component
unmount to prevent memory leaks.

Comment on lines +15 to +30
CREATE TRIGGER trigger_update_thread_on_message_insert
AFTER INSERT ON message
FOR EACH ROW
EXECUTE FUNCTION update_thread_timestamp();

-- Create trigger for UPDATE operations on message table
CREATE TRIGGER trigger_update_thread_on_message_update
AFTER UPDATE ON message
FOR EACH ROW
EXECUTE FUNCTION update_thread_timestamp();

-- Create trigger for DELETE operations on message table
CREATE TRIGGER trigger_update_thread_on_message_delete
AFTER DELETE ON message
FOR EACH ROW
EXECUTE FUNCTION update_thread_timestamp();
Copy link
Contributor

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Combine the three row-level triggers into one statement-level trigger

You create three almost-identical AFTER triggers. For high-volume inserts (e.g. bulk imports) this means one row update per message, which can become a write-amplification hotspot on the thread row.
Consider a single statement-level trigger instead:

-- after each statement touching `message`, mark the distinct threads once
CREATE OR REPLACE FUNCTION update_thread_timestamp_stmt()
RETURNS TRIGGER AS $$
BEGIN
  UPDATE thread
  SET    updated_at = NOW()
  WHERE  id IN (SELECT DISTINCT COALESCE(NEW.thread_id, OLD.thread_id) FROM message);
  RETURN NULL;
END;
$$ LANGUAGE plpgsql;

CREATE TRIGGER trig_update_thread_on_message
  AFTER INSERT OR UPDATE OR DELETE ON message
  REFERENCING NEW TABLE AS newtbl OLD TABLE AS oldtbl
  FOR EACH STATEMENT
  EXECUTE FUNCTION update_thread_timestamp_stmt();

This reduces redundant updates and row locks.

🤖 Prompt for AI Agents
In
apps/hasura/migrations/masterbots/1750105008677_function_update_thread_on_new_message/up.sql
between lines 15 and 30, you currently have three separate row-level triggers
for INSERT, UPDATE, and DELETE on the message table, which causes excessive
updates and write amplification. Replace these with a single statement-level
trigger that fires once per statement affecting the message table. Create a new
trigger function that updates the thread timestamps based on distinct thread IDs
from the affected rows, then define one AFTER INSERT OR UPDATE OR DELETE trigger
using REFERENCING NEW TABLE and OLD TABLE to pass affected rows to the function,
and set it FOR EACH STATEMENT to reduce redundant updates and improve
performance.

Copy link

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey @AndlerRL - I've reviewed your changes - here's some feedback:

  • There’s a lot of duplicated if (appConfig.features.devMode) console.error(...) logic—consider pulling that into a small helper wrapper to DRY up the URL builders.
  • The followingQuestionsPrompt still contains a “BUG FOUND” comment and inline TODO—please resolve the root issue and remove the debug markers before merging.
  • The SQL placeholders in the down migrations for promo_code and disabled columns should be replaced with actual DROP statements to ensure rollback works correctly.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- There’s a lot of duplicated `if (appConfig.features.devMode) console.error(...)` logic—consider pulling that into a small helper wrapper to DRY up the URL builders.
- The `followingQuestionsPrompt` still contains a “BUG FOUND” comment and inline TODO—please resolve the root issue and remove the debug markers before merging.
- The SQL placeholders in the down migrations for `promo_code` and `disabled` columns should be replaced with actual DROP statements to ensure rollback works correctly.

## Individual Comments

### Comment 1
<location> `apps/masterbots.ai/app/layout.tsx:76` </location>
<code_context>
-				alt: 'Masterbots',
-			},
-		],
+		images: [`${process.env.BASE_URL || ''}/api/og`],
 	},
 	twitter: {
</code_context>

<issue_to_address>
OpenGraph images now provided as strings only

This change may cause issues with OG tags or missing alt text, as the Metadata API typically requires image objects with properties like `url`, `width`, `height`, and `alt`.
</issue_to_address>

### Comment 2
<location> `apps/masterbots.ai/lib/constants/prompts.ts:104` </location>
<code_context>
 	const lastQuestionString = hasResponseIndex
 		? questions[responseIndex - 1]?.content || ''
-		: questions.filter((m) => m.role === 'user').pop()?.content || ''
+		: questions.filter((m) => m.role === 'user').pop()?.content || '' // ! ————BUG FOUND————
+	// ! The lastResponseString doesn't show up on the first continuous response—which is
+	// ! creating a new thread based on another thread from public threads)
</code_context>

<issue_to_address>
Debug comments left in production code

Please remove the debug comments and either address the last-question logic issue now or document it in an issue tracker to keep the codebase clean.
</issue_to_address>

### Comment 3
<location> `apps/hasura/migrations/masterbots/1750112413158_alter_table_public_user_add_column_promo_code/down.sql:1` </location>
<code_context>
+-- Could not auto-generate a down migration.
+-- Please write an appropriate down migration for the SQL below:
+-- alter table "public"."user" add column "promo_code" text
</code_context>

<issue_to_address>
Missing rollback statement for `promo_code`

Include `ALTER TABLE public.user DROP COLUMN promo_code;` in the down migration to ensure the new column is removed during rollback.
</issue_to_address>

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

alt: 'Masterbots',
},
],
images: [`${process.env.BASE_URL || ''}/api/og`],
Copy link

Choose a reason for hiding this comment

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

issue (bug_risk): OpenGraph images now provided as strings only

This change may cause issues with OG tags or missing alt text, as the Metadata API typically requires image objects with properties like url, width, height, and alt.

const lastQuestionString = hasResponseIndex
? questions[responseIndex - 1]?.content || ''
: questions.filter((m) => m.role === 'user').pop()?.content || ''
: questions.filter((m) => m.role === 'user').pop()?.content || '' // ! ————BUG FOUND————
Copy link

Choose a reason for hiding this comment

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

nitpick: Debug comments left in production code

Please remove the debug comments and either address the last-question logic issue now or document it in an issue tracker to keep the codebase clean.

@@ -0,0 +1,4 @@
-- Could not auto-generate a down migration.
Copy link

Choose a reason for hiding this comment

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

issue (bug_risk): Missing rollback statement for promo_code

Include ALTER TABLE public.user DROP COLUMN promo_code; in the down migration to ensure the new column is removed during rollback.

@AndlerRL AndlerRL merged commit 9cf9740 into develop Jun 17, 2025
1 of 2 checks passed
@AndlerRL AndlerRL deleted the chore-upt-mb-logo-slogan branch June 17, 2025 01:38
AndlerRL added a commit that referenced this pull request Jun 17, 2025
…512)

* fix: change toggler wording + util hook (#424)

* impr: makes threads open on profile page and profile tweaks (#421)

* update

* fix: update

* update

* update

* update

* update

* fix: opening threads

* fix: rm threads dropdwon  & added back link to bot page thread view page

* fix: rm threads dropdwon  & added back link to bot page thread view page

* fix: update

* fix: added back to profile page

* fix: added sticky and color

* fix: codeblock ctas refactor markdown rendering, sidebar nav, code block & clipboard hook (#425)

* fix: codeblock ctas

* fix: ts build

* fix: continue thread + allMessages sequence + mobile chat css tweak (#426)

* fix: css handleCLick condition

* fix: get latest search params, continuous thread

* fix(impr): all messages sorting

* perf(impr): sign in & up redirection tweak

* perf(impr): mobile chat css

* chore: next + react security ver upt (#427)

* refactor: use chat and continue thread + continue conversation fallback (#432)

* refactor: use chat and continue generation

* fix: uniq slug and id gen (#433)

* fix: uniq thread + msg slug gen

* style: formatting

* fix: thread user attachments state upt

* perf: impr thread component at all pages + mobile tweaks

* refactor: thread-component card

* chore: restore continue generation v1

* feat(impr): thread component card

* fix: admin panel n actions

* fix: fetch getThreads

* chore: continue conversation v1.2

* chore: continue and update thread content

* chore: add ui control continue generation state

* chore: fix infinity loop

* chore(impr): enable upt msg table permission

* fix: seo thread fetch

* chore: style formating

* fix(impr): continued thread title + thread component reusability

* chore: refactor loadings + extending sonners

---------

Co-authored-by: bran18 <andreyfdez18@gmail.com>

---------

Co-authored-by: Roberto Lucas <andler@bitcash.org>

* feat: add gemini provider (#437)

* feat: add gemini provider

* chore: update icons

* feat: impr continuing thread tags + accordion first msg toggle (#435)

* feat(wip): impr continuing thread tags + accordion first msg toggle

* feat(impr): continuing thread tags + accordion at first message + header mobile tweak

* style(impr): mobile thread-component x-axis space

* perf(style): coderabbitai feedbacks

* fix: css typo

* perf: sendMessageFromResponse clicked guard + continued thread tags label tweak

* chore: user thread panel clean up

* fix: user-thread-panel infinite loader

* perf: impr shared accordion animation and ux

* style: defaultAccordionState comments loc

* fix: record type warning, hasura updateMessage

* fix: getThread user data, shared-accordion

* fix: coderabbitai observations

* fix: impr file management per llm, multimodel feat flag, chat tool labels, parent thread guard

* fix: tunningUserContent parentThread condition

* fix: feature flag typo

* feat: profile page thread popup feature flag and tweaks  (#434)

* update

* fix: update

* update

* update

* update

* update

* refactor: profile page threads pop up

* fix: update config

* fix: update

* fix: update

* fix: make profile page scroll on hero

* fix: bot make popup and scroll

* fix: make profile page sidebar scroll independently

* fix: make profile page sidebar scroll independently

* fix: check the category along the chatbot when it's not checked

* fix: check the category along the chatbot when it's not checked

---------

Co-authored-by: Roberto Lucas <andler.dev@gmail.com>
Co-authored-by: Roberto Lucas <andler@bitcash.org>

* feat: add new llm models (#444)

* feat-add-models

* feat-add-models

* feat-add-models

* chore: add model

* fix: typo

* chore: add toggler color

* perf(impr): thread llm context, last question & response + new models seeds (#447)

* feat(wip): thread llm context, prev questions

* fix: previousQuestionsString slice

* fix: clickedContentId in followingQuestionsPrompt

* feat: isContinued + model type in message table

* fix: ts typo + sendMessageFromResponse callback call

* fix: ts typo

* fix: bot profile page view (#449)

* fix(wip): bot profile thread list

* style: formatting

* fix: new chats and share + og img (#451)

* fix: new chat state reset

* fix: genql gen + share link check

* fix: og img

* fix: duplicate role permission in msg table

* feat: initial continuation logic flow (#450)

* chore: restore base version

* chore: add new logic and hooks

* chore: fix providers file

* chore: improve continuation prompt

* chore: add exlucision flag

* chore: add better handler

* chore: updated flow + experimental delay

* chore: extended time

* chore(impr): streamDelayMs experimental feat flag

* style: formatting

---------

Co-authored-by: Roberto Lucas <andler.dev@gmail.com>

* fix: profile sidebar cat opt render (#453)

* fix: profile sidebar cat opt render

* chore: clean-up

* [masterbots.ai] refactor: slug generation logic with improved uniqueness and type support (#456)

* fix: slugify fn

* chore: devMode logs

* fix: uniq slug gen fn nanoid flag typo

* feat: sentry logs in webapp (#457)

* fix(impr): llm enum data, thread creation, ts, and log behavior (#458)

* fix: slugify first request delay incr + genql ts, seeds & model migration upt

* fix: create thread & msg ts

* fix(impr): profile page bugs & tweaks v1 4/15/25 (#455)

* update

* fix: update

* update

* update

* update

* update

* fix: use the user avatar or robohash

* fix: added avater to user menu

* fix: user avatar

* fix: reset search input when filter by category or chatbot

* fix: personal chat browse provider + username chk in sign up

* chore: clean duplicated if condition signup

---------

Co-authored-by: Roberto Lucas <andler.dev@gmail.com>

* refactor: continuation flow (#460)

* impr: continuation logic flow

* impr: continuation logic flow

* chore: update createImprovementPrompt

* chore: upt logs

---------

Co-authored-by: Roberto Lucas <andler.dev@gmail.com>

* feat: models table, enum type, and refactor chat msg deduplication logic (#462)

* feat: models table

* style: formatting

* fix: continuation accordion content

* fix: sql + metadata typo

* fix: db migrations and messages uniqby condition (#463)

* fix: db migrations + messages uniqby condition

* fix: typo

* perf(impr): verify duplicate message return condition

* chore: upt default available models

* perf(impr): reassign continued prompt

* chore: incr fn stream max duration

* fix: mob prof sidebar + sign-up pw verif + username chk (#464)

* fix: mob prof sidebar + sign-up pw verif + username chk

* chore: upt genql gen

* perf(impr): profile navigation

* feat: model selector (#466)

* wip: model selector query

* wip: model selector query

* chore: improve funtions

* chore: add coderabbit suggestion

* chore: add hasura permissions, models table

* style: formatting

* chore: fix get model client type

* chore: add model

---------

Co-authored-by: Roberto Romero Lucas <contact@andler.dev>

* chore: impr models (#472)

* chore: fix model name and condition (#473)

* refactor: user fetching code (#471)

* refactor: profile sidebar ui, upt styling, and disable prefetch (#470)

* chore: remove prefetch on sidebar & profile navigation

* perf: impr profile sidebar

* fix: infinite scroll load more fetch

* perf(impr): google sign-in

* perf(impr): session loaders tweak

* perf: impr categoriesId obtention

* fix: tailwind typo

* chore(impr): pro user guard in model selector

* chore: category label upt to topic

* chore: rm dev mode guard (#476)

* feat: add reasoning compatibility (#480)

* feat: add resoning stable

* chore: add reasoning stable v

* chore: activate reasoning

* chore: activate reasoning

* feat: pro users whitelist (#481)

* feat(wip): whitelist pro users

* chore: add whitelist pro users + page size fetch

* perf(impr): following question impr prompt

* fix: pro whitelist users clean up

* feat: user account setting  (#468)

* update

* fix: update

* update

* update

* update

* update

* feat: imple account setting

* feat: added dialog to delete button

* feat: update user deletion func

* fix: move back exmaples files

* fix: update

* fix: user account scheduling api

* fix: user account deletion request function

* refactor: account deletion request api

* fix: user account request and thread deletion

* fix: added permission and account deletion page

* fix: update on permission

* fix: enable new col permission

* fix: profile side bar

* fix: update

* fix: function rerendering

* fix: update route

* chore(impr): preferences actions and ui tweaks

---------

Co-authored-by: Roberto Lucas <andler.dev@gmail.com>

* chore: enable twitter pixel track (#479)

* chore: enable twitter pixel track

* perf(impr): twitter ads availability + dynamic config

* feat: impr profile navigation page (#478)

* fix(wip): subscriptions page render

* feat(impr): profile navigation + page ui tweaks

* style: lintin + formatting

* style(css): nav links px on mob

* fix: goToProfile in mob prof sidebar

* fix: build

* fix: thread popup opening at nav

* chore: enable preferences nav on prod

* feat: image generation  (#486)

* feat: add image generation support - gemini provider

* chore: add mineType

* chore: add conditional checks

* chore: upt model enums & list

* chore: hasura, set icl seeds chunks (#484)

* chore: hasura, set icl seeds chunks

* chore: track backup icl seed loc to lfs

* chore(seeds): uncomment phase 3 topics & add new chatbots + icl metadata rel

* chore: upt phase 3 init config seeds, adding rel

* fix: example seeds integrity

* test: incr hasura max req body

* revert: cloudbuild og config

* chore: restore skipped seed lines

* fix: thread rendering (#487)

* fix: thread list render states

* chore: linting & format

* fix: thread pop-up on refresh

* fix: user table selection

* fix(impr): type safety for image data and refactor model enums in chat (#489)

* fix: image generation flow

* chore: impr gemini generation logic

* fix: build issue

* chore: change subscription page

* chore: change subscription page + lint

* chore: user pref disable options

---------

Co-authored-by: bran18 <andreyfdez18@gmail.com>

* fix: add hotfix image generation

* chore: add more image models

* fix: models_enum values + genql upt

* feat: improved subscription section (#491)

* feat: add improved subscription section

* feat: add type

* chore: add conditional dislay

* feat: add username tags

* chore: add new order and benefits

* fix: thread empty state on user profile (#490)

* update

* fix: update

* update

* update

* update

* update

* feat: added empty state to user profile page

* feat: added empty state to user profile page

* fix: update

* fix: update

* fix: account creation slug issue

* chore: restore public models table select permissions + clean up

---------

Co-authored-by: Roberto Lucas <andler@bitcash.org>
Co-authored-by: Roberto Lucas <andler.dev@gmail.com>

* feat(wip): web search v2 (#494)

* feat(wip): web search

* feat(wip): thread config actions

* feat(wip): share cta impr

* chore: upt domain slugs list

* chore: comment legacy getWebSearchTool

* fix: preference insert

* wip: user preferences set

* fix: typo

* fix: updateUser data upt

* fix: pref table sel (#496)

* fix: og render + tweaks (#492)

* fix: og render + tweaks

* fix: zIndex in og

* perf: impr defaultOgImage chk

* chore: bun lock upt

* chore: next-auth patch upt

* fix: app build by mv uuidregexp loc

* fix: drizzle service actions loc + msg slug check + msg uniqueness (#499)

* [masterbots.ai] chore: standarize pop-up on profile & bot page for thread display (#500)

* update

* fix: update

* update

* update

* update

* update

* fix: added popup to thread view page on user profile(both on page reload)

* fix: added popup to thread view page on user profile(both on page reload)

* fix: added profile link to thread share

* fix: update

* fix: chatbot page thread pop-up

* fix: update

* fix: appendMessage concurrency + getBrowseThreads admin mode chk (#505)

* feat: attachment thread metadata (#502)

* feat(wip): track thread attch data

* chore: upt drizzle & genql schemas

* feat(wip): save user attachments on load chk

* perf: file upload throughout indexed db hook

* feat(wip): gcp bucket setup

* feat: enlarge thread attachment

* fix: attachment upload loop

* fix: gcloud storage + thread metadata check & upload

* fix: bucket upload + after upload mutations

* feat: store remote thread metadata to indexeddb

* fix: read file content instead url

* fix(wip): get attachments on chat onFinish

* fix: attach new stack of files to chat

* [masterbots.ai] fix: og card dimensions and spacing + profile props (#506)

* fix: og card dimensions and spacing + profile props

* fix: og card dimensions + profile props

* perf(impr): rm long usernames + autogen num + form input control

* perf: dynamic short username number gen

* chore(impr): update default thread publicity flag + attachments concurrency & render (#508)

* chore(impr): update default thread publicity flag

* fix: default thread publicity

* fix: ai generated formulas

* fix: eslint rule, display name in markdown

* fix: eslint rule, display name in markdown

* fix: following questions prompt + isNewThread guard

* fix: attachments render && concurrency + optimistic activeThread updates

* fix: build

* perf(impr): earlier downloadedAttachments array upt

* chore(impr): clean remote processed ids, indexeddb attachments

* fix: user should be able to delete threads (#507)

* update

* fix: update

* update

* update

* update

* update

* fix: user can delete thread

* fix: delete thread messages

* fix: update

* fix: obs update

* chore: file clean up

---------

Co-authored-by: Roberto 'Andler' Lucas <contact@andler.dev>

* [masterbots.ai] feat: image generation support (#504)

* feat: add support to image generation

* feat: add GPT-image-1 support route

* feat: fix biome lint

* feat: add edit mode

* chore: enable img gen feature flag

* style: format n lint

---------

Co-authored-by: Roberto 'Andler' Lucas <contact@andler.dev>

* fix: bun lock

* fix: ts build

* fix(impr): continuos thread render, 2nd ai res, ui tweaks (#511)

* chore(impr): mb logo wip + threads add order by update at

* feat(impr): update thread on message activity + fix order by updated at

* fix: thread pop-up default opened accordion

* perf(impr): add user promo code track + chatbot disabled flag

* fix: 2nd ai concurrent request + continuous thread context & render

---------

Co-authored-by: Brandon Fernández <31634868+Bran18@users.noreply.github.com>
Co-authored-by: Jimoh sherifdeen <63134009+sheriffjimoh@users.noreply.github.com>
Co-authored-by: bran18 <andreyfdez18@gmail.com>
Co-authored-by: Brandon fernandez <brandonfernandez@Brandons-Mac-mini.local>
AndlerRL added a commit that referenced this pull request Jun 17, 2025
* fix: change toggler wording + util hook (#424)

* impr: makes threads open on profile page and profile tweaks (#421)

* update

* fix: update

* update

* update

* update

* update

* fix: opening threads

* fix: rm threads dropdwon  & added back link to bot page thread view page

* fix: rm threads dropdwon  & added back link to bot page thread view page

* fix: update

* fix: added back to profile page

* fix: added sticky and color

* fix: codeblock ctas refactor markdown rendering, sidebar nav, code block & clipboard hook (#425)

* fix: codeblock ctas

* fix: ts build

* fix: continue thread + allMessages sequence + mobile chat css tweak (#426)

* fix: css handleCLick condition

* fix: get latest search params, continuous thread

* fix(impr): all messages sorting

* perf(impr): sign in & up redirection tweak

* perf(impr): mobile chat css

* chore: next + react security ver upt (#427)

* refactor: use chat and continue thread + continue conversation fallback (#432)

* refactor: use chat and continue generation

* fix: uniq slug and id gen (#433)

* fix: uniq thread + msg slug gen

* style: formatting

* fix: thread user attachments state upt

* perf: impr thread component at all pages + mobile tweaks

* refactor: thread-component card

* chore: restore continue generation v1

* feat(impr): thread component card

* fix: admin panel n actions

* fix: fetch getThreads

* chore: continue conversation v1.2

* chore: continue and update thread content

* chore: add ui control continue generation state

* chore: fix infinity loop

* chore(impr): enable upt msg table permission

* fix: seo thread fetch

* chore: style formating

* fix(impr): continued thread title + thread component reusability

* chore: refactor loadings + extending sonners

---------

Co-authored-by: bran18 <andreyfdez18@gmail.com>

---------

Co-authored-by: Roberto Lucas <andler@bitcash.org>

* feat: add gemini provider (#437)

* feat: add gemini provider

* chore: update icons

* feat: impr continuing thread tags + accordion first msg toggle (#435)

* feat(wip): impr continuing thread tags + accordion first msg toggle

* feat(impr): continuing thread tags + accordion at first message + header mobile tweak

* style(impr): mobile thread-component x-axis space

* perf(style): coderabbitai feedbacks

* fix: css typo

* perf: sendMessageFromResponse clicked guard + continued thread tags label tweak

* chore: user thread panel clean up

* fix: user-thread-panel infinite loader

* perf: impr shared accordion animation and ux

* style: defaultAccordionState comments loc

* fix: record type warning, hasura updateMessage

* fix: getThread user data, shared-accordion

* fix: coderabbitai observations

* fix: impr file management per llm, multimodel feat flag, chat tool labels, parent thread guard

* fix: tunningUserContent parentThread condition

* fix: feature flag typo

* feat: profile page thread popup feature flag and tweaks  (#434)

* update

* fix: update

* update

* update

* update

* update

* refactor: profile page threads pop up

* fix: update config

* fix: update

* fix: update

* fix: make profile page scroll on hero

* fix: bot make popup and scroll

* fix: make profile page sidebar scroll independently

* fix: make profile page sidebar scroll independently

* fix: check the category along the chatbot when it's not checked

* fix: check the category along the chatbot when it's not checked

---------

Co-authored-by: Roberto Lucas <andler.dev@gmail.com>
Co-authored-by: Roberto Lucas <andler@bitcash.org>

* feat: add new llm models (#444)

* feat-add-models

* feat-add-models

* feat-add-models

* chore: add model

* fix: typo

* chore: add toggler color

* perf(impr): thread llm context, last question & response + new models seeds (#447)

* feat(wip): thread llm context, prev questions

* fix: previousQuestionsString slice

* fix: clickedContentId in followingQuestionsPrompt

* feat: isContinued + model type in message table

* fix: ts typo + sendMessageFromResponse callback call

* fix: ts typo

* fix: bot profile page view (#449)

* fix(wip): bot profile thread list

* style: formatting

* fix: new chats and share + og img (#451)

* fix: new chat state reset

* fix: genql gen + share link check

* fix: og img

* fix: duplicate role permission in msg table

* feat: initial continuation logic flow (#450)

* chore: restore base version

* chore: add new logic and hooks

* chore: fix providers file

* chore: improve continuation prompt

* chore: add exlucision flag

* chore: add better handler

* chore: updated flow + experimental delay

* chore: extended time

* chore(impr): streamDelayMs experimental feat flag

* style: formatting

---------

Co-authored-by: Roberto Lucas <andler.dev@gmail.com>

* fix: profile sidebar cat opt render (#453)

* fix: profile sidebar cat opt render

* chore: clean-up

* [masterbots.ai] refactor: slug generation logic with improved uniqueness and type support (#456)

* fix: slugify fn

* chore: devMode logs

* fix: uniq slug gen fn nanoid flag typo

* feat: sentry logs in webapp (#457)

* fix(impr): llm enum data, thread creation, ts, and log behavior (#458)

* fix: slugify first request delay incr + genql ts, seeds & model migration upt

* fix: create thread & msg ts

* fix(impr): profile page bugs & tweaks v1 4/15/25 (#455)

* update

* fix: update

* update

* update

* update

* update

* fix: use the user avatar or robohash

* fix: added avater to user menu

* fix: user avatar

* fix: reset search input when filter by category or chatbot

* fix: personal chat browse provider + username chk in sign up

* chore: clean duplicated if condition signup

---------

Co-authored-by: Roberto Lucas <andler.dev@gmail.com>

* refactor: continuation flow (#460)

* impr: continuation logic flow

* impr: continuation logic flow

* chore: update createImprovementPrompt

* chore: upt logs

---------

Co-authored-by: Roberto Lucas <andler.dev@gmail.com>

* feat: models table, enum type, and refactor chat msg deduplication logic (#462)

* feat: models table

* style: formatting

* fix: continuation accordion content

* fix: sql + metadata typo

* fix: db migrations and messages uniqby condition (#463)

* fix: db migrations + messages uniqby condition

* fix: typo

* perf(impr): verify duplicate message return condition

* chore: upt default available models

* perf(impr): reassign continued prompt

* chore: incr fn stream max duration

* fix: mob prof sidebar + sign-up pw verif + username chk (#464)

* fix: mob prof sidebar + sign-up pw verif + username chk

* chore: upt genql gen

* perf(impr): profile navigation

* feat: model selector (#466)

* wip: model selector query

* wip: model selector query

* chore: improve funtions

* chore: add coderabbit suggestion

* chore: add hasura permissions, models table

* style: formatting

* chore: fix get model client type

* chore: add model

---------

Co-authored-by: Roberto Romero Lucas <contact@andler.dev>

* chore: impr models (#472)

* chore: fix model name and condition (#473)

* refactor: user fetching code (#471)

* refactor: profile sidebar ui, upt styling, and disable prefetch (#470)

* chore: remove prefetch on sidebar & profile navigation

* perf: impr profile sidebar

* fix: infinite scroll load more fetch

* perf(impr): google sign-in

* perf(impr): session loaders tweak

* perf: impr categoriesId obtention

* fix: tailwind typo

* chore(impr): pro user guard in model selector

* chore: category label upt to topic

* chore: rm dev mode guard (#476)

* feat: add reasoning compatibility (#480)

* feat: add resoning stable

* chore: add reasoning stable v

* chore: activate reasoning

* chore: activate reasoning

* feat: pro users whitelist (#481)

* feat(wip): whitelist pro users

* chore: add whitelist pro users + page size fetch

* perf(impr): following question impr prompt

* fix: pro whitelist users clean up

* feat: user account setting  (#468)

* update

* fix: update

* update

* update

* update

* update

* feat: imple account setting

* feat: added dialog to delete button

* feat: update user deletion func

* fix: move back exmaples files

* fix: update

* fix: user account scheduling api

* fix: user account deletion request function

* refactor: account deletion request api

* fix: user account request and thread deletion

* fix: added permission and account deletion page

* fix: update on permission

* fix: enable new col permission

* fix: profile side bar

* fix: update

* fix: function rerendering

* fix: update route

* chore(impr): preferences actions and ui tweaks

---------

Co-authored-by: Roberto Lucas <andler.dev@gmail.com>

* chore: enable twitter pixel track (#479)

* chore: enable twitter pixel track

* perf(impr): twitter ads availability + dynamic config

* feat: impr profile navigation page (#478)

* fix(wip): subscriptions page render

* feat(impr): profile navigation + page ui tweaks

* style: lintin + formatting

* style(css): nav links px on mob

* fix: goToProfile in mob prof sidebar

* fix: build

* fix: thread popup opening at nav

* chore: enable preferences nav on prod

* feat: image generation  (#486)

* feat: add image generation support - gemini provider

* chore: add mineType

* chore: add conditional checks

* chore: upt model enums & list

* chore: hasura, set icl seeds chunks (#484)

* chore: hasura, set icl seeds chunks

* chore: track backup icl seed loc to lfs

* chore(seeds): uncomment phase 3 topics & add new chatbots + icl metadata rel

* chore: upt phase 3 init config seeds, adding rel

* fix: example seeds integrity

* test: incr hasura max req body

* revert: cloudbuild og config

* chore: restore skipped seed lines

* fix: thread rendering (#487)

* fix: thread list render states

* chore: linting & format

* fix: thread pop-up on refresh

* fix: user table selection

* fix(impr): type safety for image data and refactor model enums in chat (#489)

* fix: image generation flow

* chore: impr gemini generation logic

* fix: build issue

* chore: change subscription page

* chore: change subscription page + lint

* chore: user pref disable options

---------

Co-authored-by: bran18 <andreyfdez18@gmail.com>

* fix: add hotfix image generation

* chore: add more image models

* fix: models_enum values + genql upt

* feat: improved subscription section (#491)

* feat: add improved subscription section

* feat: add type

* chore: add conditional dislay

* feat: add username tags

* chore: add new order and benefits

* fix: thread empty state on user profile (#490)

* update

* fix: update

* update

* update

* update

* update

* feat: added empty state to user profile page

* feat: added empty state to user profile page

* fix: update

* fix: update

* fix: account creation slug issue

* chore: restore public models table select permissions + clean up

---------

Co-authored-by: Roberto Lucas <andler@bitcash.org>
Co-authored-by: Roberto Lucas <andler.dev@gmail.com>

* feat(wip): web search v2 (#494)

* feat(wip): web search

* feat(wip): thread config actions

* feat(wip): share cta impr

* chore: upt domain slugs list

* chore: comment legacy getWebSearchTool

* fix: preference insert

* wip: user preferences set

* fix: typo

* fix: updateUser data upt

* fix: pref table sel (#496)

* fix: og render + tweaks (#492)

* fix: og render + tweaks

* fix: zIndex in og

* perf: impr defaultOgImage chk

* chore: bun lock upt

* chore: next-auth patch upt

* fix: app build by mv uuidregexp loc

* fix: drizzle service actions loc + msg slug check + msg uniqueness (#499)

* [masterbots.ai] chore: standarize pop-up on profile & bot page for thread display (#500)

* update

* fix: update

* update

* update

* update

* update

* fix: added popup to thread view page on user profile(both on page reload)

* fix: added popup to thread view page on user profile(both on page reload)

* fix: added profile link to thread share

* fix: update

* fix: chatbot page thread pop-up

* fix: update

* fix: appendMessage concurrency + getBrowseThreads admin mode chk (#505)

* feat: attachment thread metadata (#502)

* feat(wip): track thread attch data

* chore: upt drizzle & genql schemas

* feat(wip): save user attachments on load chk

* perf: file upload throughout indexed db hook

* feat(wip): gcp bucket setup

* feat: enlarge thread attachment

* fix: attachment upload loop

* fix: gcloud storage + thread metadata check & upload

* fix: bucket upload + after upload mutations

* feat: store remote thread metadata to indexeddb

* fix: read file content instead url

* fix(wip): get attachments on chat onFinish

* fix: attach new stack of files to chat

* [masterbots.ai] fix: og card dimensions and spacing + profile props (#506)

* fix: og card dimensions and spacing + profile props

* fix: og card dimensions + profile props

* perf(impr): rm long usernames + autogen num + form input control

* perf: dynamic short username number gen

* chore(impr): update default thread publicity flag + attachments concurrency & render (#508)

* chore(impr): update default thread publicity flag

* fix: default thread publicity

* fix: ai generated formulas

* fix: eslint rule, display name in markdown

* fix: eslint rule, display name in markdown

* fix: following questions prompt + isNewThread guard

* fix: attachments render && concurrency + optimistic activeThread updates

* fix: build

* perf(impr): earlier downloadedAttachments array upt

* chore(impr): clean remote processed ids, indexeddb attachments

* fix: user should be able to delete threads (#507)

* update

* fix: update

* update

* update

* update

* update

* fix: user can delete thread

* fix: delete thread messages

* fix: update

* fix: obs update

* chore: file clean up

---------

Co-authored-by: Roberto 'Andler' Lucas <contact@andler.dev>

* [masterbots.ai] feat: image generation support (#504)

* feat: add support to image generation

* feat: add GPT-image-1 support route

* feat: fix biome lint

* feat: add edit mode

* chore: enable img gen feature flag

* style: format n lint

---------

Co-authored-by: Roberto 'Andler' Lucas <contact@andler.dev>

* fix: bun lock

* fix: ts build

* fix(impr): continuos thread render, 2nd ai res, ui tweaks (#511)

* chore(impr): mb logo wip + threads add order by update at

* feat(impr): update thread on message activity + fix order by updated at

* fix: thread pop-up default opened accordion

* perf(impr): add user promo code track + chatbot disabled flag

* fix: 2nd ai concurrent request + continuous thread context & render

* [masterbots.ai] perf(impr): chat opt state mngt and enhance attach metadata sync (#514)

* fix: toggle visibility fn state upt

* fix: file attach message ids upt

* fix: after update guard state

* fix: ts typo

* fix: thread visibility update permissions

* chore(fix): enable image gen to whitelist users

---------

Co-authored-by: Brandon Fernández <31634868+Bran18@users.noreply.github.com>
Co-authored-by: Jimoh sherifdeen <63134009+sheriffjimoh@users.noreply.github.com>
Co-authored-by: bran18 <andreyfdez18@gmail.com>
Co-authored-by: Brandon fernandez <brandonfernandez@Brandons-Mac-mini.local>
@AndlerRL
Copy link
Member Author

AndlerRL commented Jul 2, 2025

sheriffjimoh pushed a commit that referenced this pull request Sep 9, 2025
* chore(impr): mb logo wip + threads add order by update at

* feat(impr): update thread on message activity + fix order by updated at

* fix: thread pop-up default opened accordion

* perf(impr): add user promo code track + chatbot disabled flag

* fix: 2nd ai concurrent request + continuous thread context & render
sheriffjimoh added a commit that referenced this pull request Sep 9, 2025
…512)

* fix: change toggler wording + util hook (#424)

* impr: makes threads open on profile page and profile tweaks (#421)

* update

* fix: update

* update

* update

* update

* update

* fix: opening threads

* fix: rm threads dropdwon  & added back link to bot page thread view page

* fix: rm threads dropdwon  & added back link to bot page thread view page

* fix: update

* fix: added back to profile page

* fix: added sticky and color

* fix: codeblock ctas refactor markdown rendering, sidebar nav, code block & clipboard hook (#425)

* fix: codeblock ctas

* fix: ts build

* fix: continue thread + allMessages sequence + mobile chat css tweak (#426)

* fix: css handleCLick condition

* fix: get latest search params, continuous thread

* fix(impr): all messages sorting

* perf(impr): sign in & up redirection tweak

* perf(impr): mobile chat css

* chore: next + react security ver upt (#427)

* refactor: use chat and continue thread + continue conversation fallback (#432)

* refactor: use chat and continue generation

* fix: uniq slug and id gen (#433)

* fix: uniq thread + msg slug gen

* style: formatting

* fix: thread user attachments state upt

* perf: impr thread component at all pages + mobile tweaks

* refactor: thread-component card

* chore: restore continue generation v1

* feat(impr): thread component card

* fix: admin panel n actions

* fix: fetch getThreads

* chore: continue conversation v1.2

* chore: continue and update thread content

* chore: add ui control continue generation state

* chore: fix infinity loop

* chore(impr): enable upt msg table permission

* fix: seo thread fetch

* chore: style formating

* fix(impr): continued thread title + thread component reusability

* chore: refactor loadings + extending sonners

---------

Co-authored-by: bran18 <andreyfdez18@gmail.com>

---------

Co-authored-by: Roberto Lucas <andler@bitcash.org>

* feat: add gemini provider (#437)

* feat: add gemini provider

* chore: update icons

* feat: impr continuing thread tags + accordion first msg toggle (#435)

* feat(wip): impr continuing thread tags + accordion first msg toggle

* feat(impr): continuing thread tags + accordion at first message + header mobile tweak

* style(impr): mobile thread-component x-axis space

* perf(style): coderabbitai feedbacks

* fix: css typo

* perf: sendMessageFromResponse clicked guard + continued thread tags label tweak

* chore: user thread panel clean up

* fix: user-thread-panel infinite loader

* perf: impr shared accordion animation and ux

* style: defaultAccordionState comments loc

* fix: record type warning, hasura updateMessage

* fix: getThread user data, shared-accordion

* fix: coderabbitai observations

* fix: impr file management per llm, multimodel feat flag, chat tool labels, parent thread guard

* fix: tunningUserContent parentThread condition

* fix: feature flag typo

* feat: profile page thread popup feature flag and tweaks  (#434)

* update

* fix: update

* update

* update

* update

* update

* refactor: profile page threads pop up

* fix: update config

* fix: update

* fix: update

* fix: make profile page scroll on hero

* fix: bot make popup and scroll

* fix: make profile page sidebar scroll independently

* fix: make profile page sidebar scroll independently

* fix: check the category along the chatbot when it's not checked

* fix: check the category along the chatbot when it's not checked

---------

Co-authored-by: Roberto Lucas <andler.dev@gmail.com>
Co-authored-by: Roberto Lucas <andler@bitcash.org>

* feat: add new llm models (#444)

* feat-add-models

* feat-add-models

* feat-add-models

* chore: add model

* fix: typo

* chore: add toggler color

* perf(impr): thread llm context, last question & response + new models seeds (#447)

* feat(wip): thread llm context, prev questions

* fix: previousQuestionsString slice

* fix: clickedContentId in followingQuestionsPrompt

* feat: isContinued + model type in message table

* fix: ts typo + sendMessageFromResponse callback call

* fix: ts typo

* fix: bot profile page view (#449)

* fix(wip): bot profile thread list

* style: formatting

* fix: new chats and share + og img (#451)

* fix: new chat state reset

* fix: genql gen + share link check

* fix: og img

* fix: duplicate role permission in msg table

* feat: initial continuation logic flow (#450)

* chore: restore base version

* chore: add new logic and hooks

* chore: fix providers file

* chore: improve continuation prompt

* chore: add exlucision flag

* chore: add better handler

* chore: updated flow + experimental delay

* chore: extended time

* chore(impr): streamDelayMs experimental feat flag

* style: formatting

---------

Co-authored-by: Roberto Lucas <andler.dev@gmail.com>

* fix: profile sidebar cat opt render (#453)

* fix: profile sidebar cat opt render

* chore: clean-up

* [masterbots.ai] refactor: slug generation logic with improved uniqueness and type support (#456)

* fix: slugify fn

* chore: devMode logs

* fix: uniq slug gen fn nanoid flag typo

* feat: sentry logs in webapp (#457)

* fix(impr): llm enum data, thread creation, ts, and log behavior (#458)

* fix: slugify first request delay incr + genql ts, seeds & model migration upt

* fix: create thread & msg ts

* fix(impr): profile page bugs & tweaks v1 4/15/25 (#455)

* update

* fix: update

* update

* update

* update

* update

* fix: use the user avatar or robohash

* fix: added avater to user menu

* fix: user avatar

* fix: reset search input when filter by category or chatbot

* fix: personal chat browse provider + username chk in sign up

* chore: clean duplicated if condition signup

---------

Co-authored-by: Roberto Lucas <andler.dev@gmail.com>

* refactor: continuation flow (#460)

* impr: continuation logic flow

* impr: continuation logic flow

* chore: update createImprovementPrompt

* chore: upt logs

---------

Co-authored-by: Roberto Lucas <andler.dev@gmail.com>

* feat: models table, enum type, and refactor chat msg deduplication logic (#462)

* feat: models table

* style: formatting

* fix: continuation accordion content

* fix: sql + metadata typo

* fix: db migrations and messages uniqby condition (#463)

* fix: db migrations + messages uniqby condition

* fix: typo

* perf(impr): verify duplicate message return condition

* chore: upt default available models

* perf(impr): reassign continued prompt

* chore: incr fn stream max duration

* fix: mob prof sidebar + sign-up pw verif + username chk (#464)

* fix: mob prof sidebar + sign-up pw verif + username chk

* chore: upt genql gen

* perf(impr): profile navigation

* feat: model selector (#466)

* wip: model selector query

* wip: model selector query

* chore: improve funtions

* chore: add coderabbit suggestion

* chore: add hasura permissions, models table

* style: formatting

* chore: fix get model client type

* chore: add model

---------

Co-authored-by: Roberto Romero Lucas <contact@andler.dev>

* chore: impr models (#472)

* chore: fix model name and condition (#473)

* refactor: user fetching code (#471)

* refactor: profile sidebar ui, upt styling, and disable prefetch (#470)

* chore: remove prefetch on sidebar & profile navigation

* perf: impr profile sidebar

* fix: infinite scroll load more fetch

* perf(impr): google sign-in

* perf(impr): session loaders tweak

* perf: impr categoriesId obtention

* fix: tailwind typo

* chore(impr): pro user guard in model selector

* chore: category label upt to topic

* chore: rm dev mode guard (#476)

* feat: add reasoning compatibility (#480)

* feat: add resoning stable

* chore: add reasoning stable v

* chore: activate reasoning

* chore: activate reasoning

* feat: pro users whitelist (#481)

* feat(wip): whitelist pro users

* chore: add whitelist pro users + page size fetch

* perf(impr): following question impr prompt

* fix: pro whitelist users clean up

* feat: user account setting  (#468)

* update

* fix: update

* update

* update

* update

* update

* feat: imple account setting

* feat: added dialog to delete button

* feat: update user deletion func

* fix: move back exmaples files

* fix: update

* fix: user account scheduling api

* fix: user account deletion request function

* refactor: account deletion request api

* fix: user account request and thread deletion

* fix: added permission and account deletion page

* fix: update on permission

* fix: enable new col permission

* fix: profile side bar

* fix: update

* fix: function rerendering

* fix: update route

* chore(impr): preferences actions and ui tweaks

---------

Co-authored-by: Roberto Lucas <andler.dev@gmail.com>

* chore: enable twitter pixel track (#479)

* chore: enable twitter pixel track

* perf(impr): twitter ads availability + dynamic config

* feat: impr profile navigation page (#478)

* fix(wip): subscriptions page render

* feat(impr): profile navigation + page ui tweaks

* style: lintin + formatting

* style(css): nav links px on mob

* fix: goToProfile in mob prof sidebar

* fix: build

* fix: thread popup opening at nav

* chore: enable preferences nav on prod

* feat: image generation  (#486)

* feat: add image generation support - gemini provider

* chore: add mineType

* chore: add conditional checks

* chore: upt model enums & list

* chore: hasura, set icl seeds chunks (#484)

* chore: hasura, set icl seeds chunks

* chore: track backup icl seed loc to lfs

* chore(seeds): uncomment phase 3 topics & add new chatbots + icl metadata rel

* chore: upt phase 3 init config seeds, adding rel

* fix: example seeds integrity

* test: incr hasura max req body

* revert: cloudbuild og config

* chore: restore skipped seed lines

* fix: thread rendering (#487)

* fix: thread list render states

* chore: linting & format

* fix: thread pop-up on refresh

* fix: user table selection

* fix(impr): type safety for image data and refactor model enums in chat (#489)

* fix: image generation flow

* chore: impr gemini generation logic

* fix: build issue

* chore: change subscription page

* chore: change subscription page + lint

* chore: user pref disable options

---------

Co-authored-by: bran18 <andreyfdez18@gmail.com>

* fix: add hotfix image generation

* chore: add more image models

* fix: models_enum values + genql upt

* feat: improved subscription section (#491)

* feat: add improved subscription section

* feat: add type

* chore: add conditional dislay

* feat: add username tags

* chore: add new order and benefits

* fix: thread empty state on user profile (#490)

* update

* fix: update

* update

* update

* update

* update

* feat: added empty state to user profile page

* feat: added empty state to user profile page

* fix: update

* fix: update

* fix: account creation slug issue

* chore: restore public models table select permissions + clean up

---------

Co-authored-by: Roberto Lucas <andler@bitcash.org>
Co-authored-by: Roberto Lucas <andler.dev@gmail.com>

* feat(wip): web search v2 (#494)

* feat(wip): web search

* feat(wip): thread config actions

* feat(wip): share cta impr

* chore: upt domain slugs list

* chore: comment legacy getWebSearchTool

* fix: preference insert

* wip: user preferences set

* fix: typo

* fix: updateUser data upt

* fix: pref table sel (#496)

* fix: og render + tweaks (#492)

* fix: og render + tweaks

* fix: zIndex in og

* perf: impr defaultOgImage chk

* chore: bun lock upt

* chore: next-auth patch upt

* fix: app build by mv uuidregexp loc

* fix: drizzle service actions loc + msg slug check + msg uniqueness (#499)

* [masterbots.ai] chore: standarize pop-up on profile & bot page for thread display (#500)

* update

* fix: update

* update

* update

* update

* update

* fix: added popup to thread view page on user profile(both on page reload)

* fix: added popup to thread view page on user profile(both on page reload)

* fix: added profile link to thread share

* fix: update

* fix: chatbot page thread pop-up

* fix: update

* fix: appendMessage concurrency + getBrowseThreads admin mode chk (#505)

* feat: attachment thread metadata (#502)

* feat(wip): track thread attch data

* chore: upt drizzle & genql schemas

* feat(wip): save user attachments on load chk

* perf: file upload throughout indexed db hook

* feat(wip): gcp bucket setup

* feat: enlarge thread attachment

* fix: attachment upload loop

* fix: gcloud storage + thread metadata check & upload

* fix: bucket upload + after upload mutations

* feat: store remote thread metadata to indexeddb

* fix: read file content instead url

* fix(wip): get attachments on chat onFinish

* fix: attach new stack of files to chat

* [masterbots.ai] fix: og card dimensions and spacing + profile props (#506)

* fix: og card dimensions and spacing + profile props

* fix: og card dimensions + profile props

* perf(impr): rm long usernames + autogen num + form input control

* perf: dynamic short username number gen

* chore(impr): update default thread publicity flag + attachments concurrency & render (#508)

* chore(impr): update default thread publicity flag

* fix: default thread publicity

* fix: ai generated formulas

* fix: eslint rule, display name in markdown

* fix: eslint rule, display name in markdown

* fix: following questions prompt + isNewThread guard

* fix: attachments render && concurrency + optimistic activeThread updates

* fix: build

* perf(impr): earlier downloadedAttachments array upt

* chore(impr): clean remote processed ids, indexeddb attachments

* fix: user should be able to delete threads (#507)

* update

* fix: update

* update

* update

* update

* update

* fix: user can delete thread

* fix: delete thread messages

* fix: update

* fix: obs update

* chore: file clean up

---------

Co-authored-by: Roberto 'Andler' Lucas <contact@andler.dev>

* [masterbots.ai] feat: image generation support (#504)

* feat: add support to image generation

* feat: add GPT-image-1 support route

* feat: fix biome lint

* feat: add edit mode

* chore: enable img gen feature flag

* style: format n lint

---------

Co-authored-by: Roberto 'Andler' Lucas <contact@andler.dev>

* fix: bun lock

* fix: ts build

* fix(impr): continuos thread render, 2nd ai res, ui tweaks (#511)

* chore(impr): mb logo wip + threads add order by update at

* feat(impr): update thread on message activity + fix order by updated at

* fix: thread pop-up default opened accordion

* perf(impr): add user promo code track + chatbot disabled flag

* fix: 2nd ai concurrent request + continuous thread context & render

---------

Co-authored-by: Brandon Fernández <31634868+Bran18@users.noreply.github.com>
Co-authored-by: Jimoh sherifdeen <63134009+sheriffjimoh@users.noreply.github.com>
Co-authored-by: bran18 <andreyfdez18@gmail.com>
Co-authored-by: Brandon fernandez <brandonfernandez@Brandons-Mac-mini.local>
sheriffjimoh added a commit that referenced this pull request Sep 9, 2025
* fix: change toggler wording + util hook (#424)

* impr: makes threads open on profile page and profile tweaks (#421)

* update

* fix: update

* update

* update

* update

* update

* fix: opening threads

* fix: rm threads dropdwon  & added back link to bot page thread view page

* fix: rm threads dropdwon  & added back link to bot page thread view page

* fix: update

* fix: added back to profile page

* fix: added sticky and color

* fix: codeblock ctas refactor markdown rendering, sidebar nav, code block & clipboard hook (#425)

* fix: codeblock ctas

* fix: ts build

* fix: continue thread + allMessages sequence + mobile chat css tweak (#426)

* fix: css handleCLick condition

* fix: get latest search params, continuous thread

* fix(impr): all messages sorting

* perf(impr): sign in & up redirection tweak

* perf(impr): mobile chat css

* chore: next + react security ver upt (#427)

* refactor: use chat and continue thread + continue conversation fallback (#432)

* refactor: use chat and continue generation

* fix: uniq slug and id gen (#433)

* fix: uniq thread + msg slug gen

* style: formatting

* fix: thread user attachments state upt

* perf: impr thread component at all pages + mobile tweaks

* refactor: thread-component card

* chore: restore continue generation v1

* feat(impr): thread component card

* fix: admin panel n actions

* fix: fetch getThreads

* chore: continue conversation v1.2

* chore: continue and update thread content

* chore: add ui control continue generation state

* chore: fix infinity loop

* chore(impr): enable upt msg table permission

* fix: seo thread fetch

* chore: style formating

* fix(impr): continued thread title + thread component reusability

* chore: refactor loadings + extending sonners

---------

Co-authored-by: bran18 <andreyfdez18@gmail.com>

---------

Co-authored-by: Roberto Lucas <andler@bitcash.org>

* feat: add gemini provider (#437)

* feat: add gemini provider

* chore: update icons

* feat: impr continuing thread tags + accordion first msg toggle (#435)

* feat(wip): impr continuing thread tags + accordion first msg toggle

* feat(impr): continuing thread tags + accordion at first message + header mobile tweak

* style(impr): mobile thread-component x-axis space

* perf(style): coderabbitai feedbacks

* fix: css typo

* perf: sendMessageFromResponse clicked guard + continued thread tags label tweak

* chore: user thread panel clean up

* fix: user-thread-panel infinite loader

* perf: impr shared accordion animation and ux

* style: defaultAccordionState comments loc

* fix: record type warning, hasura updateMessage

* fix: getThread user data, shared-accordion

* fix: coderabbitai observations

* fix: impr file management per llm, multimodel feat flag, chat tool labels, parent thread guard

* fix: tunningUserContent parentThread condition

* fix: feature flag typo

* feat: profile page thread popup feature flag and tweaks  (#434)

* update

* fix: update

* update

* update

* update

* update

* refactor: profile page threads pop up

* fix: update config

* fix: update

* fix: update

* fix: make profile page scroll on hero

* fix: bot make popup and scroll

* fix: make profile page sidebar scroll independently

* fix: make profile page sidebar scroll independently

* fix: check the category along the chatbot when it's not checked

* fix: check the category along the chatbot when it's not checked

---------

Co-authored-by: Roberto Lucas <andler.dev@gmail.com>
Co-authored-by: Roberto Lucas <andler@bitcash.org>

* feat: add new llm models (#444)

* feat-add-models

* feat-add-models

* feat-add-models

* chore: add model

* fix: typo

* chore: add toggler color

* perf(impr): thread llm context, last question & response + new models seeds (#447)

* feat(wip): thread llm context, prev questions

* fix: previousQuestionsString slice

* fix: clickedContentId in followingQuestionsPrompt

* feat: isContinued + model type in message table

* fix: ts typo + sendMessageFromResponse callback call

* fix: ts typo

* fix: bot profile page view (#449)

* fix(wip): bot profile thread list

* style: formatting

* fix: new chats and share + og img (#451)

* fix: new chat state reset

* fix: genql gen + share link check

* fix: og img

* fix: duplicate role permission in msg table

* feat: initial continuation logic flow (#450)

* chore: restore base version

* chore: add new logic and hooks

* chore: fix providers file

* chore: improve continuation prompt

* chore: add exlucision flag

* chore: add better handler

* chore: updated flow + experimental delay

* chore: extended time

* chore(impr): streamDelayMs experimental feat flag

* style: formatting

---------

Co-authored-by: Roberto Lucas <andler.dev@gmail.com>

* fix: profile sidebar cat opt render (#453)

* fix: profile sidebar cat opt render

* chore: clean-up

* [masterbots.ai] refactor: slug generation logic with improved uniqueness and type support (#456)

* fix: slugify fn

* chore: devMode logs

* fix: uniq slug gen fn nanoid flag typo

* feat: sentry logs in webapp (#457)

* fix(impr): llm enum data, thread creation, ts, and log behavior (#458)

* fix: slugify first request delay incr + genql ts, seeds & model migration upt

* fix: create thread & msg ts

* fix(impr): profile page bugs & tweaks v1 4/15/25 (#455)

* update

* fix: update

* update

* update

* update

* update

* fix: use the user avatar or robohash

* fix: added avater to user menu

* fix: user avatar

* fix: reset search input when filter by category or chatbot

* fix: personal chat browse provider + username chk in sign up

* chore: clean duplicated if condition signup

---------

Co-authored-by: Roberto Lucas <andler.dev@gmail.com>

* refactor: continuation flow (#460)

* impr: continuation logic flow

* impr: continuation logic flow

* chore: update createImprovementPrompt

* chore: upt logs

---------

Co-authored-by: Roberto Lucas <andler.dev@gmail.com>

* feat: models table, enum type, and refactor chat msg deduplication logic (#462)

* feat: models table

* style: formatting

* fix: continuation accordion content

* fix: sql + metadata typo

* fix: db migrations and messages uniqby condition (#463)

* fix: db migrations + messages uniqby condition

* fix: typo

* perf(impr): verify duplicate message return condition

* chore: upt default available models

* perf(impr): reassign continued prompt

* chore: incr fn stream max duration

* fix: mob prof sidebar + sign-up pw verif + username chk (#464)

* fix: mob prof sidebar + sign-up pw verif + username chk

* chore: upt genql gen

* perf(impr): profile navigation

* feat: model selector (#466)

* wip: model selector query

* wip: model selector query

* chore: improve funtions

* chore: add coderabbit suggestion

* chore: add hasura permissions, models table

* style: formatting

* chore: fix get model client type

* chore: add model

---------

Co-authored-by: Roberto Romero Lucas <contact@andler.dev>

* chore: impr models (#472)

* chore: fix model name and condition (#473)

* refactor: user fetching code (#471)

* refactor: profile sidebar ui, upt styling, and disable prefetch (#470)

* chore: remove prefetch on sidebar & profile navigation

* perf: impr profile sidebar

* fix: infinite scroll load more fetch

* perf(impr): google sign-in

* perf(impr): session loaders tweak

* perf: impr categoriesId obtention

* fix: tailwind typo

* chore(impr): pro user guard in model selector

* chore: category label upt to topic

* chore: rm dev mode guard (#476)

* feat: add reasoning compatibility (#480)

* feat: add resoning stable

* chore: add reasoning stable v

* chore: activate reasoning

* chore: activate reasoning

* feat: pro users whitelist (#481)

* feat(wip): whitelist pro users

* chore: add whitelist pro users + page size fetch

* perf(impr): following question impr prompt

* fix: pro whitelist users clean up

* feat: user account setting  (#468)

* update

* fix: update

* update

* update

* update

* update

* feat: imple account setting

* feat: added dialog to delete button

* feat: update user deletion func

* fix: move back exmaples files

* fix: update

* fix: user account scheduling api

* fix: user account deletion request function

* refactor: account deletion request api

* fix: user account request and thread deletion

* fix: added permission and account deletion page

* fix: update on permission

* fix: enable new col permission

* fix: profile side bar

* fix: update

* fix: function rerendering

* fix: update route

* chore(impr): preferences actions and ui tweaks

---------

Co-authored-by: Roberto Lucas <andler.dev@gmail.com>

* chore: enable twitter pixel track (#479)

* chore: enable twitter pixel track

* perf(impr): twitter ads availability + dynamic config

* feat: impr profile navigation page (#478)

* fix(wip): subscriptions page render

* feat(impr): profile navigation + page ui tweaks

* style: lintin + formatting

* style(css): nav links px on mob

* fix: goToProfile in mob prof sidebar

* fix: build

* fix: thread popup opening at nav

* chore: enable preferences nav on prod

* feat: image generation  (#486)

* feat: add image generation support - gemini provider

* chore: add mineType

* chore: add conditional checks

* chore: upt model enums & list

* chore: hasura, set icl seeds chunks (#484)

* chore: hasura, set icl seeds chunks

* chore: track backup icl seed loc to lfs

* chore(seeds): uncomment phase 3 topics & add new chatbots + icl metadata rel

* chore: upt phase 3 init config seeds, adding rel

* fix: example seeds integrity

* test: incr hasura max req body

* revert: cloudbuild og config

* chore: restore skipped seed lines

* fix: thread rendering (#487)

* fix: thread list render states

* chore: linting & format

* fix: thread pop-up on refresh

* fix: user table selection

* fix(impr): type safety for image data and refactor model enums in chat (#489)

* fix: image generation flow

* chore: impr gemini generation logic

* fix: build issue

* chore: change subscription page

* chore: change subscription page + lint

* chore: user pref disable options

---------

Co-authored-by: bran18 <andreyfdez18@gmail.com>

* fix: add hotfix image generation

* chore: add more image models

* fix: models_enum values + genql upt

* feat: improved subscription section (#491)

* feat: add improved subscription section

* feat: add type

* chore: add conditional dislay

* feat: add username tags

* chore: add new order and benefits

* fix: thread empty state on user profile (#490)

* update

* fix: update

* update

* update

* update

* update

* feat: added empty state to user profile page

* feat: added empty state to user profile page

* fix: update

* fix: update

* fix: account creation slug issue

* chore: restore public models table select permissions + clean up

---------

Co-authored-by: Roberto Lucas <andler@bitcash.org>
Co-authored-by: Roberto Lucas <andler.dev@gmail.com>

* feat(wip): web search v2 (#494)

* feat(wip): web search

* feat(wip): thread config actions

* feat(wip): share cta impr

* chore: upt domain slugs list

* chore: comment legacy getWebSearchTool

* fix: preference insert

* wip: user preferences set

* fix: typo

* fix: updateUser data upt

* fix: pref table sel (#496)

* fix: og render + tweaks (#492)

* fix: og render + tweaks

* fix: zIndex in og

* perf: impr defaultOgImage chk

* chore: bun lock upt

* chore: next-auth patch upt

* fix: app build by mv uuidregexp loc

* fix: drizzle service actions loc + msg slug check + msg uniqueness (#499)

* [masterbots.ai] chore: standarize pop-up on profile & bot page for thread display (#500)

* update

* fix: update

* update

* update

* update

* update

* fix: added popup to thread view page on user profile(both on page reload)

* fix: added popup to thread view page on user profile(both on page reload)

* fix: added profile link to thread share

* fix: update

* fix: chatbot page thread pop-up

* fix: update

* fix: appendMessage concurrency + getBrowseThreads admin mode chk (#505)

* feat: attachment thread metadata (#502)

* feat(wip): track thread attch data

* chore: upt drizzle & genql schemas

* feat(wip): save user attachments on load chk

* perf: file upload throughout indexed db hook

* feat(wip): gcp bucket setup

* feat: enlarge thread attachment

* fix: attachment upload loop

* fix: gcloud storage + thread metadata check & upload

* fix: bucket upload + after upload mutations

* feat: store remote thread metadata to indexeddb

* fix: read file content instead url

* fix(wip): get attachments on chat onFinish

* fix: attach new stack of files to chat

* [masterbots.ai] fix: og card dimensions and spacing + profile props (#506)

* fix: og card dimensions and spacing + profile props

* fix: og card dimensions + profile props

* perf(impr): rm long usernames + autogen num + form input control

* perf: dynamic short username number gen

* chore(impr): update default thread publicity flag + attachments concurrency & render (#508)

* chore(impr): update default thread publicity flag

* fix: default thread publicity

* fix: ai generated formulas

* fix: eslint rule, display name in markdown

* fix: eslint rule, display name in markdown

* fix: following questions prompt + isNewThread guard

* fix: attachments render && concurrency + optimistic activeThread updates

* fix: build

* perf(impr): earlier downloadedAttachments array upt

* chore(impr): clean remote processed ids, indexeddb attachments

* fix: user should be able to delete threads (#507)

* update

* fix: update

* update

* update

* update

* update

* fix: user can delete thread

* fix: delete thread messages

* fix: update

* fix: obs update

* chore: file clean up

---------

Co-authored-by: Roberto 'Andler' Lucas <contact@andler.dev>

* [masterbots.ai] feat: image generation support (#504)

* feat: add support to image generation

* feat: add GPT-image-1 support route

* feat: fix biome lint

* feat: add edit mode

* chore: enable img gen feature flag

* style: format n lint

---------

Co-authored-by: Roberto 'Andler' Lucas <contact@andler.dev>

* fix: bun lock

* fix: ts build

* fix(impr): continuos thread render, 2nd ai res, ui tweaks (#511)

* chore(impr): mb logo wip + threads add order by update at

* feat(impr): update thread on message activity + fix order by updated at

* fix: thread pop-up default opened accordion

* perf(impr): add user promo code track + chatbot disabled flag

* fix: 2nd ai concurrent request + continuous thread context & render

* [masterbots.ai] perf(impr): chat opt state mngt and enhance attach metadata sync (#514)

* fix: toggle visibility fn state upt

* fix: file attach message ids upt

* fix: after update guard state

* fix: ts typo

* fix: thread visibility update permissions

* chore(fix): enable image gen to whitelist users

---------

Co-authored-by: Brandon Fernández <31634868+Bran18@users.noreply.github.com>
Co-authored-by: Jimoh sherifdeen <63134009+sheriffjimoh@users.noreply.github.com>
Co-authored-by: bran18 <andreyfdez18@gmail.com>
Co-authored-by: Brandon fernandez <brandonfernandez@Brandons-Mac-mini.local>
sheriffjimoh pushed a commit that referenced this pull request Sep 10, 2025
* chore(impr): mb logo wip + threads add order by update at

* feat(impr): update thread on message activity + fix order by updated at

* fix: thread pop-up default opened accordion

* perf(impr): add user promo code track + chatbot disabled flag

* fix: 2nd ai concurrent request + continuous thread context & render
sheriffjimoh added a commit that referenced this pull request Sep 10, 2025
…512)

* fix: change toggler wording + util hook (#424)

* impr: makes threads open on profile page and profile tweaks (#421)

* update

* fix: update

* update

* update

* update

* update

* fix: opening threads

* fix: rm threads dropdwon  & added back link to bot page thread view page

* fix: rm threads dropdwon  & added back link to bot page thread view page

* fix: update

* fix: added back to profile page

* fix: added sticky and color

* fix: codeblock ctas refactor markdown rendering, sidebar nav, code block & clipboard hook (#425)

* fix: codeblock ctas

* fix: ts build

* fix: continue thread + allMessages sequence + mobile chat css tweak (#426)

* fix: css handleCLick condition

* fix: get latest search params, continuous thread

* fix(impr): all messages sorting

* perf(impr): sign in & up redirection tweak

* perf(impr): mobile chat css

* chore: next + react security ver upt (#427)

* refactor: use chat and continue thread + continue conversation fallback (#432)

* refactor: use chat and continue generation

* fix: uniq slug and id gen (#433)

* fix: uniq thread + msg slug gen

* style: formatting

* fix: thread user attachments state upt

* perf: impr thread component at all pages + mobile tweaks

* refactor: thread-component card

* chore: restore continue generation v1

* feat(impr): thread component card

* fix: admin panel n actions

* fix: fetch getThreads

* chore: continue conversation v1.2

* chore: continue and update thread content

* chore: add ui control continue generation state

* chore: fix infinity loop

* chore(impr): enable upt msg table permission

* fix: seo thread fetch

* chore: style formating

* fix(impr): continued thread title + thread component reusability

* chore: refactor loadings + extending sonners

---------

Co-authored-by: bran18 <andreyfdez18@gmail.com>

---------

Co-authored-by: Roberto Lucas <andler@bitcash.org>

* feat: add gemini provider (#437)

* feat: add gemini provider

* chore: update icons

* feat: impr continuing thread tags + accordion first msg toggle (#435)

* feat(wip): impr continuing thread tags + accordion first msg toggle

* feat(impr): continuing thread tags + accordion at first message + header mobile tweak

* style(impr): mobile thread-component x-axis space

* perf(style): coderabbitai feedbacks

* fix: css typo

* perf: sendMessageFromResponse clicked guard + continued thread tags label tweak

* chore: user thread panel clean up

* fix: user-thread-panel infinite loader

* perf: impr shared accordion animation and ux

* style: defaultAccordionState comments loc

* fix: record type warning, hasura updateMessage

* fix: getThread user data, shared-accordion

* fix: coderabbitai observations

* fix: impr file management per llm, multimodel feat flag, chat tool labels, parent thread guard

* fix: tunningUserContent parentThread condition

* fix: feature flag typo

* feat: profile page thread popup feature flag and tweaks  (#434)

* update

* fix: update

* update

* update

* update

* update

* refactor: profile page threads pop up

* fix: update config

* fix: update

* fix: update

* fix: make profile page scroll on hero

* fix: bot make popup and scroll

* fix: make profile page sidebar scroll independently

* fix: make profile page sidebar scroll independently

* fix: check the category along the chatbot when it's not checked

* fix: check the category along the chatbot when it's not checked

---------

Co-authored-by: Roberto Lucas <andler.dev@gmail.com>
Co-authored-by: Roberto Lucas <andler@bitcash.org>

* feat: add new llm models (#444)

* feat-add-models

* feat-add-models

* feat-add-models

* chore: add model

* fix: typo

* chore: add toggler color

* perf(impr): thread llm context, last question & response + new models seeds (#447)

* feat(wip): thread llm context, prev questions

* fix: previousQuestionsString slice

* fix: clickedContentId in followingQuestionsPrompt

* feat: isContinued + model type in message table

* fix: ts typo + sendMessageFromResponse callback call

* fix: ts typo

* fix: bot profile page view (#449)

* fix(wip): bot profile thread list

* style: formatting

* fix: new chats and share + og img (#451)

* fix: new chat state reset

* fix: genql gen + share link check

* fix: og img

* fix: duplicate role permission in msg table

* feat: initial continuation logic flow (#450)

* chore: restore base version

* chore: add new logic and hooks

* chore: fix providers file

* chore: improve continuation prompt

* chore: add exlucision flag

* chore: add better handler

* chore: updated flow + experimental delay

* chore: extended time

* chore(impr): streamDelayMs experimental feat flag

* style: formatting

---------

Co-authored-by: Roberto Lucas <andler.dev@gmail.com>

* fix: profile sidebar cat opt render (#453)

* fix: profile sidebar cat opt render

* chore: clean-up

* [masterbots.ai] refactor: slug generation logic with improved uniqueness and type support (#456)

* fix: slugify fn

* chore: devMode logs

* fix: uniq slug gen fn nanoid flag typo

* feat: sentry logs in webapp (#457)

* fix(impr): llm enum data, thread creation, ts, and log behavior (#458)

* fix: slugify first request delay incr + genql ts, seeds & model migration upt

* fix: create thread & msg ts

* fix(impr): profile page bugs & tweaks v1 4/15/25 (#455)

* update

* fix: update

* update

* update

* update

* update

* fix: use the user avatar or robohash

* fix: added avater to user menu

* fix: user avatar

* fix: reset search input when filter by category or chatbot

* fix: personal chat browse provider + username chk in sign up

* chore: clean duplicated if condition signup

---------

Co-authored-by: Roberto Lucas <andler.dev@gmail.com>

* refactor: continuation flow (#460)

* impr: continuation logic flow

* impr: continuation logic flow

* chore: update createImprovementPrompt

* chore: upt logs

---------

Co-authored-by: Roberto Lucas <andler.dev@gmail.com>

* feat: models table, enum type, and refactor chat msg deduplication logic (#462)

* feat: models table

* style: formatting

* fix: continuation accordion content

* fix: sql + metadata typo

* fix: db migrations and messages uniqby condition (#463)

* fix: db migrations + messages uniqby condition

* fix: typo

* perf(impr): verify duplicate message return condition

* chore: upt default available models

* perf(impr): reassign continued prompt

* chore: incr fn stream max duration

* fix: mob prof sidebar + sign-up pw verif + username chk (#464)

* fix: mob prof sidebar + sign-up pw verif + username chk

* chore: upt genql gen

* perf(impr): profile navigation

* feat: model selector (#466)

* wip: model selector query

* wip: model selector query

* chore: improve funtions

* chore: add coderabbit suggestion

* chore: add hasura permissions, models table

* style: formatting

* chore: fix get model client type

* chore: add model

---------

Co-authored-by: Roberto Romero Lucas <contact@andler.dev>

* chore: impr models (#472)

* chore: fix model name and condition (#473)

* refactor: user fetching code (#471)

* refactor: profile sidebar ui, upt styling, and disable prefetch (#470)

* chore: remove prefetch on sidebar & profile navigation

* perf: impr profile sidebar

* fix: infinite scroll load more fetch

* perf(impr): google sign-in

* perf(impr): session loaders tweak

* perf: impr categoriesId obtention

* fix: tailwind typo

* chore(impr): pro user guard in model selector

* chore: category label upt to topic

* chore: rm dev mode guard (#476)

* feat: add reasoning compatibility (#480)

* feat: add resoning stable

* chore: add reasoning stable v

* chore: activate reasoning

* chore: activate reasoning

* feat: pro users whitelist (#481)

* feat(wip): whitelist pro users

* chore: add whitelist pro users + page size fetch

* perf(impr): following question impr prompt

* fix: pro whitelist users clean up

* feat: user account setting  (#468)

* update

* fix: update

* update

* update

* update

* update

* feat: imple account setting

* feat: added dialog to delete button

* feat: update user deletion func

* fix: move back exmaples files

* fix: update

* fix: user account scheduling api

* fix: user account deletion request function

* refactor: account deletion request api

* fix: user account request and thread deletion

* fix: added permission and account deletion page

* fix: update on permission

* fix: enable new col permission

* fix: profile side bar

* fix: update

* fix: function rerendering

* fix: update route

* chore(impr): preferences actions and ui tweaks

---------

Co-authored-by: Roberto Lucas <andler.dev@gmail.com>

* chore: enable twitter pixel track (#479)

* chore: enable twitter pixel track

* perf(impr): twitter ads availability + dynamic config

* feat: impr profile navigation page (#478)

* fix(wip): subscriptions page render

* feat(impr): profile navigation + page ui tweaks

* style: lintin + formatting

* style(css): nav links px on mob

* fix: goToProfile in mob prof sidebar

* fix: build

* fix: thread popup opening at nav

* chore: enable preferences nav on prod

* feat: image generation  (#486)

* feat: add image generation support - gemini provider

* chore: add mineType

* chore: add conditional checks

* chore: upt model enums & list

* chore: hasura, set icl seeds chunks (#484)

* chore: hasura, set icl seeds chunks

* chore: track backup icl seed loc to lfs

* chore(seeds): uncomment phase 3 topics & add new chatbots + icl metadata rel

* chore: upt phase 3 init config seeds, adding rel

* fix: example seeds integrity

* test: incr hasura max req body

* revert: cloudbuild og config

* chore: restore skipped seed lines

* fix: thread rendering (#487)

* fix: thread list render states

* chore: linting & format

* fix: thread pop-up on refresh

* fix: user table selection

* fix(impr): type safety for image data and refactor model enums in chat (#489)

* fix: image generation flow

* chore: impr gemini generation logic

* fix: build issue

* chore: change subscription page

* chore: change subscription page + lint

* chore: user pref disable options

---------

Co-authored-by: bran18 <andreyfdez18@gmail.com>

* fix: add hotfix image generation

* chore: add more image models

* fix: models_enum values + genql upt

* feat: improved subscription section (#491)

* feat: add improved subscription section

* feat: add type

* chore: add conditional dislay

* feat: add username tags

* chore: add new order and benefits

* fix: thread empty state on user profile (#490)

* update

* fix: update

* update

* update

* update

* update

* feat: added empty state to user profile page

* feat: added empty state to user profile page

* fix: update

* fix: update

* fix: account creation slug issue

* chore: restore public models table select permissions + clean up

---------

Co-authored-by: Roberto Lucas <andler@bitcash.org>
Co-authored-by: Roberto Lucas <andler.dev@gmail.com>

* feat(wip): web search v2 (#494)

* feat(wip): web search

* feat(wip): thread config actions

* feat(wip): share cta impr

* chore: upt domain slugs list

* chore: comment legacy getWebSearchTool

* fix: preference insert

* wip: user preferences set

* fix: typo

* fix: updateUser data upt

* fix: pref table sel (#496)

* fix: og render + tweaks (#492)

* fix: og render + tweaks

* fix: zIndex in og

* perf: impr defaultOgImage chk

* chore: bun lock upt

* chore: next-auth patch upt

* fix: app build by mv uuidregexp loc

* fix: drizzle service actions loc + msg slug check + msg uniqueness (#499)

* [masterbots.ai] chore: standarize pop-up on profile & bot page for thread display (#500)

* update

* fix: update

* update

* update

* update

* update

* fix: added popup to thread view page on user profile(both on page reload)

* fix: added popup to thread view page on user profile(both on page reload)

* fix: added profile link to thread share

* fix: update

* fix: chatbot page thread pop-up

* fix: update

* fix: appendMessage concurrency + getBrowseThreads admin mode chk (#505)

* feat: attachment thread metadata (#502)

* feat(wip): track thread attch data

* chore: upt drizzle & genql schemas

* feat(wip): save user attachments on load chk

* perf: file upload throughout indexed db hook

* feat(wip): gcp bucket setup

* feat: enlarge thread attachment

* fix: attachment upload loop

* fix: gcloud storage + thread metadata check & upload

* fix: bucket upload + after upload mutations

* feat: store remote thread metadata to indexeddb

* fix: read file content instead url

* fix(wip): get attachments on chat onFinish

* fix: attach new stack of files to chat

* [masterbots.ai] fix: og card dimensions and spacing + profile props (#506)

* fix: og card dimensions and spacing + profile props

* fix: og card dimensions + profile props

* perf(impr): rm long usernames + autogen num + form input control

* perf: dynamic short username number gen

* chore(impr): update default thread publicity flag + attachments concurrency & render (#508)

* chore(impr): update default thread publicity flag

* fix: default thread publicity

* fix: ai generated formulas

* fix: eslint rule, display name in markdown

* fix: eslint rule, display name in markdown

* fix: following questions prompt + isNewThread guard

* fix: attachments render && concurrency + optimistic activeThread updates

* fix: build

* perf(impr): earlier downloadedAttachments array upt

* chore(impr): clean remote processed ids, indexeddb attachments

* fix: user should be able to delete threads (#507)

* update

* fix: update

* update

* update

* update

* update

* fix: user can delete thread

* fix: delete thread messages

* fix: update

* fix: obs update

* chore: file clean up

---------

Co-authored-by: Roberto 'Andler' Lucas <contact@andler.dev>

* [masterbots.ai] feat: image generation support (#504)

* feat: add support to image generation

* feat: add GPT-image-1 support route

* feat: fix biome lint

* feat: add edit mode

* chore: enable img gen feature flag

* style: format n lint

---------

Co-authored-by: Roberto 'Andler' Lucas <contact@andler.dev>

* fix: bun lock

* fix: ts build

* fix(impr): continuos thread render, 2nd ai res, ui tweaks (#511)

* chore(impr): mb logo wip + threads add order by update at

* feat(impr): update thread on message activity + fix order by updated at

* fix: thread pop-up default opened accordion

* perf(impr): add user promo code track + chatbot disabled flag

* fix: 2nd ai concurrent request + continuous thread context & render

---------

Co-authored-by: Brandon Fernández <31634868+Bran18@users.noreply.github.com>
Co-authored-by: Jimoh sherifdeen <63134009+sheriffjimoh@users.noreply.github.com>
Co-authored-by: bran18 <andreyfdez18@gmail.com>
Co-authored-by: Brandon fernandez <brandonfernandez@Brandons-Mac-mini.local>
sheriffjimoh added a commit that referenced this pull request Sep 10, 2025
* fix: change toggler wording + util hook (#424)

* impr: makes threads open on profile page and profile tweaks (#421)

* update

* fix: update

* update

* update

* update

* update

* fix: opening threads

* fix: rm threads dropdwon  & added back link to bot page thread view page

* fix: rm threads dropdwon  & added back link to bot page thread view page

* fix: update

* fix: added back to profile page

* fix: added sticky and color

* fix: codeblock ctas refactor markdown rendering, sidebar nav, code block & clipboard hook (#425)

* fix: codeblock ctas

* fix: ts build

* fix: continue thread + allMessages sequence + mobile chat css tweak (#426)

* fix: css handleCLick condition

* fix: get latest search params, continuous thread

* fix(impr): all messages sorting

* perf(impr): sign in & up redirection tweak

* perf(impr): mobile chat css

* chore: next + react security ver upt (#427)

* refactor: use chat and continue thread + continue conversation fallback (#432)

* refactor: use chat and continue generation

* fix: uniq slug and id gen (#433)

* fix: uniq thread + msg slug gen

* style: formatting

* fix: thread user attachments state upt

* perf: impr thread component at all pages + mobile tweaks

* refactor: thread-component card

* chore: restore continue generation v1

* feat(impr): thread component card

* fix: admin panel n actions

* fix: fetch getThreads

* chore: continue conversation v1.2

* chore: continue and update thread content

* chore: add ui control continue generation state

* chore: fix infinity loop

* chore(impr): enable upt msg table permission

* fix: seo thread fetch

* chore: style formating

* fix(impr): continued thread title + thread component reusability

* chore: refactor loadings + extending sonners

---------

Co-authored-by: bran18 <andreyfdez18@gmail.com>

---------

Co-authored-by: Roberto Lucas <andler@bitcash.org>

* feat: add gemini provider (#437)

* feat: add gemini provider

* chore: update icons

* feat: impr continuing thread tags + accordion first msg toggle (#435)

* feat(wip): impr continuing thread tags + accordion first msg toggle

* feat(impr): continuing thread tags + accordion at first message + header mobile tweak

* style(impr): mobile thread-component x-axis space

* perf(style): coderabbitai feedbacks

* fix: css typo

* perf: sendMessageFromResponse clicked guard + continued thread tags label tweak

* chore: user thread panel clean up

* fix: user-thread-panel infinite loader

* perf: impr shared accordion animation and ux

* style: defaultAccordionState comments loc

* fix: record type warning, hasura updateMessage

* fix: getThread user data, shared-accordion

* fix: coderabbitai observations

* fix: impr file management per llm, multimodel feat flag, chat tool labels, parent thread guard

* fix: tunningUserContent parentThread condition

* fix: feature flag typo

* feat: profile page thread popup feature flag and tweaks  (#434)

* update

* fix: update

* update

* update

* update

* update

* refactor: profile page threads pop up

* fix: update config

* fix: update

* fix: update

* fix: make profile page scroll on hero

* fix: bot make popup and scroll

* fix: make profile page sidebar scroll independently

* fix: make profile page sidebar scroll independently

* fix: check the category along the chatbot when it's not checked

* fix: check the category along the chatbot when it's not checked

---------

Co-authored-by: Roberto Lucas <andler.dev@gmail.com>
Co-authored-by: Roberto Lucas <andler@bitcash.org>

* feat: add new llm models (#444)

* feat-add-models

* feat-add-models

* feat-add-models

* chore: add model

* fix: typo

* chore: add toggler color

* perf(impr): thread llm context, last question & response + new models seeds (#447)

* feat(wip): thread llm context, prev questions

* fix: previousQuestionsString slice

* fix: clickedContentId in followingQuestionsPrompt

* feat: isContinued + model type in message table

* fix: ts typo + sendMessageFromResponse callback call

* fix: ts typo

* fix: bot profile page view (#449)

* fix(wip): bot profile thread list

* style: formatting

* fix: new chats and share + og img (#451)

* fix: new chat state reset

* fix: genql gen + share link check

* fix: og img

* fix: duplicate role permission in msg table

* feat: initial continuation logic flow (#450)

* chore: restore base version

* chore: add new logic and hooks

* chore: fix providers file

* chore: improve continuation prompt

* chore: add exlucision flag

* chore: add better handler

* chore: updated flow + experimental delay

* chore: extended time

* chore(impr): streamDelayMs experimental feat flag

* style: formatting

---------

Co-authored-by: Roberto Lucas <andler.dev@gmail.com>

* fix: profile sidebar cat opt render (#453)

* fix: profile sidebar cat opt render

* chore: clean-up

* [masterbots.ai] refactor: slug generation logic with improved uniqueness and type support (#456)

* fix: slugify fn

* chore: devMode logs

* fix: uniq slug gen fn nanoid flag typo

* feat: sentry logs in webapp (#457)

* fix(impr): llm enum data, thread creation, ts, and log behavior (#458)

* fix: slugify first request delay incr + genql ts, seeds & model migration upt

* fix: create thread & msg ts

* fix(impr): profile page bugs & tweaks v1 4/15/25 (#455)

* update

* fix: update

* update

* update

* update

* update

* fix: use the user avatar or robohash

* fix: added avater to user menu

* fix: user avatar

* fix: reset search input when filter by category or chatbot

* fix: personal chat browse provider + username chk in sign up

* chore: clean duplicated if condition signup

---------

Co-authored-by: Roberto Lucas <andler.dev@gmail.com>

* refactor: continuation flow (#460)

* impr: continuation logic flow

* impr: continuation logic flow

* chore: update createImprovementPrompt

* chore: upt logs

---------

Co-authored-by: Roberto Lucas <andler.dev@gmail.com>

* feat: models table, enum type, and refactor chat msg deduplication logic (#462)

* feat: models table

* style: formatting

* fix: continuation accordion content

* fix: sql + metadata typo

* fix: db migrations and messages uniqby condition (#463)

* fix: db migrations + messages uniqby condition

* fix: typo

* perf(impr): verify duplicate message return condition

* chore: upt default available models

* perf(impr): reassign continued prompt

* chore: incr fn stream max duration

* fix: mob prof sidebar + sign-up pw verif + username chk (#464)

* fix: mob prof sidebar + sign-up pw verif + username chk

* chore: upt genql gen

* perf(impr): profile navigation

* feat: model selector (#466)

* wip: model selector query

* wip: model selector query

* chore: improve funtions

* chore: add coderabbit suggestion

* chore: add hasura permissions, models table

* style: formatting

* chore: fix get model client type

* chore: add model

---------

Co-authored-by: Roberto Romero Lucas <contact@andler.dev>

* chore: impr models (#472)

* chore: fix model name and condition (#473)

* refactor: user fetching code (#471)

* refactor: profile sidebar ui, upt styling, and disable prefetch (#470)

* chore: remove prefetch on sidebar & profile navigation

* perf: impr profile sidebar

* fix: infinite scroll load more fetch

* perf(impr): google sign-in

* perf(impr): session loaders tweak

* perf: impr categoriesId obtention

* fix: tailwind typo

* chore(impr): pro user guard in model selector

* chore: category label upt to topic

* chore: rm dev mode guard (#476)

* feat: add reasoning compatibility (#480)

* feat: add resoning stable

* chore: add reasoning stable v

* chore: activate reasoning

* chore: activate reasoning

* feat: pro users whitelist (#481)

* feat(wip): whitelist pro users

* chore: add whitelist pro users + page size fetch

* perf(impr): following question impr prompt

* fix: pro whitelist users clean up

* feat: user account setting  (#468)

* update

* fix: update

* update

* update

* update

* update

* feat: imple account setting

* feat: added dialog to delete button

* feat: update user deletion func

* fix: move back exmaples files

* fix: update

* fix: user account scheduling api

* fix: user account deletion request function

* refactor: account deletion request api

* fix: user account request and thread deletion

* fix: added permission and account deletion page

* fix: update on permission

* fix: enable new col permission

* fix: profile side bar

* fix: update

* fix: function rerendering

* fix: update route

* chore(impr): preferences actions and ui tweaks

---------

Co-authored-by: Roberto Lucas <andler.dev@gmail.com>

* chore: enable twitter pixel track (#479)

* chore: enable twitter pixel track

* perf(impr): twitter ads availability + dynamic config

* feat: impr profile navigation page (#478)

* fix(wip): subscriptions page render

* feat(impr): profile navigation + page ui tweaks

* style: lintin + formatting

* style(css): nav links px on mob

* fix: goToProfile in mob prof sidebar

* fix: build

* fix: thread popup opening at nav

* chore: enable preferences nav on prod

* feat: image generation  (#486)

* feat: add image generation support - gemini provider

* chore: add mineType

* chore: add conditional checks

* chore: upt model enums & list

* chore: hasura, set icl seeds chunks (#484)

* chore: hasura, set icl seeds chunks

* chore: track backup icl seed loc to lfs

* chore(seeds): uncomment phase 3 topics & add new chatbots + icl metadata rel

* chore: upt phase 3 init config seeds, adding rel

* fix: example seeds integrity

* test: incr hasura max req body

* revert: cloudbuild og config

* chore: restore skipped seed lines

* fix: thread rendering (#487)

* fix: thread list render states

* chore: linting & format

* fix: thread pop-up on refresh

* fix: user table selection

* fix(impr): type safety for image data and refactor model enums in chat (#489)

* fix: image generation flow

* chore: impr gemini generation logic

* fix: build issue

* chore: change subscription page

* chore: change subscription page + lint

* chore: user pref disable options

---------

Co-authored-by: bran18 <andreyfdez18@gmail.com>

* fix: add hotfix image generation

* chore: add more image models

* fix: models_enum values + genql upt

* feat: improved subscription section (#491)

* feat: add improved subscription section

* feat: add type

* chore: add conditional dislay

* feat: add username tags

* chore: add new order and benefits

* fix: thread empty state on user profile (#490)

* update

* fix: update

* update

* update

* update

* update

* feat: added empty state to user profile page

* feat: added empty state to user profile page

* fix: update

* fix: update

* fix: account creation slug issue

* chore: restore public models table select permissions + clean up

---------

Co-authored-by: Roberto Lucas <andler@bitcash.org>
Co-authored-by: Roberto Lucas <andler.dev@gmail.com>

* feat(wip): web search v2 (#494)

* feat(wip): web search

* feat(wip): thread config actions

* feat(wip): share cta impr

* chore: upt domain slugs list

* chore: comment legacy getWebSearchTool

* fix: preference insert

* wip: user preferences set

* fix: typo

* fix: updateUser data upt

* fix: pref table sel (#496)

* fix: og render + tweaks (#492)

* fix: og render + tweaks

* fix: zIndex in og

* perf: impr defaultOgImage chk

* chore: bun lock upt

* chore: next-auth patch upt

* fix: app build by mv uuidregexp loc

* fix: drizzle service actions loc + msg slug check + msg uniqueness (#499)

* [masterbots.ai] chore: standarize pop-up on profile & bot page for thread display (#500)

* update

* fix: update

* update

* update

* update

* update

* fix: added popup to thread view page on user profile(both on page reload)

* fix: added popup to thread view page on user profile(both on page reload)

* fix: added profile link to thread share

* fix: update

* fix: chatbot page thread pop-up

* fix: update

* fix: appendMessage concurrency + getBrowseThreads admin mode chk (#505)

* feat: attachment thread metadata (#502)

* feat(wip): track thread attch data

* chore: upt drizzle & genql schemas

* feat(wip): save user attachments on load chk

* perf: file upload throughout indexed db hook

* feat(wip): gcp bucket setup

* feat: enlarge thread attachment

* fix: attachment upload loop

* fix: gcloud storage + thread metadata check & upload

* fix: bucket upload + after upload mutations

* feat: store remote thread metadata to indexeddb

* fix: read file content instead url

* fix(wip): get attachments on chat onFinish

* fix: attach new stack of files to chat

* [masterbots.ai] fix: og card dimensions and spacing + profile props (#506)

* fix: og card dimensions and spacing + profile props

* fix: og card dimensions + profile props

* perf(impr): rm long usernames + autogen num + form input control

* perf: dynamic short username number gen

* chore(impr): update default thread publicity flag + attachments concurrency & render (#508)

* chore(impr): update default thread publicity flag

* fix: default thread publicity

* fix: ai generated formulas

* fix: eslint rule, display name in markdown

* fix: eslint rule, display name in markdown

* fix: following questions prompt + isNewThread guard

* fix: attachments render && concurrency + optimistic activeThread updates

* fix: build

* perf(impr): earlier downloadedAttachments array upt

* chore(impr): clean remote processed ids, indexeddb attachments

* fix: user should be able to delete threads (#507)

* update

* fix: update

* update

* update

* update

* update

* fix: user can delete thread

* fix: delete thread messages

* fix: update

* fix: obs update

* chore: file clean up

---------

Co-authored-by: Roberto 'Andler' Lucas <contact@andler.dev>

* [masterbots.ai] feat: image generation support (#504)

* feat: add support to image generation

* feat: add GPT-image-1 support route

* feat: fix biome lint

* feat: add edit mode

* chore: enable img gen feature flag

* style: format n lint

---------

Co-authored-by: Roberto 'Andler' Lucas <contact@andler.dev>

* fix: bun lock

* fix: ts build

* fix(impr): continuos thread render, 2nd ai res, ui tweaks (#511)

* chore(impr): mb logo wip + threads add order by update at

* feat(impr): update thread on message activity + fix order by updated at

* fix: thread pop-up default opened accordion

* perf(impr): add user promo code track + chatbot disabled flag

* fix: 2nd ai concurrent request + continuous thread context & render

* [masterbots.ai] perf(impr): chat opt state mngt and enhance attach metadata sync (#514)

* fix: toggle visibility fn state upt

* fix: file attach message ids upt

* fix: after update guard state

* fix: ts typo

* fix: thread visibility update permissions

* chore(fix): enable image gen to whitelist users

---------

Co-authored-by: Brandon Fernández <31634868+Bran18@users.noreply.github.com>
Co-authored-by: Jimoh sherifdeen <63134009+sheriffjimoh@users.noreply.github.com>
Co-authored-by: bran18 <andreyfdez18@gmail.com>
Co-authored-by: Brandon fernandez <brandonfernandez@Brandons-Mac-mini.local>
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