{"id":14070192,"url":"https://github.com/get-convex/convex-ai-chat","last_synced_at":"2025-04-13T07:30:55.987Z","repository":{"id":208300213,"uuid":"719334055","full_name":"get-convex/convex-ai-chat","owner":"get-convex","description":null,"archived":false,"fork":false,"pushed_at":"2024-06-17T15:47:55.000Z","size":237,"stargazers_count":25,"open_issues_count":1,"forks_count":7,"subscribers_count":3,"default_branch":"main","last_synced_at":"2024-08-13T07:17:11.658Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/get-convex.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-11-16T00:17:58.000Z","updated_at":"2024-08-08T09:19:00.000Z","dependencies_parsed_at":"2023-11-20T20:30:15.224Z","dependency_job_id":"55207667-e1c3-4758-a734-4d9fc1b363bc","html_url":"https://github.com/get-convex/convex-ai-chat","commit_stats":null,"previous_names":["get-convex/convex-ai-chat"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/get-convex%2Fconvex-ai-chat","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/get-convex%2Fconvex-ai-chat/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/get-convex%2Fconvex-ai-chat/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/get-convex%2Fconvex-ai-chat/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/get-convex","download_url":"https://codeload.github.com/get-convex/convex-ai-chat/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":223573807,"owners_count":17167369,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-13T07:07:32.913Z","updated_at":"2024-11-07T19:13:48.319Z","avatar_url":"https://github.com/get-convex.png","language":"TypeScript","funding_links":[],"categories":["TypeScript"],"sub_categories":[],"readme":"# AI Chat with Convex Vector Search\n\nAn example of building AI-powered chat interface using Convex\n[vector search](https://docs.convex.dev/vector-search).\n\n![Screenshot of a website with AI chat modal open](./screenshot.png \"AI chat UI\")\n\n## Overview:\n\nThis app demonstrates how you can add a chat bot to an existing website, powered\nby Convex.\n\n- The chat is trigged by a button in [`App.tsx`](./src/App.tsx)\n- The chat frontend is all in [`src/aiChat`](./src/aiChat/index.tsx)\n- An example of web scraping is in\n  [`convex/ingest/load.ts`](./convex/ingest/load.ts)\n- Embedding is performed in [`convex/ingest/embed.ts`](./convex/ingest/embed.ts)\n- The public endpoints for the backend are in\n  [`convex/messages.ts`](./convex/messages.ts)\n- The answering logic is in [`convex/serve.ts`](./convex/serve.ts)\n\n## Running the App\n\n```\nnpm install\nnpm run dev\n```\n\nThis will configure a Convex project if you don't already have one, open the\nConvex dashboard and the web app running on `localhost`.\n\nFor the chat itself to work, you must configure the following environment\nvariable on the Convex dashboard:\n\n- `OPENAI_API_KEY` set to an [OpenAI](https://platform.openai.com/) API key\n  (should start with `sk-`)\n\nYou can change the LLM identifier `OPENAI_MODEL` in\n[`convex/serve.ts`](./convex/serve.ts) to `\"gpt-4-32k\"` if you're paying for\nOpenAI to improve the quality of responses.\n\n# What is Convex?\n\n[Convex](https://convex.dev) is a hosted backend platform with a built-in\ndatabase that lets you write your\n[database schema](https://docs.convex.dev/database/schemas) and\n[server functions](https://docs.convex.dev/functions) in\n[TypeScript](https://docs.convex.dev/typescript). Server-side database\n[queries](https://docs.convex.dev/functions/query-functions) automatically\n[cache](https://docs.convex.dev/functions/query-functions#caching--reactivity)\nand [subscribe](https://docs.convex.dev/client/react#reactivity) to data,\npowering a\n[realtime `useQuery` hook](https://docs.convex.dev/client/react#fetching-data)\nin our [React client](https://docs.convex.dev/client/react). There are also\n[Python](https://docs.convex.dev/client/python),\n[Rust](https://docs.convex.dev/client/rust),\n[ReactNative](https://docs.convex.dev/client/react-native), and\n[Node](https://docs.convex.dev/client/javascript) clients, as well as a\nstraightforward\n[HTTP API](https://github.com/get-convex/convex-js/blob/main/src/browser/http_client.ts#L40).\n\nThe database support\n[NoSQL-style documents](https://docs.convex.dev/database/document-storage) with\n[relationships](https://docs.convex.dev/database/document-ids) and\n[custom indexes](https://docs.convex.dev/database/indexes/) (including on fields\nin nested objects).\n\nThe [`query`](https://docs.convex.dev/functions/query-functions) and\n[`mutation`](https://docs.convex.dev/functions/mutation-functions) server\nfunctions have transactional, low latency access to the database and leverage\nour [`v8` runtime](https://docs.convex.dev/functions/runtimes) with\n[determinism guardrails](https://docs.convex.dev/functions/runtimes#using-randomness-and-time-in-queries-and-mutations)\nto provide the strongest ACID guarantees on the market: immediate consistency,\nserializable isolation, and automatic conflict resolution via\n[optimistic multi-version concurrency control](https://docs.convex.dev/database/advanced/occ)\n(OCC / MVCC).\n\nThe [`action` server functions](https://docs.convex.dev/functions/actions) have\naccess to external APIs and enable other side-effects and non-determinism in\neither our [optimized `v8` runtime](https://docs.convex.dev/functions/runtimes)\nor a more\n[flexible `node` runtime](https://docs.convex.dev/functions/runtimes#nodejs-runtime).\n\nFunctions can run in the background via\n[scheduling](https://docs.convex.dev/scheduling/scheduled-functions) and\n[cron jobs](https://docs.convex.dev/scheduling/cron-jobs).\n\nDevelopment is cloud-first, with\n[hot reloads for server function](https://docs.convex.dev/cli#run-the-convex-dev-server)\nediting via the [CLI](https://docs.convex.dev/cli). There is a\n[dashbord UI](https://docs.convex.dev/dashboard) to\n[browse and edit data](https://docs.convex.dev/dashboard/deployments/data),\n[edit environment variables](https://docs.convex.dev/production/environment-variables),\n[view logs](https://docs.convex.dev/dashboard/deployments/logs),\n[run server functions](https://docs.convex.dev/dashboard/deployments/functions),\nand more.\n\nThere are built-in features for\n[reactive pagination](https://docs.convex.dev/database/pagination),\n[file storage](https://docs.convex.dev/file-storage),\n[reactive search](https://docs.convex.dev/text-search),\n[https endpoints](https://docs.convex.dev/functions/http-actions) (for\nwebhooks),\n[streaming import/export](https://docs.convex.dev/database/import-export/), and\n[runtime data validation](https://docs.convex.dev/database/schemas#validators)\nfor [function arguments](https://docs.convex.dev/functions/args-validation) and\n[database data](https://docs.convex.dev/database/schemas#schema-validation).\n\nEverything scales automatically, and it’s\n[free to start](https://www.convex.dev/plans).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fget-convex%2Fconvex-ai-chat","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fget-convex%2Fconvex-ai-chat","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fget-convex%2Fconvex-ai-chat/lists"}