Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
93f273a
fix: chat threadquestion showing cinema
sheriffjimoh Sep 22, 2025
240077a
fix: bot page thread question url
sheriffjimoh Sep 22, 2025
1a2e27a
fix: threads not found message
sheriffjimoh Oct 3, 2025
8f2eeaf
fix(pro): threads not found message
sheriffjimoh Oct 3, 2025
78e9fdf
fix: restored hero bg banner
sheriffjimoh Oct 7, 2025
130f8c9
fix: update
sheriffjimoh Oct 7, 2025
92b2fb3
Merge branch 'develop' of https://github.com/bitcashorg/masterbots in…
sheriffjimoh Oct 8, 2025
9907138
fix: added isverified colum perm
sheriffjimoh Oct 8, 2025
73e28c4
fix: update
sheriffjimoh Oct 8, 2025
695cf24
fix: theme toggle resize
sheriffjimoh Oct 8, 2025
5ec652b
fix: added select all category
sheriffjimoh Oct 8, 2025
e20ccd4
fix: update
sheriffjimoh Oct 8, 2025
71cad84
Merge branch 'develop' of https://github.com/bitcashorg/masterbots in…
sheriffjimoh Oct 11, 2025
84159bb
fix: select all fix
sheriffjimoh Oct 16, 2025
545111d
fix: rm duplicate chatbot metadata seeder file
sheriffjimoh Oct 23, 2025
dc8ab41
fix: cmds for loggin seeds error
sheriffjimoh Oct 23, 2025
a1f7610
fix: dashboard popup
sheriffjimoh Nov 18, 2025
aae157e
fix: update the username into slug and redirect
sheriffjimoh Nov 18, 2025
72505ba
fix: make the username & appear on the menu after change
sheriffjimoh Nov 20, 2025
05bc529
fix: update
sheriffjimoh Nov 22, 2025
2bdf7fe
fix: preferences page design
sheriffjimoh Nov 22, 2025
8c87593
fix: remove the top position
sheriffjimoh Nov 22, 2025
8d1ba11
fix: hide hero and lang page
sheriffjimoh Nov 25, 2025
fd9935b
fix: lang and fontsize queries
sheriffjimoh Nov 25, 2025
67e0dbc
feat: added method to save user's lang preferences and set it after l…
sheriffjimoh Nov 25, 2025
1cffcab
fix: update and clean up
sheriffjimoh Nov 25, 2025
314565e
fix: store preference in db
sheriffjimoh Nov 28, 2025
ed70130
fix: observations
sheriffjimoh Nov 28, 2025
c226f24
fix: clean up
sheriffjimoh Nov 29, 2025
d165690
Merge branch 'develop' of https://github.com/bitcashorg/masterbots in…
sheriffjimoh Nov 29, 2025
c95b764
Merge branch 'develop' into fix-new-popup-issues
AndlerRL Dec 1, 2025
539adbd
fix: update on web pro
sheriffjimoh Dec 3, 2025
7bf98bd
Merge branch 'fix-new-popup-issues' of https://github.com/bitcashorg/…
sheriffjimoh Dec 3, 2025
4fb555e
fix(web-pro): move update from web
sheriffjimoh Dec 4, 2025
c5f79c6
fix: update
sheriffjimoh Dec 5, 2025
a9345b3
fix: update
sheriffjimoh Dec 5, 2025
8ba318e
fix: pro-web build + nextjs ver
AndlerRL Dec 8, 2025
3f36265
Merge branch 'develop' into fix-new-popup-issues
AndlerRL Dec 8, 2025
793c9b9
fix: update web pro
sheriffjimoh Dec 8, 2025
c1da516
Merge branch 'fix-new-popup-issues' of https://github.com/bitcashorg/…
sheriffjimoh Dec 8, 2025
c83000a
fix: update
sheriffjimoh Dec 8, 2025
5854aa9
fix: profile lang and username update
sheriffjimoh Dec 11, 2025
cc2cf93
fix: preference page design
sheriffjimoh Dec 12, 2025
4e979f6
Merge branch 'develop' of https://github.com/bitcashorg/masterbots in…
sheriffjimoh Dec 12, 2025
25e6640
fix: update conflict
sheriffjimoh Dec 12, 2025
525fd5e
fix: pro build error
sheriffjimoh Dec 12, 2025
9f258c5
fix: sync merge regressions
AndlerRL Dec 15, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 29 additions & 17 deletions apps/hasura/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ This directory contains the Hasura GraphQL Engine configuration, migrations, met
## Overview

The Hasura backend provides:

- GraphQL API for all database operations
- Database schema management through migrations
- Metadata configuration for GraphQL schema customization
Expand Down Expand Up @@ -40,6 +41,7 @@ task boot # First-time setup: starts DB + Hasura + applies migrations
```

This command:

1. Starts PostgreSQL database container
2. Waits for database to be ready (10 seconds)
3. Starts Hasura container
Expand Down Expand Up @@ -78,20 +80,20 @@ Seeds are SQL files that populate the database with initial or reference data. T

Seeds in `apps/hasura/seeds/masterbots/` are organized by timestamp and purpose:

| Seed File | Purpose |
|-----------|---------|
| `1724269974513_init_config_seeds.sql` | Configuration enums (message types, complexity, length, tone) |
| `1724270512560_init_users_seeds.sql` | Initial user accounts (commented out for security) |
| `1724271272084_init_threads_seeds.sql` | Sample conversation threads |
| `1724271332200_init_messages_seeds.sql` | Sample messages in threads |
| `1738186795715_init_chatbot_metadata_seeds.sql` | Chatbot metadata (deprecated) |
| `1740386119320_init_domain_enum.sql` | Domain enumeration values |
| `1740386119321_init_chatbot_metadata_seeds.sql` | Updated chatbot metadata |
| `1746466168385_init_category_enum.sql` | Category enumeration values |
| `1746466170867_init_subcategory_enum.sql` | Subcategory enumeration values |
| `1746466178152_init_tag_enum_pt_1.sql` | Tag enumeration values (part 1 of 2) |
| `1746466178153_init_tag_enum_pt_2.sql` | Tag enumeration values (part 2 of 2) |
| `1746466541637_init_example_pt_*.sql` | Example data (parts 1-14) |
| Seed File | Purpose |
| ----------------------------------------------- | ------------------------------------------------------------- |
| `1724269974513_init_config_seeds.sql` | Configuration enums (message types, complexity, length, tone) |
| `1724270512560_init_users_seeds.sql` | Initial user accounts (commented out for security) |
| `1724271272084_init_threads_seeds.sql` | Sample conversation threads |
| `1724271332200_init_messages_seeds.sql` | Sample messages in threads |
| `1738186795715_init_chatbot_metadata_seeds.sql` | Chatbot metadata (deprecated) |
| `1740386119320_init_domain_enum.sql` | Domain enumeration values |
| `1740386119321_init_chatbot_metadata_seeds.sql` | Updated chatbot metadata |
| `1746466168385_init_category_enum.sql` | Category enumeration values |
| `1746466170867_init_subcategory_enum.sql` | Subcategory enumeration values |
| `1746466178152_init_tag_enum_pt_1.sql` | Tag enumeration values (part 1 of 2) |
| `1746466178153_init_tag_enum_pt_2.sql` | Tag enumeration values (part 2 of 2) |
| `1746466541637_init_example_pt_*.sql` | Example data (parts 1-14) |

### Best Practices for Seeds

Expand All @@ -109,13 +111,15 @@ This ensures seeds can be safely re-applied without causing errors or duplicate
#### 2. Maintain Timestamp Ordering

Seed files are executed in alphabetical order (timestamp-based). Ensure dependencies are respected:

- Configuration and enum seeds should run first
- Reference data should follow
- Relational data with foreign keys should run last

#### 3. Keep Large Seeds Split

Very large seed files (>20MB) should be split into multiple parts to:

- Improve version control diff performance
- Reduce memory usage during application
- Make debugging easier
Expand All @@ -127,8 +131,8 @@ Example: `init_example_pt_1.sql` through `init_example_pt_14.sql`
User credentials and personal information should be commented out in seed files:

```sql
-- INSERT INTO public."user"
-- (username, email, password, ...)
-- INSERT INTO public."user"
-- (username, email, password, ...)
-- VALUES ('user', 'email@example.com', 'password', ...)
```

Expand All @@ -147,11 +151,13 @@ task seed > seed.log 2>&1
```

This command:

- Redirects standard output (`stdout`) to `seed.log`
- Redirects error output (`stderr`) to the same file (`2>&1`)
- Allows you to review the output at your own pace using a text editor

After running this command, you can:

```bash
# View the entire log
cat seed.log
Expand All @@ -175,6 +181,7 @@ hasura seeds apply --project apps/hasura --database-name masterbots --admin-secr
```

**Note:** This command is the same as `task seed` but requires you to:

- Ensure the `HASURA_GRAPHQL_ADMIN_SECRET` environment variable is set
- Be in the project root directory
- Have Hasura running
Expand All @@ -186,6 +193,7 @@ hasura seeds apply --project apps/hasura --database-name masterbots --admin-secr
**Cause:** Seeds are being applied to a database that already has the data.

**Solution:** Ensure all INSERT statements use `ON CONFLICT` clauses:

```sql
INSERT INTO table_name VALUES (...)
ON CONFLICT (unique_column) DO NOTHING;
Expand All @@ -195,7 +203,8 @@ ON CONFLICT (unique_column) DO NOTHING;

**Cause:** Seeds are being applied in the wrong order, or referenced data doesn't exist.

**Solution:**
**Solution:**

1. Check the timestamp order of seed files
2. Ensure all dependent data is seeded first
3. Verify migrations have been applied before seeds
Expand All @@ -205,6 +214,7 @@ ON CONFLICT (unique_column) DO NOTHING;
**Cause:** Migrations or metadata changes haven't been applied.

**Solution:**

```bash
task migrate
```
Expand All @@ -214,6 +224,7 @@ task migrate
**Cause:** PostgreSQL container isn't running or hasn't finished initializing.

**Solution:**

1. Check if containers are running: `docker ps`
2. Restart services: `task down && task boot`
3. Check logs: `docker compose logs postgres`
Expand All @@ -229,6 +240,7 @@ task console
```

This opens the Hasura Console at `http://localhost:9695` where you can:

- Modify tables and relationships
- Configure permissions
- Test GraphQL queries
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,6 @@ object_relationships:
- name: complexityEnum
using:
foreign_key_constraint_on: default_complexity
- name: department
using:
foreign_key_constraint_on: department_id
- name: lengthEnum
using:
foreign_key_constraint_on: default_length
Expand Down Expand Up @@ -39,13 +36,6 @@ array_relationships:
table:
name: chatbot_domain
schema: public
- name: organization_chatbots
using:
foreign_key_constraint_on:
column: chatbot_id
table:
name: organization_chatbot
schema: public
- name: prompts
using:
foreign_key_constraint_on:
Expand All @@ -64,11 +54,9 @@ select_permissions:
- role: anonymous
permission:
columns:
- is_pro
- pro_exclusive
- chatbot_id
- avatar
- chatbot_id
- chatbot_id
- created_by
- default_complexity
- default_length
Expand All @@ -77,36 +65,36 @@ select_permissions:
- department_id
- description
- disabled
- is_pro
- name
- order
- pro_exclusive
filter: {}
allow_aggregations: true
comment: ""
- role: moderator
permission:
columns:
- disabled
- is_pro
- pro_exclusive
- avatar
- chatbot_id
- department_id
- order
- avatar
- created_by
- default_complexity
- default_length
- default_tone
- default_type
- department_id
- description
- disabled
- name
- order
filter: {}
allow_aggregations: true
comment: ""
- role: user
permission:
columns:
- is_pro
- pro_exclusive
- avatar
- chatbot_id
- created_by
Expand All @@ -117,8 +105,10 @@ select_permissions:
- department_id
- description
- disabled
- is_pro
- name
- order
- pro_exclusive
filter: {}
allow_aggregations: true
comment: ""
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ insert_permissions:
columns:
- deep_expertise
- favorite
- font_size
- lang
- preferred_complexity
- preferred_length
- preferred_tone
Expand All @@ -36,11 +38,13 @@ insert_permissions:
check:
user_id:
_eq: X-Hasura-User-Id
set:
user_id: x-hasura-User-Id
set:
user_id: X-Hasura-User-Id
columns:
- deep_expertise
- favorite
- font_size
- lang
- preferred_complexity
- preferred_length
- preferred_tone
Expand All @@ -54,6 +58,8 @@ select_permissions:
columns:
- deep_expertise
- favorite
- font_size
- lang
- preference_id
- preferred_complexity
- preferred_length
Expand All @@ -68,6 +74,8 @@ select_permissions:
columns:
- deep_expertise
- favorite
- font_size
- lang
- preference_id
- preferred_complexity
- preferred_length
Expand All @@ -82,23 +90,25 @@ select_permissions:
columns:
- deep_expertise
- favorite
- font_size
- lang
- preference_id
- preferred_complexity
- preferred_length
- preferred_tone
- preferred_type
- user_id
- web_search
filter:
user_id:
_eq: X-Hasura-User-Id
filter: {}
comment: ""
update_permissions:
- role: moderator
permission:
columns:
- deep_expertise
- favorite
- font_size
- lang
- preferred_complexity
- preferred_length
- preferred_tone
Expand All @@ -112,6 +122,8 @@ update_permissions:
columns:
- deep_expertise
- favorite
- font_size
- lang
- preferred_complexity
- preferred_length
- preferred_tone
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
-- Could not auto-generate a down migration.
-- Please write an appropriate down migration for the SQL below:
-- alter table "public"."preference" add column "lang" text
-- null default 'en';
Comment on lines +1 to +4
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 | 🔴 Critical

Critical: Implement functional down migration.

This placeholder breaks migration rollback capability. Down migrations must contain actual SQL to revert schema changes.

Apply this fix:

--- Could not auto-generate a down migration.
--- Please write an appropriate down migration for the SQL below:
--- alter table "public"."preference" add column "lang" text
---  null default 'en';
+ALTER TABLE "public"."preference" DROP COLUMN "lang";
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
-- Could not auto-generate a down migration.
-- Please write an appropriate down migration for the SQL below:
-- alter table "public"."preference" add column "lang" text
-- null default 'en';
ALTER TABLE "public"."preference" DROP COLUMN "lang";
🤖 Prompt for AI Agents
In
apps/hasura/migrations/masterbots/1764041110780_alter_table_public_preference_add_column_lang/down.sql
around lines 1 to 4, the down migration is a placeholder and must be replaced
with a real rollback SQL statement that reverts the added column; update the
file to run an ALTER TABLE that removes the "lang" column (use DROP COLUMN IF
EXISTS "lang" on table "public"."preference") so the migration can be rolled
back cleanly.

Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
alter table "public"."preference" add column "lang" text
null default 'en';
Comment on lines +1 to +2
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 | 🔴 Critical

🧩 Analysis chain

Verify the corresponding down migration is complete.

The addition of the lang column with a nullable type and default value 'en' is appropriate for supporting multilingual user preferences. However, the AI summary indicates that the down migration may be a placeholder due to auto-generation failure.

Ensure the corresponding down migration file at apps/hasura/migrations/masterbots/1764041110780_alter_table_public_preference_add_column_lang/down.sql contains the full SQL to drop the column (not just a placeholder comment):


🏁 Script executed:

#!/bin/bash
# Verify the down migration file is not just a placeholder
down_migration="apps/hasura/migrations/masterbots/1764041110780_alter_table_public_preference_add_column_lang/down.sql"

if [ -f "$down_migration" ]; then
  echo "=== Down migration content ==="
  cat "$down_migration"
  
  echo ""
  echo "=== Checking for SQL keyword (should contain 'drop' or 'alter') ==="
  if grep -iq "drop\|alter" "$down_migration"; then
    echo "✓ Down migration contains SQL"
  else
    echo "✗ Down migration may be a placeholder"
  fi
else
  echo "✗ Down migration file not found"
fi

Length of output: 322


Implement the corresponding down migration with actual SQL.

Verification confirms the down migration is incomplete—it contains only a placeholder comment and no actual SQL. The down migration must include the SQL to drop the column:

alter table "public"."preference" drop column "lang";

Update apps/hasura/migrations/masterbots/1764041110780_alter_table_public_preference_add_column_lang/down.sql with the proper rollback statement before merging.

🤖 Prompt for AI Agents
In
apps/hasura/migrations/masterbots/1764041110780_alter_table_public_preference_add_column_lang/down.sql
(replace the placeholder comment), add the actual SQL rollback to drop the added
column: include a single statement that alters the "public"."preference" table
to drop the "lang" column so the migration can be properly rolled back.

Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
-- Could not auto-generate a down migration.
-- Please write an appropriate down migration for the SQL below:
-- alter table "public"."preference" add column "font_size" text
-- null default 'medium';
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
alter table "public"."preference" add column "font_size" text
null default 'medium';
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
alter table "public"."preference" alter column "preferred_type" set not null;
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
alter table "public"."preference" alter column "preferred_type" drop not null;
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
alter table "public"."preference" alter column "preferred_complexity" set not null;
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
alter table "public"."preference" alter column "preferred_complexity" drop not null;
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
alter table "public"."preference" alter column "preferred_length" set not null;
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
alter table "public"."preference" alter column "preferred_length" drop not null;
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
alter table "public"."preference" alter column "preferred_tone" set not null;
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
alter table "public"."preference" alter column "preferred_tone" drop not null;
Git LFS file not shown

This file was deleted.

Loading