diff --git a/.eslintrc.js b/.eslintrc.js new file mode 100644 index 00000000..7ddc50a2 --- /dev/null +++ b/.eslintrc.js @@ -0,0 +1,3 @@ +module.exports = { + extends: ['@repo/eslint-config/library.js'] +} diff --git a/.github/lighthouse/budget.json b/.github/lighthouse/budget.json new file mode 100644 index 00000000..55c15577 --- /dev/null +++ b/.github/lighthouse/budget.json @@ -0,0 +1,27 @@ +[ + { + "path": "/*", + "timings": [ + { + "metric": "interactive", + "budget": 3000 + }, + { + "metric": "first-contentful-paint", + "budget": 1800 + } + ], + "resourceSizes": [ + { + "resourceType": "script", + "budget": 100 + } + ], + "resourceCounts": [ + { + "resourceType": "third-party", + "budget": 4 + } + ] + } +] \ No newline at end of file diff --git a/.github/workflows/lighthouse.yml b/.github/workflows/lighthouse.yml new file mode 100644 index 00000000..c3de53d4 --- /dev/null +++ b/.github/workflows/lighthouse.yml @@ -0,0 +1,85 @@ +name: Vercel Preview URL Lighthouse Audit + +on: + pull_request + +jobs: + generate_lighthouse_audit: + timeout-minutes: 30 + runs-on: ubuntu-latest + steps: + # - name: Add comment to PR + # id: loading_comment_to_pr + # uses: marocchino/sticky-pull-request-comment@v2.9.0 + # with: + # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + # number: ${{ github.event.issue.number }} + # header: lighthouse + # message: | + # Running Lighthouse audit... + - name: Wait for 2 minutes + run: sleep 120 + - name: Capture Vercel preview URL + id: vercel_preview_url + uses: zentered/vercel-preview-url@v1.1.9 + env: + VERCEL_TOKEN: ${{ secrets.VERCEL_TOKEN }} + with: + vercel_project_id: prj_k5bYwz7n5hAUFdrWE986D91RiMbW + vercel_team_id: team_7PAgeqjbXkY6qdxNIEKLbVSC + - name: Get URL + run: echo "https://${{ steps.vercel_preview_url.outputs.preview_url }}" + - uses: actions/checkout@v4 + - name: Audit preview URL with Lighthouse + id: lighthouse_audit + uses: treosh/lighthouse-ci-action@11.4.0 + with: + urls: | + "https://${{ steps.vercel_preview_url.outputs.preview_url }}" + "https://${{ steps.vercel_preview_url.outputs.preview_url }}/b/moneybot" + "https://${{ steps.vercel_preview_url.outputs.preview_url }}/u/slug-1" + "https://${{ steps.vercel_preview_url.outputs.preview_url }}/p" + "https://${{ steps.vercel_preview_url.outputs.preview_url }}/health" + "https://${{ steps.vercel_preview_url.outputs.preview_url }}/health/a8103808-14a3-48ed-aa5a-9e490cfdcf0e" + # budgetPath: '.github/lighthouse/budget.json' + uploadArtifacts: true + temporaryPublicStorage: true + - name: Format lighthouse score + id: format_lighthouse_score + uses: actions/github-script@v7.0.1 + with: + github-token: ${{secrets.GITHUB_TOKEN}} + script: | + const manifest = ${{ steps.lighthouse_audit.outputs.manifest }}; + const links = ${{ steps.lighthouse_audit.outputs.links }}; + + const formatResult = (res) => Math.round((res * 100)); + const score = res => res >= 90 ? '🟢' : res >= 50 ? '🟠' : '🔴'; + + let comment = '⚡️ Lighthouse report\n' + + manifest.forEach(result => { + const pageLink = result.url; + comment += `\nPage: ${pageLink}\n`; + comment += `Report ${links[pageLink]}\n`; + comment += '| Category | Score |\n'; + comment += '| --- | --- |\n'; + + Object.keys(result.summary).forEach(key => result.summary[key] = formatResult(result.summary[key])); + comment += `| ${score(result.summary.performance)} Performance | ${result.summary.performance} |\n`; + comment += `| ${score(result.summary.accessibility)} Accessibility | ${result.summary.accessibility} |\n`; + comment += `| ${score(result.summary['best-practices'])} Best practices | ${result.summary['best-practices']} |\n`; + comment += `| ${score(result.summary.seo)} SEO | ${result.summary.seo} |\n`; + comment += `| ${score(result.summary.pwa)} PWA | ${result.summary.pwa} |\n`; + }); + + core.setOutput("comment", comment); + - name: Add comment to PR + id: comment_to_pr + uses: marocchino/sticky-pull-request-comment@v2.9.0 + with: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + number: ${{ github.event.issue.number }} + header: lighthouse + message: | + ${{ steps.format_lighthouse_score.outputs.comment }} \ No newline at end of file diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml new file mode 100644 index 00000000..0b30280a --- /dev/null +++ b/.github/workflows/lint.yml @@ -0,0 +1,18 @@ +name: Lint + +on: + pull_request: + push: + branches: + - master + +jobs: + eslint: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: oven-sh/setup-bun@v1 + + # run any `bun` or `bunx` command + - run: bun install + - run: bun run lint diff --git a/.nvmrc b/.nvmrc new file mode 100644 index 00000000..7ea6a59d --- /dev/null +++ b/.nvmrc @@ -0,0 +1 @@ +v20.11.0 diff --git a/README.md b/README.md index d063bd4b..10c40a29 100644 --- a/README.md +++ b/README.md @@ -2,28 +2,28 @@ **MasterBots is a UX-focused open-source chatbot aggregator platform and alternative to ChatGPT.** -**Problem #1: ChatGPT spaghetti threads are hard to organize and most users are not skilled at prompting. The recent custom GPTs may solve some of these problems.** +**Problem #1: ChatGPT spaghetti threads are hard to organize and most users are not skilled at prompting. The recent custom GPTs may solve some of these problems.** Solution: However, MasterBots is organized by categories & domain-expert bots that will be prompt-tuned and fine-tuned to give better experiences from the beginning. -**Problem #2: ChatGPT and LLMs are focused on inference. Inference is slow and costly.** -Re-using generations is far more efficient. +**Problem #2: ChatGPT and LLMs are focused on inference. Inference is slow and costly.** +Re-using generations is far more efficient. -Solution: MasterBots will make all user generations public so people who want answers can browse for answers rather than ‘chat’ and chat requests can be routed via lexical search to existing generations before using an LLM. (Note: In the future private generations will be an option using blackbox inference and to prevent any one company from amassing user data. Generations will either be public for all or private.) Users will also have an option to Share GPT4 thread links to MasterBots to be shared publicly. +Solution: MasterBots will make all user generations public so people who want answers can browse for answers rather than ‘chat’ and chat requests can be routed via lexical search to existing generations before using an LLM. (Note: In the future private generations will be an option using blackbox inference and to prevent any one company from amassing user data. Generations will either be public for all or private.) Users will also have an option to Share GPT4 thread links to MasterBots to be shared publicly. **Problem #3: ChatGPT & GPT4 are expensive and slow.** -Solution: Fine-tuned open-source small models can be cheap and fast. Zepher/Mistral with only 7B parameters is competitive with GPT3.5. The future is thousands of small fine-tuned expert models, not one model to do everything. +Solution: Fine-tuned open-source small models can be cheap and fast. Zepher/Mistral with only 7B parameters is competitive with GPT3.5. The future is thousands of small fine-tuned expert models, not one model to do everything. -**Problem #4: ChatGPT UX is basic.** +**Problem #4: ChatGPT UX is basic.** -Solution: We plan to improve UX by organizing based 1) on category & domain-expertise 2) easy response customizations on tone/length/type/complexity 3) make responses clickable to facilitate further questions 4) continually focus on easy prompting UX. +Solution: We plan to improve UX by organizing based 1) on category & domain-expertise 2) easy response customizations on tone/length/type/complexity 3) make responses clickable to facilitate further questions 4) continually focus on easy prompting UX. -MasterBots is open-source. We are building in public! +MasterBots is open-source. We are building in public! Contributors will earn platform credits that can be sold for cash. (Credits may get more valuable over time) -Here is our public Trello board: +Here is our public Trello board: https://trello.com/b/GDCm18zN/masterbots-chatbot-aggregator-development-board ## Requirements @@ -42,7 +42,7 @@ In root folder, create an .env file based of .env_sample and the use `task` to e - **reboot**: Shuts down and then restarts the services. - **seed**: Applies seed data to the Hasura project. - **console**: Launches the Hasura console for the specified project. -- **migrate**: Applies database migrations and updates Hasura metadata. +- **migrate**: Applies database migrations and updates Hasura metadata. - **reload**: Restarts the Postgres service, then all services, and tails the Hasura logs. - **up**: Starts all services defined in the Docker Compose file with a build. - **down**: Shuts down all services and removes any orphaned containers. @@ -53,8 +53,6 @@ In apps/masterbots.ai folder (set up .env file - see .env_sample): ``` bun install -turbo run dev --scope="masterbots.ai" +turbo run dev --scope="masterbots.ai" # task app will execute the same command ``` - - diff --git a/apps/masterbots.ai/.env.example b/apps/masterbots.ai/.env.example index 5618bc98..c68aba3c 100644 --- a/apps/masterbots.ai/.env.example +++ b/apps/masterbots.ai/.env.example @@ -7,4 +7,7 @@ OPENAI_API_KEY=XXXXXXXX GOOGLE_CLIENT_ID=XXXXXXXX GOOGLE_CLIENT_SECRET=XXXXXXXX +DUB_API_KEY= +HASURA_GRAPHQL_ADMIN_SECRET= +HASURA_GRAPHQL_JWT_SECRET='{"type":"HS256", "key":"xx"}' diff --git a/apps/masterbots.ai/.env.local b/apps/masterbots.ai/.env.local index 983fdfaa..b3f95feb 100644 --- a/apps/masterbots.ai/.env.local +++ b/apps/masterbots.ai/.env.local @@ -11,6 +11,8 @@ NEXT_PUBLIC_APP_ENV=test NEXTAUTH_URL=http://localhost:3000 AUTH_SECRET=bb755cba466058b2e6a195541468e84c -HASURA_GRAPHQL_ADMIN_SECRET=lfg -HASURA_GRAPHQL_JWT_SECRET='{"type":"HS256", "key":"xx52fa850c02dc222631cca898ed1485821a70912a6e3649c49076912daa3b62182ba013315915d64f402ddfbb8b58eb5bd11ba225136a6af45bbae07ca872f4"}' +JWT_TOKEN_EXPIRATION=2630016 + +NEXT_PUBLIC_SUPABASE_URL=https://ipgwcdekxoxsjojvzrre.supabase.co +NEXT_PUBLIC_SUPABASE_ANON_KEY=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6ImlwZ3djZGVreG94c2pvanZ6cnJlIiwicm9sZSI6ImFub24iLCJpYXQiOjE3MTIyNzE3NjgsImV4cCI6MjAyNzg0Nzc2OH0.d3iRMKIaHPd-pKckO_uRYKdndGDUSWm2RtEJkEV-sDE diff --git a/apps/masterbots.ai/.eslintrc.js b/apps/masterbots.ai/.eslintrc.js new file mode 100644 index 00000000..0a714584 --- /dev/null +++ b/apps/masterbots.ai/.eslintrc.js @@ -0,0 +1,3 @@ +module.exports = { + extends: ['@repo/eslint-config/next.js'] +} diff --git a/apps/masterbots.ai/.eslintrc.json b/apps/masterbots.ai/.eslintrc.json deleted file mode 100644 index c17b5320..00000000 --- a/apps/masterbots.ai/.eslintrc.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "$schema": "https://json.schemastore.org/eslintrc", - "root": true, - "extends": [ - "next/core-web-vitals", - "prettier", - "plugin:tailwindcss/recommended" - ], - "plugins": ["tailwindcss"], - "rules": { - "tailwindcss/no-custom-classname": "off", - "tailwindcss/classnames-order": "off" - }, - "settings": { - "tailwindcss": { - "callees": ["cn", "cva"], - "config": "tailwind.config.js" - } - }, - "overrides": [ - { - "files": ["*.ts", "*.tsx"], - "parser": "@typescript-eslint/parser" - } - ] -} diff --git a/apps/masterbots.ai/app/(browse)/[category]/[threadId]/page.tsx b/apps/masterbots.ai/app/(browse)/[category]/[threadId]/page.tsx new file mode 100644 index 00000000..3910c808 --- /dev/null +++ b/apps/masterbots.ai/app/(browse)/[category]/[threadId]/page.tsx @@ -0,0 +1,31 @@ +import { getCategories, getMessagePairs, getThread } from '@/services/hasura' + +import { ThreadAccordion } from '@/components/shared/thread-accordion' +import { CategoryTabs } from '@/components/shared/category-tabs/category-tabs' +import { BrowseInput } from '@/components/shared/browse-input' + +export default async function ThreadPage({ params }: ThreadPageProps) { + const categories = await getCategories() + const thread = await getThread({ + threadId: params.threadId + }) + const initialMessagePairs = await getMessagePairs(thread.threadId) + + return ( +
+ Let us know what areas are you most interested in to obtain early + access. +
+Welcome to Masterbots, the premier destination for engaging with domain-specific AI-driven - chatbots. By using our website, you agree to the collection, use, and sharing of your personal information - as described in this privacy policy. Our service involves the aggregation of chatbot interactions, which - are publicized by default.
- -Depending on your location, you may have rights including:
-We implement appropriate technical and organizational measures to protect the security of your - personal information against unauthorized or unlawful processing and against accidental loss, destruction, - or damage.
- -Our service is not directed to individuals under the age of 13. We do not knowingly collect - personal information from children under 13.
- -We may update this policy from time to time. The updated version will be indicated by an - updated “Revised” date.
- -For any questions or concerns regarding this privacy policy, please contact us at - contact@masterbots.ai
- - -Welcome to Masterbots.ai ("we,", "us," "our"). By accessing our website, you agree to these Terms of Service - ("Terms"), our Privacy Policy, and all applicable laws and regulations governing the use of our platform. Our - website aggregates AI chatbot conversations and publicizes these chats by default. We provide a platform for - users to interact with various AI chatbots and share their interactions publicly on our site.
- -By using our website, you acknowledge that you have read, understood, and agreed to be bound by these Terms. If - you do not agree with any part of these Terms, you must not use our website.
- -You agree not to use our website for any unlawful purpose or in any way that interrupts, damages, or impairs - the service. You agree not to attempt to gain unauthorized access to our website or any networks, servers, or - computer systems connected to our website. You are responsible for ensuring that any content you submit or - share through our website complies with all applicable laws and regulations. You must not upload, share, or - otherwise disseminate any content that is unlawful, harmful, threatening, abusive, harassing, defamatory, - vulgar, obscene, or otherwise objectionable.
- -By using our service, you understand and agree that all chats you engage in with our AI chatbots may be - publicized on our website by default. This includes any text, images, or other content you share during these - interactions. You grant us a non-exclusive, worldwide, royalty-free license to use, reproduce, modify, adapt, - publish, and display such content for the purpose of operating and providing our service.
- -The content published on our website, including but not limited to text, graphics, logos, and software, is - the property of Masterbots.ai or its licensors and is protected by copyright and intellectual property laws. You - may not use, copy, modify, or distribute any content from our website without the express permission of the - owner.
- -Our website is provided on an "AS IS" and "AS AVAILABLE" basis without warranties of any kind, either express - or implied, including but not limited to warranties of merchantability, fitness for a particular purpose, or - non-infringement.
- -We shall not be liable for any direct, indirect, incidental, special, consequential, or punitive damages - resulting from your access to or use of our website.
- -We reserve the right to modify these Terms at any time. We will provide notice of any significant changes by - updating the date at the top of these Terms and, where appropriate, notification via email or our - website.
- -These Terms shall be governed by and construed in accordance with the laws of Delaware, without giving effect - to any principles of conflicts of law.
- -For any questions or concerns regarding these Terms, please contact us at contact@masterbots.ai
- - - {/* */} -+ Welcome to Masterbots, the premier destination for engaging with + domain-specific AI-driven chatbots. By using our website, you agree to + the collection, use, and sharing of your personal information as + described in this privacy policy. Our service involves the aggregation + of chatbot interactions, which are publicized by default. +
+ ++ Depending on your location, you may have rights including: +
++ We implement appropriate technical and organizational measures to + protect the security of your personal information against unauthorized + or unlawful processing and against accidental loss, destruction, or + damage. +
+ ++ Our service is not directed to individuals under the age of 13. We do + not knowingly collect personal information from children under 13. +
+ ++ We may update this policy from time to time. The updated version will + be indicated by an updated “Revised” date. +
+ ++ For any questions or concerns regarding this privacy policy, please + contact us at contact@masterbots.ai +
+ ++ Welcome to Masterbots.ai ("we,", "us," + "our"). By accessing our website, you agree to these Terms + of Service ("Terms"), our Privacy Policy, and all applicable + laws and regulations governing the use of our platform. Our website + aggregates AI chatbot conversations and publicizes these chats by + default. We provide a platform for users to interact with various AI + chatbots and share their interactions publicly on our site. +
+ ++ By using our website, you acknowledge that you have read, understood, + and agreed to be bound by these Terms. If you do not agree with any + part of these Terms, you must not use our website. +
+ ++ You agree not to use our website for any unlawful purpose or in any + way that interrupts, damages, or impairs the service. You agree not to + attempt to gain unauthorized access to our website or any networks, + servers, or computer systems connected to our website. You are + responsible for ensuring that any content you submit or share through + our website complies with all applicable laws and regulations. You + must not upload, share, or otherwise disseminate any content that is + unlawful, harmful, threatening, abusive, harassing, defamatory, + vulgar, obscene, or otherwise objectionable. +
+ ++ By using our service, you understand and agree that all chats you + engage in with our AI chatbots may be publicized on our website by + default. This includes any text, images, or other content you share + during these interactions. You grant us a non-exclusive, worldwide, + royalty-free license to use, reproduce, modify, adapt, publish, and + display such content for the purpose of operating and providing our + service. +
+ ++ The content published on our website, including but not limited to + text, graphics, logos, and software, is the property of Masterbots.ai + or its licensors and is protected by copyright and intellectual + property laws. You may not use, copy, modify, or distribute any + content from our website without the express permission of the owner. +
+ ++ Our website is provided on an "AS IS" and "AS + AVAILABLE" basis without warranties of any kind, either express + or implied, including but not limited to warranties of + merchantability, fitness for a particular purpose, or + non-infringement. +
+ ++ We shall not be liable for any direct, indirect, incidental, special, + consequential, or punitive damages resulting from your access to or + use of our website. +
+ ++ We reserve the right to modify these Terms at any time. We will + provide notice of any significant changes by updating the date at the + top of these Terms and, where appropriate, notification via email or + our website. +
+ ++ These Terms shall be governed by and construed in accordance with the + laws of Delaware, without giving effect to any principles of conflicts + of law. +
+ ++ For any questions or concerns regarding these Terms, please contact us + at contact@masterbots.ai +
+ + {/* */} +- You can start a conversation with me here or try the following - examples: -
-