crews

crews

保持学习和对新事物的热情~ Magic

"AI Sketching" - Bringing an idea to life

Background

Around April, I delved into understanding AI "new things" like GPT and Midjourney, and then decided to get involved and actually use them to experience them. The results of using Midjourney (referred to as MJ hereafter) to create images were really amazing, but there were actually quite a few problems in the process of using it.

  1. MJ requires a VPN, and using it on Discord has certain requirements.

  2. The prompt command needs to be learned. If you directly input Chinese, the recognition rate is not high, and it is easy to generate images with significant deviations.

  3. There is a lack of accumulated professional vocabulary for prompts, as well as a lack of "awareness" and usage methods.

All of these factors resulted in a less than satisfactory overall experience, so I thought about whether I could create an intermediate layer to bridge the gap. I searched on GitHub and found that someone had already created an unofficial interface for MJ: simulating a Discord account to send messages with tokens, and the bot listens to the messages. There are many ways to implement this, including Python, JavaScript, Go, and Java. I was able to find the language I wanted. Seeing that there was already a foundation, I started to try writing my own "tool station".

Start

Prototype

As a programmer, I took action immediately. I used the scaffolding to generate the code for a front-end project using Vite + React to quickly start a new project. As for the back-end, what else could I use other than the familiar and simple Express? I got it up and running first before deciding on the next steps.

I typed away at the code (often writing until late at night, although I strongly advise against doing this, as your health is the most important thing). Before May Day, I completed an initial version that was already functional.

MVP Version

The world is constantly changing, with new things emerging every day. I also fell into deep anxiety, doubting the value and meaning of what I was doing. My girlfriend told me that before doing these things, I had told myself that I didn't expect to gain anything from them. I did them for the sake of interest and hobbies, and to learn new technologies, which is already great. If you feel tired, then you don't have to do it. After hearing this, I suddenly realized that I should indeed return to my original intention. I did this because I found joy in doing it, not because I wanted to gain something from it. So I made a plan for an MVP version, aiming to add an account system, improve UI support for mobile devices, and make the tool more user-friendly by supporting prompts.

I set a deadline to complete a preliminary MVP version by May 14.

During the holiday, I also acquired a lot of knowledge and explored many frameworks. In the end, I decided to use Next.js to build this website.

The technology stack changed to:

  • Next.js + TypeScript
  • Tailwind CSS + DaisyUI
  • Prisma + SQLite
  • Go

The development process became much smoother. With the help of ChatGPT, I quickly converted the previous Express interfaces and utility functions into TypeScript code.

This week, I wrote code every evening after work until late at night, and spent two days over the weekend to refactor this MVP version. I felt that writing code became much faster with more practice.

Writing code in TypeScript is really enjoyable. When defining interfaces, it can help detect many problems directly while writing code. Strong type checking is a must for writing interfaces.

Here are some actual screenshots of the website:

(Images are not translatable)

If you want to experience MJ's drawing capabilities, you can message me privately and I will reply with the website URL. Since this is a personal project and still in the beta version, it is open to a wide audience.

Interlude

After deploying the code last night, I went to bed and everything was fine (because no one was using it).

When I woke up in the morning, a few friends were using it. They ran a few images and it was okay, but suddenly it started to become extremely slow. I quickly got up and checked my server, but I couldn't even connect via SSH. I checked the CPU and it seemed normal. After struggling for a while, I finally managed to access SSH and found that the memory was overloaded. I had bought the cheapest lightweight cloud server with only 1GB of memory, and it was overwhelmed. I immediately upgraded to a higher tier server, and then everything returned to normal.

This made me think about the differences between work development, work deployment, and personal development deployment. In work, we don't have to worry about server issues, and we rarely have to consider the performance of the server code because the company has our backs. But for personal development projects, I realized that every bit of memory and CPU power costs money, so they must be taken into account. In the future, I may consider using Go to develop the server, as it offers a higher cost-performance ratio. However, JavaScript is currently the main language, and it allows for a unified language for both front-end and back-end development, so I am still hesitant.

Conclusion

In the past, I had many ideas, but I always started something without following through. Now, I still have just as many ideas, but the difference is that I want to see them through to the end. This time is also a new attempt for me. I wrote the entire website from front to back, including the UI, solely relying on my coding abilities, and it gives me a great sense of accomplishment. I feel that my coding skills have improved a lot. My English reading ability has also improved because I have been constantly reading documentation and have become too lazy to use translation plugins, so I just read the original text.

"Getting involved" and "persevering to the end" really allow for personal growth and insights. Regardless of the final outcome, the process itself is the greatest reward.

The speed of future iterations and updates for this small website may slow down, but interested students can follow and communicate with me via WeChat.

Thank you all for reading!

(Translation provided by a professional translator)

Loading...
Ownership of this post data is guaranteed by blockchain and smart contracts to the creator alone.