foolgry

foolgry

2024 Week 3 Report: AI Product Development, Multilingual Plugins, and Technical Exploration

Decided to write an article every week to record the noteworthy events of my week. This is the record of the third week of 2024, and also the first article in this series.

1. Company AI Product Development#

In the past few weeks, I have mostly been working on the backend development of an AI product. Currently, only the initial version has been completed, but it's quite satisfying to be able to develop an AI-related product. Previously, I mainly focused on learning and using AI, and this is my first time getting hands-on experience with development. The current functionality mainly includes chat and knowledge base question-answering.

Based on langchain-chatchat, I made modifications such as integrating the company's large model API, integrating AI into the product itself, frontend-backend interaction, and modifying prompts. The knowledge base question-answering functionality is only the basic version, and in the future, I plan to optimize it based on RAG papers in the market. This includes generating questions in advance based on segmented content and mapping them to the original content. The questions will also be stored in a vector database, and when a user asks a question, it will be matched with the pre-generated question vectors and the vectors of the original content. Additionally, I plan to introduce Elasticsearch for combining search results based on ES and vector search to generate context for asking the large model. There may also be reranking and other features added depending on the situation.

I only started formally using Python in the 23rd year, but with chatgpt, both reading and writing code became much faster. Recently, I have managed to understand most of the code in langchain-chatchat, which is a further step forward.

2. Intellij Idea Multilingual Translation Plugin#

Implemented a multilingual translation feature using the live plugin. The specific functionality is triggered by a shortcut key, which automatically adds a Chinese string to multiple multilingual files and replaces the current string with a call to the project's multilingual utility method.

The main logic of the code is to use the live plugin to listen for the shortcut key. Once triggered, it retrieves the content of the file where the cursor is located, finds the string at the cursor, translates it into English, finds the corresponding domain based on the current file package, generates a multilingual key based on the project format, appends the key=value structure to the multilingual file, and finally replaces the current string with a call to the system's multilingual utility method, passing the key as a parameter.

Although there is currently an issue with handling duplicate texts, I really enjoy using this tool as it greatly simplifies the tedious work of manually handling multilingual parts. Previously, I found this process to be particularly troublesome and always resisted doing it. Now with this tool, handling the multilingual part is very simple.

chatgpt is quite useful. First, it can answer questions about Idea's documentation and suggest which interface to use in certain scenarios. If it can't answer, looking at Idea's code or API makes it clear. Second, it helps with code conversion. The demo provided by Alibaba Cloud Translation is in Java, but the live plugin requires Groovy or Kotlin. Since I have less experience with Kotlin, I chose to use Groovy. I used chatgpt to convert the demo's Java code to Groovy code and made some minor modifications, making it usable. When translating, remember to have chatgpt refactor the code to ensure its clarity and conciseness.

Tip: If you want to write a system plugin, refer to the official documentation, templates, and examples to quickly get started.

Two insights:
a. Implement basic functionality first, and then gradually add new features and optimizations. Pursuing perfection all at once can lead to frustration.
b. When writing code, adopt a strategy of taking small steps and testing promptly to avoid fixing bugs after completing all the work at once.

3. Alibaba Cloud Translation#

The translation used in the above plugin is Alibaba Cloud Translation. If anyone needs it, you can register for it. There is a free translation quota of 2 million characters per month for the Machine Translation General Edition Engine and the Machine Translation Professional Edition Engine.

The HTTP API is not easy to use, mainly because the signing process is a bit complicated. If you use the SDK, it's relatively easier. I didn't use the SDK because it's a bit cumbersome to use third-party Groovy packages in the live plugin. I tried and failed, so I used HTTP instead.

4. Renewing the Blog Domain Certificate#

Tencent Cloud offers 30 free domain renewals, and the operation is relatively simple.

5. Switching the Blog to xlog#

I decided to migrate my blog to xlog, saying goodbye to the themes and issues of hashnode.com. Although the content has not been migrated yet, the experience of the new platform is satisfactory. This article is my first article on xlog, and the 0th article is a simple "hello world".

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