Notetaking with AI.
Published: 2023-10-26 08:44:31

In a rapidly evolving world where technology continually shapes our lives, the way we capture and manage information is an amazing transformation. As a response to this, I participated in the Hanko Auth hackathon, and the result of this efforts is an innovative notetaking application. This application aims to revolutionize your notetaking experience by leveraging AI and introducing features, including AI-driven auto-completion. In this blog post, we'll highlight how it combines cutting-edge AI technologies, such as OpenAI's DALL·E and ChatGPT, with the power of Hanko Auth to provide an unparalleled notetaking experience.
Link to preview of the [NoteAI App](https://hank-auth-noteai.vercel.app/) 

*Powered by AI and Hanko Auth:*
The application utilize the most recent trend in software development from using AI, Neon DB, Drizzle ORM and Hanko Auth. We employ advanced AI technologies, specifically OpenAI's DALL·E and ChatGPT, to create a notetaking experience. Imagine an application that can anticipate your thoughts, assist you in generating content, and even embellish your notes with AI-generated cover images—all secured through the robust authentication provided by Hanko Auth.

![Hanko Auth login and signup page](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/g5bez30zxywbsb80mivb.png)

**Features**

*1. AI-Generated Images with DALL·E:*
The NotesAI application gives your note covers AI-generated images, making it easy to identify your story. The process is incredibly simple: just provide a title when creating a new note. Here's where DALL·E AI comes into play. Using your notebook's title, a context is generated as a visually appealing cover image. It's a straightforward process that delivers astonishing results. You don't need any artistic skills; let the AI handle it.

*2. Auto-Completion for Text:*
The Notes AI app redefines the way you write. It's not just a notetaking app; it's your intelligent writing assistant. As you type within your notebook, it is constantly at your service. Activating auto-completion is as simple as pressing Shift+A. This user-friendly functionality is powered by TipTap, ensuring a seamless writing experience.

The logic behind this feature is elegant: the app considers your previous words as prompts, guaranteeing a consistent tone throughout your text. The OpenAI gpt-model, takes over, maintaining a friendly, helpful, and inspiring tone while offering thoughtful responses. Writing has never been easier.


*In Action:*
Here's a glimpse of how NotesAI operates:

1. Start by authenticating yourself through hanko provided signup page
2. Click on create a new notebook and provide a title.
3. The application taps into DALL·E to generate an image that complements your notebook's name.
4. While you're typing, simply press Shift+A on your keyboard to activate auto-completion.
5. The application calls the completion endpoint, using the last 30 words as prompts to help you continue your text effortlessly.


Here's how we generate images using DALL·E:

```javascript
// Code snippet for image generation
const response = await openai.createChatCompletion({
    model: 'gpt-3.5-turbo',
    messages: [
        {
            role: 'system',
            content: 'You are a creative and helpful AI assistant capable of generating interesting thumbnails for my notes. Your output will be fetched into my DALL·E API to generate the thumbnail. I want your description to be minimalistic and flat styled.'
        },
        {
            role: 'user',
            content: `Please generate a thumbnail description for my notebook titled ${prompt}.`
        }
    ]
});
```

And here's the code snippet for text auto-completion:

```javascript
// Code snippet for text auto-completion
{
    role: 'system',
    content: `You are an AI embedded in a Notion text editor app, dedicated to providing concise sentence completions. 
    Your characteristics include expert knowledge, helpfulness, cleverness, intelligence, and articulateness. 
    You always maintain a friendly, kind, and inspiring demeanor while offering vivid and thoughtful responses.`
},
{
    role: "user",
    content: `I'm crafting content in Notion and need your assistance to finish this thought: ${prompt}. 
    Please maintain a consistent tone with the existing text and keep the response brief and on point.`
}
```

**Introducing Hanko Auth:**
We have enhanced our app's security by implementing Hanko Auth. The decision to integrate Hanko Auth was influenced by the ongoing [hanko hackathon](url), where I had the opportunity to witness its effectiveness and the flexibility it provides for user authentication. It seamlessly connects with popular OAuth providers, including GitHub, Google, Apple, and more. Hanko Auth ensures that your application's authentication is both robust and user-friendly. Check here for more information [Hanko Auth](https://docs.hanko.io/setup-hanko-cloud)

**Conclusion:**

That's a brief walkthrough unveiling a revolutionary notetaking application that merges advanced AI technologies with traditional notetaking methods to create a productive and seamless experience. To have a preview of the code flow you can find it on my [github](https://github.com/TangoIndiaMango/hank-auth-noteai)

The application serves as your creative partner, your productivity booster, and your intelligent companion. Whether you're a student aiming to take your notes to the next level, a professional in need of a versatile writing assistant, or simply someone who values efficiency and innovation, NoteAI is your ideal notetaking app. 
Also, Elliot Chong and his team has paved the way for us to redefine how we use open AI models. I'm honored to build upon their inspiration and contribute to a brighter future of AI models.


![Dashboard](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/soyjs8qet1lt3lqu4n5v.png)