Skip to content

Commit

Permalink
Add new post
Browse files Browse the repository at this point in the history
  • Loading branch information
noobnooc committed Mar 19, 2024
1 parent 773e53d commit a0707d3
Show file tree
Hide file tree
Showing 5 changed files with 144 additions and 7 deletions.
4 changes: 2 additions & 2 deletions app/[lang]/posts/[...slug]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ export default async function PostPage({

return (
<main className="mx-auto flex items-start w-full max-w-screen-lg gap-4 px-4 py-8 relative scroll-smooth">
<article className="rounded-3xl p-4 sm:p-8 border bg-white/50 dark:bg-indigo-100/5 flex flex-col md:basis-3/4 grow-0 min-w-0">
<article className="rounded-3xl p-4 pb-8 sm:p-8 border bg-white/50 dark:bg-indigo-100/5 flex flex-col md:basis-3/4 grow-0 min-w-0">
<h1 className="text-3xl font-serif">{post.title}</h1>
<div className="opacity-50 flex items-center gap-4 mt-2">
<div className="flex items-center gap-1">
Expand All @@ -97,7 +97,7 @@ export default async function PostPage({
) : undefined}
</div>
<p className="opacity-70 mt-2">{post.description}</p>
<hr className="mt-4" />
<hr className="my-4" />
{/* <div className="leading-loose flex flex-col gap-4">
<MDXContent code={post.content} />
</div> */}
Expand Down
10 changes: 6 additions & 4 deletions app/[lang]/posts/categories/[categorySlug]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,12 @@ export async function generateMetadata({
}

function getPublishedPosts(lang: string, category: string) {
return posts.filter(
(post) =>
!post.draft && post.lang === lang && post.categories.includes(category),
);
return posts
.sort((p1, p2) => new Date(p2.date).getTime() - new Date(p1.date).getTime())
.filter(
(post) =>
!post.draft && post.lang === lang && post.categories.includes(category),
);
}

export default async function CategoryPostsPage({
Expand Down
4 changes: 3 additions & 1 deletion app/[lang]/posts/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,9 @@ export async function generateMetadata({
}

function getPublishedPosts(lang: string) {
return posts.filter((post) => !post.draft && post.lang === lang);
return posts
.sort((p1, p2) => new Date(p2.date).getTime() - new Date(p1.date).getTime())
.filter((post) => !post.draft && post.lang === lang);
}

export default async function PostsPage({
Expand Down
66 changes: 66 additions & 0 deletions content/posts/2024-03-19 i-open-sourced-assischat/en.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
---
title: I Open Sourced an AI Chat App - AssisChat
slug: i-open-sourced-an-ai-chat-app-assischat
lang: en
date: 2024-03-19 00:00:00
categories:
- development
- product
description: A year ago, I created an iOS wrapper AI chat application called AssisChat, and now I have decided to open source it.

keywords:
- Open Source
- Apple
- iOS
- SwiftUI
- Swift
- OpenAI API
- Claude API
---

# Introduction to AssisChat

About a year ago, when AI chat was gaining popularity and ChatGPT had a highly acclaimed model, there was no user-friendly web interface and no official mobile app. However, the demand for a mobile app was strong, and I myself wanted a mobile application to easily interact with ChatGPT anytime, anywhere.

So, I took matters into my own hands and created an iOS wrapper app. After obtaining my own API Key from the OpenAI website, I input it into the app and started using it happily. This is the app I want to introduce today, [AssisChat](https://apps.apple.com/us/app/assischat-ai-assistant-chat/id6446092669), and its source code can be found on [GitHub](https://github.com/noobnooc/AssisChat).

The name AssisChat comes from the combination of Assistant and Chat. Initially, I envisioned that users could set up an assistant role by using options such as system messages and message prefixes, and this role would always stay on the same topic.

At that time, I didn't have much knowledge about iOS development. Prior to this, I had only dabbled in Swift and SwiftUI. However, I gradually developed the app step by step, learning as I went, and eventually implemented the desired features.

The main features of the final app include:

- Support for iOS/iPadOS/macOS
- Use of my own OpenAI/Claude API Key
- Customizable conversation behavior, such as system messages, message prefixes, and temperature
- Integration with the share extension, allowing the use of AssisChat without leaving the current app
- Integration with the keyboard extension, enabling quick use of AI and filling content into input fields of other apps

Compared to other traditional translation software, ChatGPT's translation was surprisingly good, albeit a bit slow. However, for many scenarios, speed was not a critical factor. Switching apps for translation every time became a bit cumbersome, so I thought of the sharing feature in the iOS system, which allows text to be shared with other apps without switching. Therefore, I integrated the share extension, which worked really well for translation.

The idea for the keyboard extension came from an interesting app called [Smarty](https://apps.apple.com/us/app/smarty-ai-chatbot-keyboard/id6446252415). It brought AI functionality to the iOS keyboard, making it convenient to fill in AI-generated content into input fields of any other app without leaving the current app. Later, I saw that [OpenCat](https://apps.apple.com/us/app/opencat/id6445999201) also implemented this feature, so I added it as well.

After some friends started using the app, they provided feedback and suggestions. As a result, I gradually added support for Claude API, context size limits, iCloud synchronization, QR code configuration import, and macOS support.

# Why Open Source?

Shortly after releasing the app to the store, I added an in-app purchase to see if it could cover the $600 annual Apple developer account fee. Although purchasing or not purchasing the in-app feature had no impact on the app's functionality, many users still bought it to show their support. I didn't keep detailed statistics, but I believe that over the course of the year, it roughly covered the developer fee.

The fact that many users purchased the in-app feature, even though it was not mandatory, showed me that there are still many people in the world who are willing to support content creation. So, for a short period of time, I actively worked on updating the app.

However, due to various reasons, I gradually put the development of this app on hold, and my enthusiasm for it diminished. These reasons include, but are not limited to:

- Apple's restrictions on publishing apps that use API modes
- The release of an official mobile app by OpenAI
- Restrictions on charging for services, such as the possibility of OpenAI banning Chinese users' accounts at any time
- The existence of well-known similar apps like OpenCat

Although it's embarrassing to admit, I am someone who tends to give up when faced with a little difficulty. So, this app hasn't been updated for nine months now. Along the way, I received some emails with issue feedback, but I barely replied.

Although I always find various reasons and excuses for not updating it, I still feel a bit guilty towards those who purchased the in-app feature. I apologize to those who genuinely liked the app and helped provide feedback.

Since I don't have much motivation to continue updating it myself, I have decided to open source this app, allowing those who need it to compile and use it themselves, or modify it to their liking. It can even serve as a reference for learning Swift and SwiftUI, although the code may not be written very well, something is better than nothing.

Interested friends can modify the code according to their needs and build and run it themselves. Pull requests are also welcome to help me improve this app.

Finally, the code repository can be found on [GitHub](https://github.com/noobnooc/AssisChat). Feel free to give it a star.
67 changes: 67 additions & 0 deletions content/posts/2024-03-19 i-open-sourced-assischat/zh.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
---
title: 我开源了一个 AI 聊天 app — AssisChat
slug: i-open-sourced-an-ai-chat-app-assischat
lang: zh
date: 2024-03-19 00:00:00
categories:
- development
- product
description: 在一年前我做了一个 iOS 端的套壳 AI 聊天应用 —— AssisChat,现在决定将其开源。

keywords:
- 开源
- 苹果
- Open Source
- iOS
- SwiftUI
- Swift
- OpenAI API
- Claude API
---

# AssisChat 介绍

在大约一年前,那个时候 AI 聊天正兴起,ChatGPT 也光有一个为人称道的模型,但其网页版的用户界面并不是十分好用,也没有一个官方版本的手机端 app 。但这个需求又是十分强烈的,包括我自己也十分想要一个手机端的应用,以便随时随地掏出手机问问 ChatGPT 。

于是那是我自己动手做了一个套壳的 iOS 应用,在 OpenAI 官网申请到自己的 API Key 后,输入到 app 内就可以开始愉快地使用了。这个就是今天要介绍的应用 [AssisChat](https://apps.apple.com/us/app/assischat-ai-assistant-chat/id6446092669) ,其源代码可以在 [GitHub](https://github.com/noobnooc/AssisChat) 上找到。

AssisChat 的名字来源于 Assistant 和 Chat 的组合,一开始我设想的使用方式,就是用户可以通过系统消息、每条消息都会带上的前缀等这些选项,来设置一个助手角色,然后这个角色就会始终保持在相同的话题上。

当时我对 iOS 的开发并不是十分了解,在这之前仅仅稍微看过一点点 Swift 和 SwiftUI 。但还是一步步一边摸索一边开发,慢慢地实现了自己想要的功能。

最终完成的 App 的主要功能有:

- 支持 iOS/iPadOS/macOS
- 使用自己的 OpenAI/Claude API Key
- 自定义对话行为,比如系统消息、消息前缀、温度等
- 使用分享扩展,实现不跳出正在使用的 app 来使用 AssisChat
- 使用键盘扩展,实现快速使用 AI 并将内容填充到其它应用的输入框中

因为当时 ChatGPT 的翻译比起其它传统翻译软件来说,效果是出奇地好,只是慢了点。但是对于许多场景来说,也并不需要那么快的速度。但是每次翻译都要切换 App 却显得有点繁琐,于是我想起 iOS 系统有一个分享功能,可以实现不切换 App 就能分享文本到其它应用,于是我便接入的分享扩展,用在翻译这种场景确实是非常不错的。

键盘扩展的想法,是看到一款叫 [Smarty](https://apps.apple.com/us/app/smarty-ai-chatbot-keyboard/id6446252415) 的应用非常有趣,它把 AI 的功能做到了 iOS 的键盘上,可以方便很方便地把 AI 生成的内容填充到任何其它应用的输入框里,而不用跳出正在使用的应用。再后面看到 [OpenCat](https://apps.apple.com/us/app/opencat/id6445999201) 也实现了这个功能,于是我也就加上了。

再后来有了一些朋友在使用了,也有一些朋友提了一些建议。于是慢慢地又加入了 Claude API 的支持、上下文数量限制、iCloud 同步、二维码导入配置等支持、macOS 支持。

# 为什么开源

在上架到商店后不久,我便在 App 里加了个内购,看看能不能摊平每年 600 块的苹果开发者账号费用。虽然这个内购是否购买,完全不会影响使用,购买后的功能没有任何变化,但还是有不少小伙伴因为支持而购买。我没有仔细统计过数据,但印象中这一年下来,应该是刚好摊平了开发者费用。

这种没有强制购买的内购,还是有这么多小伙伴购买,让我看到了这个世界上还是有很多愿意支持内容创作的人的。所以在前面一段短期的时间里,我还是比较积极地在更新这个应用。

但后面因为一些原因,还是慢慢地搁置了这个应用的开发,我对这个应用的热情也慢慢地消退了。这些原因包括但不限于:

- 苹果限制上架使用 API 模式的 App
- OpenAI 官方出了移动端的 App
- 如果想通过提供服务来收费,也有一些限制,比如 OpenAI 随时可能会封禁中国用户的账号
- 已经有比较有名的像是 OpenCat 这些同类 App

虽然不好意思说,但我确实是一个有点知难而退的人,遇到一点点困难就会想着放弃。所以这个 App 到现在已经有九个月没更新了。中途也会有一些发邮件向我反馈问题,我也基本没有回复。

虽然我终会找各种原因为自己不更新找借口,但是还是会觉得对那些购买了内购的小伙伴有点愧疚。对那些真的喜欢这个 App 而且在帮忙反馈问题的小伙伴感到抱歉。

既然我自己没有太多动力继续更新,所以我决定将这个 App 开源,让有需要的人可以自己编译使用,或者是自己修改成自己想要的样子。甚至也可以作为学习 Swift 和 SwiftUI 的一个参考,虽然代码写得并不是很好,但聊胜于无。

有兴趣的朋友们可以自己按照需求修改代码,自己构建运行。也欢迎提 PR 来帮助我完善这个 App。

最后,代码仓库可以查看 [GitHub](https://github.com/noobnooc/AssisChat) ,欢迎 Star 。

0 comments on commit a0707d3

Please sign in to comment.