Skip to content

Commit

Permalink
release: ssr and dialog ui v0 (#112)
Browse files Browse the repository at this point in the history
* devops: force deployment

* devops: force deployment

* devops: force deployment

* devops: update cloudbuild.yml

* devops: cloud logging only

* devops: remove cloudbuild.yml

* chore: update bunlock

* feat: browse as homepage, work early access (#62)

* feat: browse as home

* feat: browse as home

* feat: remove tabs

* feat: supabase auth (#63)

* feat: supabase auth

* feat: supabase auth

* feat: supabase auth

* feat: supabase auth

* feat: supabase auth

* feat: supabase auth

* feat: supabase auth

* feat: supabase auth

* feat: supabase auth

* feat: pro form

* devops:  lighthouse reports on prs (#64)

* devops:  lighthouse reports on prs

* chore: cleanup

* devops: lighthouse ci (#65)

* devops:  lighthouse reports on prs

* chore: cleanup

* chore: test lighthouse ci

* devops: lighthouse reports on pr

* devops: use zentered/vercel-preview-url

* devops: lighthouse ci github action (#66)

* chore: test lighthouse ci

* devops: fix version on github actions

* chore: cleanup

* devops: debug lighthouse github action (#67)

* chore: test lighthouse ci

* devops: debug github actions

* devops: correct project id on github actions (#69)

* devops: debug github actions

* devops: correct project id

* devops: correct vercel team id (#70)

* devops: debug github actions

* devops: correct vercel team id

* devops: debug github actions (#71)

* devops: debug github actions

* devops: use actions/checkout v4

* devops: add protocol to lhci url

* devops: use foo-software/lighthouse-check-action (#72)

* devops: debug github actions

* devops: debug github actions

* devops: use foo-software/lighthouse-check-action

* devops: lhci budget path (#73)

* devops: debug github actions

* devops: lhci budget path

* devops: disable lhci budget (#74)

* devops: debug github actions

* devops: disable lhci budget

* devops: run lhci on bot and user landings (#75)

* devops: debug github actions

* devops: run lhci on bot and user landings

* devops: run lhci on bot and user landings (#76)

* devops: debug github actions

* devops: run lhci on bot and user landings

* devops: run lhci on bot and user landings

* devops: run lhci on bot and user landings (#77)

* devops: debug github actions

* devops: run lhci on bot and user landings

* devops: debug lhci results comment (#78)

* devops: debug github actions

* devops: debug lhci results comment

* devops: debug lhci results comment (#79)

* devops: debug github actions

* devops: debug lhci results comment

* feat: thread landing (#80)

* devops: debug lhci results comment

* feat: thread landing

* devops: debug lhci results comment

* devops: debug lhci results comment

* devops: debug lhci results comment (#83)

* chore: cleanup

* devops: debug lhci results comment

* devops: debug lhci results comment (#84)

* devops: debug lhci results comment

* devops: debug lhci results comment

* devops: debug lhci results comment (#85)

* devops: debug lhci results comment

* devops: debug lhci results comment

* devops: debug lhci results comment (#86)

* devops: debug lhci results comment

* devops: debug lhci results comment

* devops: debug lhci results comment

* devops: debug lhci results comment

* devops: debug lhci results comment

* devops: debug lhci results comment (#88)

* devops: debug lhci results comment

* devops: debug lhci results comment

* devops: debug lhci results comment (#89)

* devops: debug lhci results comment

* devops: debug lhci results comment

* devops: debug lhci results comment

* devops: lhci results table comment

* devops: debug lhci results comment

* devops: lhci results table comment (#90)

* devops: lhci results table comment

* devops: lhci results table comment (#91)

* devops: lhci results table comment

* devops: lhci results table comment

* devops: lhci results table comment

* devops: debug lhci results comment (#92)

* devops: debug lhci results comment

* devops: debug lhci results comment

* devops: debug lhci results comment

* devops: debug lhci results comment (#93)

* devops: debug lhci results comment

* devops: debug lhci results comment

* devops: debug lhci results comment

* devops: lhci results table comment (#94)

* devops: debug lhci results comment

* devops: debug lhci results comment (#95)

* devops: debug lhci results comment

* devops: debug lhci results comment

* devops: debug lhci results comment

* devops: debug lhci results comment (#96)

* devops: debug lhci results comment

* devops: debug lhci results comment

* devops: debug lhci results comment

* devops: debug lhci results comment

* devops: lhci results table comment

* devops: lhci results table comment

* devops: debug lhci results comment

* devops: lhci results table comment (#98)

* chore: cleanup

* devops: lhci results table comment

* devops: test lhci results comment (#99)

* devops: test lhci results comment

* devops: test lhci results comment

* devops: test lhci results comment

* feat: shortener

* feat: supabase auth

* fix: hasura jwt secret on local env

* fix: hasura jwt secret on local env

* chore: user profile cookie

* chore: user profile cookie

* chore: user profile cookie

* chore: user profile cookie

* feat: supabase auth, github oauth, session cookies

* devops: config pkgs, eslint, prettier, tailwind, ts (#101)

* devops: config pkgs, eslint, prettier, tailwind, ts

* devops: config pkgs, eslint, prettier, tailwind, ts

* devops: config pkgs, eslint, prettier, tailwind, ts

* devops: config pkgs, eslint, prettier, tailwind, ts

* devops: remove first comment on lhci action

* devops: fix eslint action

* chore: ssr on browse, supa types, updated actions (#103)

* chore: browse ssr improvements, supabase db types

* chore: fix eslint

* devops: lhci on pr

* feat: thread ui dialog and ssr in public pages (#105)

* feat: thread dialog ui

* feat: thread dialog ui

* feat: thread dialog ui

* feat: ssr and layout improvements on u and b routes

* fix: correct thread number

* feat: ssr and layout improvements on u and b routes

* feat: global categories nav

* chore: move shared components

* feat: copy shortlink

* chore: disable getUserProfile

* perf: only 25 items on first render

* perf: only 20 items on first render

* fix: supabase ssr bug (#106)

* devops: wait 2 minutes before running lhci (#107)

* feat: load only 15 more

* fix: auth issues

* devops: wait 2 minutes before running lhci

* devops: wait before lhci, fix vercel build (#108)

* feat: load only 15 more

* fix: auth issues

* devops: wait 2 minutes before running lhci

* chore: cleanup

* fix: header session bug

* fix: chat auth bug (#109)

* fix: chat auth bug

* fix: chat auth bug

* fix: chat auth bug

* fix: chat navigation (#110)

* fix: icon size

* fix: chat navigation

* feat: chat list and dialog (#111)

* feat: chat lists and dialog

* feat: chat lists and dialog

* feat: dialog chat input
  • Loading branch information
gaboesquivel authored Apr 9, 2024
1 parent 8ae6f73 commit cc76218
Show file tree
Hide file tree
Showing 229 changed files with 19,813 additions and 24,143 deletions.
3 changes: 3 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module.exports = {
extends: ['@repo/eslint-config/library.js']
}
27 changes: 27 additions & 0 deletions .github/lighthouse/budget.json
Original file line number Diff line number Diff line change
@@ -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
}
]
}
]
85 changes: 85 additions & 0 deletions .github/workflows/lighthouse.yml
Original file line number Diff line number Diff line change
@@ -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/[email protected]
# 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/[email protected]
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/[email protected]
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/[email protected]
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/[email protected]
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
number: ${{ github.event.issue.number }}
header: lighthouse
message: |
${{ steps.format_lighthouse_score.outputs.comment }}
18 changes: 18 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -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
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
v20.11.0
24 changes: 11 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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.
Expand All @@ -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
```


3 changes: 3 additions & 0 deletions apps/masterbots.ai/.env.example
Original file line number Diff line number Diff line change
Expand Up @@ -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"}'
6 changes: 4 additions & 2 deletions apps/masterbots.ai/.env.local
Original file line number Diff line number Diff line change
Expand Up @@ -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

3 changes: 3 additions & 0 deletions apps/masterbots.ai/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module.exports = {
extends: ['@repo/eslint-config/next.js']
}
26 changes: 0 additions & 26 deletions apps/masterbots.ai/.eslintrc.json

This file was deleted.

31 changes: 31 additions & 0 deletions apps/masterbots.ai/app/(browse)/[category]/[threadId]/page.tsx
Original file line number Diff line number Diff line change
@@ -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 (
<div className="container">
<CategoryTabs categories={categories} />
<BrowseInput />
<ThreadAccordion
thread={thread}
initialMessagePairs={initialMessagePairs}
/>
</div>
)
}

export interface ThreadPageProps {
params: {
threadId: string
chatbot: string
}
}
33 changes: 33 additions & 0 deletions apps/masterbots.ai/app/(browse)/[category]/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import { ThreadList } from '@/components/shared/thread-list'
import { CategoryTabs } from '@/components/shared/category-tabs/category-tabs'
import { BrowseInput } from '@/components/shared/browse-input'
import { getBrowseThreads, getCategories } from '@/services/hasura'

export const revalidate = 3600 // revalidate the data at most every hour

export default async function BrowseCategoryPage({
params
}: {
params: { category: string }
}) {
const categories = await getCategories()
const categoryId = categories.find(
c =>
c.name.toLowerCase().replace(/\s+/g, '_').replace(/\&/g, '_') ===
params.category
).categoryId
if (!categoryId) throw new Error('Category id not foud')

const threads = await getBrowseThreads({
limit: 20,
categoryId
})

return (
<div className="container">
<CategoryTabs categories={categories} initialCategory={params.category} />
<BrowseInput />
<ThreadList initialThreads={threads} filter={{ categoryId }} />
</div>
)
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { BrowseProvider } from '@/lib/hooks/use-browse';
import FooterCT from '@/components/footer-ct';
import { BrowseProvider } from '@/hooks/use-browse'
import FooterCT from '@/components/layout/footer-ct'

interface BrowseLayoutProps {
children: React.ReactNode
Expand All @@ -8,12 +8,10 @@ interface BrowseLayoutProps {
export default async function BrowseLayout({ children }: BrowseLayoutProps) {
return (
<BrowseProvider>
{ /* TODO: https://github.com/TheSGJ/nextjs-toploader/issues/66 */}
{/* <NextTopLoader color="#1ED761" initialPosition={0.20} /> */}
<main className="flex flex-col h-[calc(100vh-theme(spacing.16))]">
<section className="overflow-auto group scrollbar w-full">
{children}
<FooterCT />
<FooterCT />
</section>
</main>
</BrowseProvider>
Expand Down
18 changes: 18 additions & 0 deletions apps/masterbots.ai/app/(browse)/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import { ThreadList } from '@/components/shared/thread-list'
import { CategoryTabs } from '@/components/shared/category-tabs/category-tabs'
import { BrowseInput } from '@/components/shared/browse-input'
import { getBrowseThreads, getCategories } from '@/services/hasura'

export default async function BrowsePage() {
const categories = await getCategories()
const threads = await getBrowseThreads({
limit: 20
})
return (
<div className="container">
<CategoryTabs categories={categories} />
<BrowseInput />
<ThreadList initialThreads={threads} filter={{}} />
</div>
)
}
Loading

0 comments on commit cc76218

Please sign in to comment.