{"id":15175591,"url":"https://github.com/haardikk21/wanda","last_synced_at":"2025-07-25T04:40:06.424Z","repository":{"id":158957223,"uuid":"626607891","full_name":"haardikk21/wanda","owner":"haardikk21","description":"React Hooks for Keyless AI","archived":false,"fork":false,"pushed_at":"2023-04-13T03:19:56.000Z","size":43,"stargazers_count":25,"open_issues_count":1,"forks_count":1,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-01-16T19:53:51.386Z","etag":null,"topics":["cohere","gpt3","gpt4","hooks","keyless","openai","react","window-ai"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/haardikk21.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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-04-11T20:08:59.000Z","updated_at":"2023-11-12T16:54:11.000Z","dependencies_parsed_at":"2023-06-15T02:15:29.403Z","dependency_job_id":null,"html_url":"https://github.com/haardikk21/wanda","commit_stats":{"total_commits":9,"total_committers":1,"mean_commits":9.0,"dds":0.0,"last_synced_commit":"788b8e1db1e42c1505d537381f36513c6f3c6aaa"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/haardikk21%2Fwanda","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/haardikk21%2Fwanda/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/haardikk21%2Fwanda/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/haardikk21%2Fwanda/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/haardikk21","download_url":"https://codeload.github.com/haardikk21/wanda/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":235519904,"owners_count":19003201,"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":["cohere","gpt3","gpt4","hooks","keyless","openai","react","window-ai"],"created_at":"2024-09-27T12:39:37.206Z","updated_at":"2025-01-24T23:45:06.362Z","avatar_url":"https://github.com/haardikk21.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Wanda - React Hooks for keyless AI\n\n**wanda** is a collection of React Hooks to get you up and running with keyless AI in a matter of minutes.\n\n```\nnpm install @wanda-dev/react\n```\n\n## Features\n\n- Hooks for working with injected `window.ai`\n- TypeScript ready\n\n## Documentation\n\n### Connectors\n\nWanda makes the use of connectors to identify keyless AI wallets. For now, there is only one connector - `injected` - which supports [Window.AI](https://windowai.io).\n\nWhen setting up the context provider for Wanda in your React App, you need to supply a list of connectors you'd like to support. By default, it comes with the Injected Connector supported.\n\n### Hooks\n\n#### `useConnect`\n\nThe `useConnect` hook offers a way to connect to keyless AI through a given connector.\n\n```tsx\nexport function MyComponent() {\n  const [{ connectors, error }, connect] = useConnect()\n\n  return (\n    \u003cdiv\u003e\n      {connectors.map((connector) =\u003e (\n        \u003cbutton key={connector.name} onClick={() =\u003e connect(connector)}\u003e\n          Connect to window.ai through {connector.name}\n        \u003c/button\u003e\n      ))}\n\n      {error \u0026\u0026 \u003cspan\u003eFailed to connect: {error.message}\u003c/span\u003e}\n    \u003c/div\u003e\n  )\n}\n```\n\n#### `useModel`\n\nThe `useModel` hook provides the `ModelID` that is currently set as default through the connector.\n\nThis is useful for displaying what model is being used currently on the frontend. It's also useful for detecting if `window.ai` is currently injected or not, as `model` will be undefined if not.\n\n```tsx\nexport function MyComponent() {\n    const model = useModel();\n\n    if (model) {\n        return (\n            \u003cspan\u003eYou are currently connected to {model}\u003c/span\u003e\n        )\n    }\n\n    return (\n        // Show prompt to install window.ai\n    )\n}\n```\n\n#### `useCompletion`\n\nThis is the main hook you will be using. It provides a function to request the connector to provide a completion to a given prompt. You can also pass it an `options` object to customize the request. Currently supports all options supported by `window.ai`\n\n```tsx\nexport function MyComponent() {\n  const { getCompletion } = useCompletion()\n  const [prompt, setPrompt] = useState('')\n  const [output, setOutput] = useState('')\n\n  async function handleSubmit(e: FormEvent\u003cHTMLFormElement\u003e) {\n    e.preventDefault()\n\n    const completion = await getCompletion({ prompt })\n    setOutput(completion.text)\n  }\n\n  return (\n    \u003c\u003e\n      \u003cform onSubmit={handleSubmit}\u003e\n        \u003cinput\n          type=\"text\"\n          placeholder=\"Enter prompt...\"\n          value={prompt}\n          onChange={(e) =\u003e setPrompt(e.target.value)}\n        /\u003e\n        \u003cbutton type=\"submit\"\u003eGet Completion\u003c/button\u003e\n      \u003c/form\u003e\n\n      {output \u0026\u0026 (\n        \u003c\u003e\n          \u003cspan style={{ fontWeight: 'bold' }}\u003eOutput: \u003c/span\u003e {output}\n        \u003c/\u003e\n      )}\n    \u003c/\u003e\n  )\n}\n```\n\n### Examples\n\nLook in the `example` directory to see an example application using React.\n\n## License\n\nThis project is licensed under the MIT License.\n\n## Authors\n\n- Haardik ([@haardikkk](https://twitter.com/haardikkk), [@haardikk21](https://github.com/haardikk21))\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhaardikk21%2Fwanda","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhaardikk21%2Fwanda","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhaardikk21%2Fwanda/lists"}