{"id":13525873,"url":"https://github.com/patnorris/DecentralizedAIonIC","last_synced_at":"2025-04-01T06:30:40.057Z","repository":{"id":182906616,"uuid":"666577592","full_name":"patnorris/DecentralizedAIonIC","owner":"patnorris","description":"DeVinci is the browser-based AI chatbot app served from the Internet Computer. You can chat with the AI model loaded into your browser so your chats remain fully on your device. If you choose to log in, you can also store your chats on the Internet Computer and reload them later.","archived":false,"fork":false,"pushed_at":"2024-04-03T13:58:35.000Z","size":20795,"stargazers_count":8,"open_issues_count":0,"forks_count":3,"subscribers_count":1,"default_branch":"master","last_synced_at":"2024-04-03T14:57:27.755Z","etag":null,"topics":["ai","decentralized","internetcomputer","llm","web3"],"latest_commit_sha":null,"homepage":"https://x6occ-biaaa-aaaai-acqzq-cai.icp0.io/","language":"Motoko","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/patnorris.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}},"created_at":"2023-07-14T22:22:28.000Z","updated_at":"2024-04-15T11:38:33.221Z","dependencies_parsed_at":"2023-07-22T03:47:36.317Z","dependency_job_id":"9b0abbb9-12ad-47e4-a258-e04e4742fd3d","html_url":"https://github.com/patnorris/DecentralizedAIonIC","commit_stats":null,"previous_names":["patnorris/decentralizedaionic"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/patnorris%2FDecentralizedAIonIC","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/patnorris%2FDecentralizedAIonIC/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/patnorris%2FDecentralizedAIonIC/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/patnorris%2FDecentralizedAIonIC/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/patnorris","download_url":"https://codeload.github.com/patnorris/DecentralizedAIonIC/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246596550,"owners_count":20802844,"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":["ai","decentralized","internetcomputer","llm","web3"],"created_at":"2024-08-01T06:01:23.032Z","updated_at":"2025-04-01T06:30:40.051Z","avatar_url":"https://github.com/patnorris.png","language":"Motoko","funding_links":[],"categories":["Decentralized AI"],"sub_categories":["TON"],"readme":"# DeVinci\n\n## Try DeVinci\nDeVinci is live on the Internet Computer. If you like, you can give it a try [here](https://x6occ-biaaa-aaaai-acqzq-cai.icp0.io/).\n\n**Notes**:\n- Currently, only Chrome and Edge on desktop support the required features (WebGPU). Other devices, including smartphones, and other browsers, cannot run it (for now). \n- AI models are pretty huge and require quite some computational resources. As DeVinci runs on the user's device (via the browser), whether and how fast it may run depend on the device's hardware. If a given model doesn't work, the user can thus try a smaller one and see if the device can support it.\n- For the best possible experience, we recommend running as few other programs and browser tabs as possible besides DeVinci as those can limit the computational resources available for DeVinci.\n\nDo you have any feedback? We'd love to hear it! You can open an issue on GitHub or share your thoughts on this [forum post](https://forum.dfinity.org/t/browser-based-ai-chatbot-served-from-the-ic/22263). Thank you!\n\n## About DeVinci\n\nDeVinci is the personalized AI assistant that redefines the paradigm of digital privacy and trust. It's decentralized, trusted, open-source, and truly user-focused. Powered by an open-source AI model that runs directly within the browser, the interactions with DeVinci happen on the user's device, giving users unprecedented control.\n\n### Key Features\n- **Decentralized**: Operates directly within the browser. Users can choose if they want to log in and store their chats on the decentralized cloud and under their control.\n- **Trusted**: No corporation behind, just an AI serving the user.\n- **Open-source**: Built on open-source software (notably Web LLM and Internet Computer).\n- **Personalized**: Users engage in meaningful conversations and ask questions, all while ensuring their privacy.\n\n### How DeVinci Works\nDeVinci comprises a frontend canister which integrates the AI model and a backend canister for optional chat history storage. Here's a glimpse of how DeVinci is structured:\n\n#### Frontend Canister\nThe frontend canister serves the user interface, including HTML, CSS, and JavaScript files. It leverages the Web LLM npm library to wrap the AI model into the DeVinci chat app.\n\n#### Web LLM\nThe open-source project Web LLM allows us to load and interact with open-source AI models. The selected model is loaded and cached into the browser and runs directly there, thus on the user's device. That way all interactions and data may stay local to the device. This significantly improves privacy and control over user data.\n\n#### Backend Canister\nThe backend canister enables users to persist their chats and to store any other user data (e.g. settings) if they choose to (DeVinci can be used without logging in and even when logged in users have the choice whether they want their chats to be stored). All of this is achieved in a decentralized manner through the Internet Computer, ensuring high availability and scalability.\n\n## Internet Computer Resources\n\nDeVinci is built and hosted on the Internet Computer. To learn more about it, see the following documentation available online:\n\n- [Quick Start](https://sdk.dfinity.org/docs/quickstart/quickstart-intro.html)\n- [SDK Developer Tools](https://sdk.dfinity.org/docs/developers-guide/sdk-guide.html)\n- [Motoko Programming Language Guide](https://sdk.dfinity.org/docs/language-guide/motoko.html)\n- [Motoko Language Quick Reference](https://sdk.dfinity.org/docs/language-guide/language-manual.html)\n- [JavaScript API Reference](https://erxue-5aaaa-aaaab-qaagq-cai.raw.ic0.app)\n\n## Running the project locally\n\nIf you want to run this project locally, you can use the following commands:\n\n### 1. Install dependencies\n```bash\nnpm install\n```\n### 2. Install Vessel which is a dependency\nhttps://github.com/dfinity/vessel\n\n### 3. Start a local replica\n```bash\nnpm run dev\n```\nNote: this starts a local replica of the Internet Computer (IC) which includes the canisters state stored from previous sessions.\nIf you want to start a clean local IC replica (i.e. all canister state is erased) run instead:\n```bash\nnpm run erase-replica\n```\n\n### 4. Deploy your canisters to the replica\nLocal:\n```bash\ndfx deploy --argument \"( principal\\\"$(dfx identity get-principal)\\\" )\" DeVinci_backend --network local\ndfx canister call DeVinci_backend --network local setCanisterCreationCanisterId '(\"bkyz2-fmaaa-aaaaa-qaaaq-cai\")'\n\ndfx deploy internet_identity --network local\ndfx deploy DeVinci_frontend --network local\n```\nAlternative: Run a local vite UI (note that this had issues communicating to the backend canister for some setups in the past)\n```bash\nnpm run vite\n```\n--\u003e runs on port 3000\nAccess routes like \"http://172.30.141.44:3000/#/mychats\" (same as on Mainnet)\nHot reloads with every UI change\n\n## Deployment to the Internet Computer mainnet\nDeploy the code as canisters to the live IC where it's accessible via regular Web browsers.\n\n### Development Stage\n```bash\ndfx deploy --network development --argument \"( principal\\\"$(dfx identity get-principal)\\\" )\" DeVinci_backend\ndfx canister call DeVinci_backend --network development setCanisterCreationCanisterId '(\"wyx7t-zqaaa-aaaam-qb5ga-cai\")'\n\ndfx deploy --network development DeVinci_frontend\ndfx deploy --network development arcmindvectordb\n```\n\n### Testing Stage\n```bash\ndfx deploy --network testing --argument \"( principal\\\"$(dfx identity get-principal)\\\" )\" DeVinci_backend\ndfx deploy --network testing DeVinci_frontend\n```\nFor setting up stages, see [Notes on Stages](./notes/NotesOnStages.md)\n\n### Production Deployment\n```bash\nnpm install\n\ndfx start --background\n```\nDeploy to Mainnet (live IC):\nEnsure that all changes needed for Mainnet deployment have been made (e.g. define HOST in store.ts)\n```bash\ndfx deploy --network ic --argument \"( principal\\\"$(dfx identity get-principal)\\\" )\" DeVinci_backend\ndfx deploy --network ic DeVinci_frontend\n```\nIn case there are authentication issues, you could try this command\n(Note that only authorized identities which are set up as canister controllers may deploy the production canisters)\n```bash\ndfx deploy --network ic --wallet \"$(dfx identity --network ic get-wallet)\"\n```\n\n### Backup stage\ncreated due to high demand on subnets and failing deployments\n```bash\ndfx identity get-wallet --ic\ndfx identity --network backup set-wallet 3v5vy-2aaaa-aaaai-aapla-cai\ndfx deploy --network backup --argument \"( principal\\\"$(dfx identity get-principal)\\\" )\" DeVinci_backend --subnet qdvhd-os4o2-zzrdw-xrcv4-gljou-eztdp-bj326-e6jgr-tkhuc-ql6v2-yqe --with-cycles 1000000000000\ndfx deploy --network backup DeVinci_frontend --subnet qdvhd-os4o2-zzrdw-xrcv4-gljou-eztdp-bj326-e6jgr-tkhuc-ql6v2-yqe --with-cycles 1000000000000\n```\n\n# Credits\nRunning DeVinci in your browser is enabled by the great open-source project [Web LLM](https://webllm.mlc.ai/)\n\nServing this app and hosting the data securely and in a decentralized way is made possible by the [Internet Computer](https://internetcomputer.org/)\n\n# Other\n## Get and delete Email Subscribers\nThe project has email subscription functionality included. The following commands are helpful for managing subscriptions.\n```bash\ndfx canister call DeVinci_backend get_email_subscribers\ndfx canister call DeVinci_backend delete_email_subscriber 'j@g.com'\n\ndfx canister call DeVinci_backend get_email_subscribers --network development\ndfx canister call DeVinci_backend delete_email_subscriber 'j@g.com' --network development\n\ndfx canister call DeVinci_backend get_email_subscribers --network ic\ndfx canister call DeVinci_backend delete_email_subscriber 'j@g.com' --network ic\n```\n\n## Cycles for Production Canisters\nDue to the IC's reverse gas model, developers charge their canisters with cycles to pay for any used computational resources. The following can help with managing these cycles.\n\nFund wallet with cycles (from ICP): https://medium.com/dfinity/internet-computer-basics-part-3-funding-a-cycles-wallet-a724efebd111\n\nTop up cycles:\n```bash\ndfx identity --network=ic get-wallet\ndfx wallet --network ic balance\ndfx canister --network ic status DeVinci_backend\ndfx canister --network ic status DeVinci_frontend\ndfx canister --network ic --wallet 3v5vy-2aaaa-aaaai-aapla-cai deposit-cycles 3000000000000 DeVinci_backend\ndfx canister --network ic --wallet 3v5vy-2aaaa-aaaai-aapla-cai deposit-cycles 300000000000 DeVinci_frontend\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpatnorris%2FDecentralizedAIonIC","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpatnorris%2FDecentralizedAIonIC","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpatnorris%2FDecentralizedAIonIC/lists"}