Skip to content

Commit 9a63278

Browse files
github-actions[bot]lzwjava
authored andcommitted
chore(lang): Update language files
chore(lang): Update language files chore(lang): Update language files chore(lang): Update language files chore(lang): Update language files chore(lang): Update language files chore(lang): Update language files chore(lang): Update language files chore(lang): Update language files chore(lang): Update language files chore(lang): Update language files chore(lang): Update language files chore(lang): Update language files chore(lang): Update language files chore(lang): Update language files chore(lang): Update language files chore(lang): Update language files chore(lang): Update language files chore(lang): Update language files chore(lang): Update language files chore(lang): Update language files chore(lang): Update language files chore(lang): Update language files chore(lang): Update language files chore(lang): Update language files chore(lang): Update language files ci(gh-pages): update workflow configuration
1 parent 0076841 commit 9a63278

27 files changed

+487
-162
lines changed

.github/workflows/gh-pages.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,8 @@ jobs:
6666
fi
6767
env:
6868
DEEPSEEK_API_KEY: ${{ secrets.DEEPSEEK_API_KEY }}
69-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
69+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
70+
MISTRAL_API_KEY: ${{ secrets.MISTRAL_API_KEY }}
7071

7172
- name: Dry Run Pdf Files
7273
id: dry_run_pdf

_posts/en/2024-12-04-fruit-en.md

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,19 @@ title: Eat Fruits Instead Of Snacks
55
translated: false
66
---
77

8+
9+
10+
## Fruits
11+
812
I remember between 2016 and 2018, my weight quickly increased from 70kg to 90kg. At that time, I ordered fast food from delivery apps almost every day. And sometimes, while working late into the night, I ate a lot of snacks in the office.
913

1014
After returning to Guangzhou from Beijing in early 2020, I ate foods that were made by my parents. But sometimes, I still ate snacks. And I didn't maintain the practice of playing basketball. I played basketball a lot from late 2020 to early 2021. But later, I changed that habit to walking while listening to English podcasts. And starting from September 2023, I started to play basketball again.
1115

12-
I should start eating more fruits. If I am hungry sometimes, I should eat fruits instead of snacks.
16+
I should start eating more fruits. If I am hungry sometimes, I should eat fruits instead of snacks.
17+
18+
## Beverages
19+
20+
The calorie content in beverages is important. For every 100 ml, if the calorie count is below 100, it's acceptable for me. However, drinking beverages without sugar can be limiting.
21+
22+
NFC (Not From Concentrate) beverages are a good option as well.
23+

_posts/en/2024-12-10-life-tips-en.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ translated: false
77
---
88

99

10+
1011
* Explore the world early, go to different countries, and talk to different people.
1112

1213
* Read many books, especially non-fiction ones.
@@ -71,4 +72,4 @@ translated: false
7172

7273
* Focus on learning Science, Technology, Engineering, and Mathematics (STEM). These fields are generally based on reproducible and verifiable facts, unlike some other areas of knowledge. Prioritize learning correct information initially to avoid needing to correct your understanding or habits later.
7374

74-
* Your perception of your salary matters more than the amount itself. If you compare it to others, it will likely never feel sufficient. Also, how you spend your salary matters; if you buy what you need daily and at a low cost, you might feel it is adequate. For example, using your salary to buy a house might not seem worthwhile, but using it to buy food or a mobile phone might feel more justifiable.
75+
* Your perception of your salary matters more than the amount itself. If you compare it to others, it will likely never feel sufficient. Also, how you spend your salary matters; if you buy what you need daily at a low cost, you might feel it is adequate. For example, using it to buy food or a mobile phone might feel more justifiable, but using your salary to buy a house might not seem as worthwhile.

_posts/en/2025-01-05-research-en.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ top: 10
77
translated: false
88
---
99

10+
11+
1012
Besides three papers about reversing myopia, I want to share more about this discovery story.
1113

1214
> Li, Zhiwei. (Jun 2023). Experimental Verification of the Natural Vision Restoration Method. Zhiwei’s Blog. Web. PDF.
@@ -81,3 +83,9 @@ The point is that most of the time, our eyes can clearly see the objects we want
8183
Try to observe and learn more on the Internet. Be careful of minor opinions. Try experimenting by yourself.
8284

8385
There are a lot of improvements in life. After the truth was found, it seems obvious. People just haven't thought about it before. Steve Jobs surely understood it. Steve Jobs' "Think Different" campaign is good.
86+
87+
## More Confident to Improve the World
88+
89+
With so many people wearing glasses, whenever I see people wearing them - whether offline or online - I recognize there's room for improvement in this area.
90+
91+
Their eyeglasses are too strong for viewing mobile phones or computers, which will cause their myopia to progressively worsen.

_posts/en/2025-01-06-plan-2025-en.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ translated: false
77
---
88

99

10+
1011
* April 2025 National Self Study Exam. Pass 4 courses:
1112
* Computer Organization and Architecture
1213
* Linear Algebra
@@ -27,9 +28,9 @@ translated: false
2728

2829
* Exercise: Play basketball at least twice a week, especially from February to November when the weather is warmer.
2930

30-
* Employment: Accept the job offer from an outsourcing company to work on a backend project at a large bank. Work well and enjoy the job.
31+
* Employment: Accept the job offer and join an outsourcing company to work on a backend project at a large bank. Work diligently and enjoy the job.
3132

32-
* Diet: Eat more fruits instead of snacks.
33+
* Diet: Prioritize fruits over snacks. Limit beverages to those with less than 100 calories per 100ml.
3334

3435
* Health: Continue to work on reversing myopia and monitor it. The estimated achievement by the end of December 2025 is:
3536
* Left Eye: Myopia (-1.50), Astigmatism (-0.75)
@@ -43,7 +44,7 @@ translated: false
4344

4445
* Fixed Expenses: monthly mortgage, property management fee, vehicle insurance fees, two mobile phone plans, electricity, water, gas, fuel costs, small commodity shopping, drinking water, and fruit.
4546

46-
* Investing: Invest regularly in Apple, Nvidia, TQQQ stock, and Bitcoin, no matter how small the amount, to learn about investing.
47+
* Investing: Regularly invest in Apple, Nvidia, TQQQ stock, and Bitcoin, ETH, and SOL.
4748

4849
* Vehicle Insurance:
4950
* The Mandatory Vehicle Insurance and Commercial Vehicle Insurance for my Neta EV will expire on October 10, 2025.

_posts/en/2025-01-07-psd-en.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ translated: false
77
---
88

99

10+
1011
## PayPal CN
1112

1213
- Website: [https://www.paypal.cn](https://www.paypal.cn)
@@ -29,4 +30,4 @@ translated: false
2930
- Creates a stack in your AWS environment
3031
- Once AWS stack creation is complete, it becomes accessible in the Databricks workspace
3132
- Supports payment with China-issued Visa cards
32-
- Trying the product requires creating resources in AWS, which costs approximately 15 USD per month. Please be aware of this cost.
33+
- Using the product requires creating resources in AWS, incurring an estimated cost of 15 USD per week. Please be aware of this potential expense.

_posts/en/2025-01-08-o1-en.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,12 @@
22
audio: true
33
lang: en
44
layout: post
5-
title: What ChatGPT o1 Can Do That 4o-mini Cannot
5+
title: Fixing GitHub Workflow LaTeX Build with ChatGPT o1
66
translated: false
77
---
88

99

10+
1011
I recently encountered an issue with the `fontawesome5` package in the GitHub flow. The solution provided by 4o-mini (using TeX Live 2021 and `tlmgr install fontawesome5`) didn’t work, but 4o suggested a better approach (using TeX Live 2023 and still using `tlmgr` to install `fontawesome5`), which I’m currently trying. It didn’t completely fix the problem, but switching to TeX Live 2023 instead of 2021 has made a significant improvement.
1112

1213
---

_posts/en/2025-01-11-contact-en.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,13 @@ title: Contact
66
translated: false
77
---
88

9+
10+
911
Hi, I'm Zhiwei Li. You can find a brief introduction [here](/introduction-en). The eight buttons on my site highlight what I'm most passionate about; I encourage you to explore them.
1012

1113
In particular, I'd like to draw your attention to my three [papers](/papers-en) on reversing myopia. You can easily find these featured essays using the "select" button on the home page..
1214

13-
And feel free to reach out if you’re interested! You can say hi to me on X, WhatsApp, or Telegram, leave a comment, send me a direct message, or drop me an email.
15+
Feel free to reach out if you’re interested! You can say hi to me on X, WhatsApp, or Telegram, leave a comment, send me a direct message, or drop me an email.
1416

1517
#### X(Twitter)
1618

_posts/en/2025-01-11-donate-en.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ translated: false
77
---
88

99

10+
1011
If you like my essays, code, or videos, you can voluntarily make a payment. You can use the following methods to pay.
1112

1213
### WeChat Pay
@@ -15,7 +16,7 @@ If you like my essays, code, or videos, you can voluntarily make a payment. You
1516

1617
### Crypto Wallet
1718

18-
Send USDT to my wallet address through the Solana network.
19+
Send SOL to my wallet address through the Solana network.
1920

2021
Address: FWK8y7q9mJvQix9bFAu8Q9CSY1FNaGdPXC4TQ96dP5y8
2122

_posts/en/2025-01-11-notes-en.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ translated: false
77
---
88

99

10+
1011
These notes are primarily generated by AI chatbots. I used them to summarize key points and will walk through them to enhance my understanding.
1112

1213
* [Active Learning](/notes/active-learning-en)
@@ -17,6 +18,7 @@ These notes are primarily generated by AI chatbots. I used them to summarize key
1718
* [Computer Organization](/notes/computer-organization-en)
1819
* [Computer Organization - Conversation](/notes/computer-organization-conv-en)
1920
* [DeepSeek V3](/notes/deepseek-v3-en)
21+
* [DeepSeek V3: Multi-Head Latent Attention and Multi-Token Prediction](/notes/deepseek-v3-conv-en)
2022
* [Electronic Fundamentals](/notes/electronic-en)
2123
* [Frontend Engineer Interview](/notes/frontend-interview-en)
2224
* [Future Predictions](/notes/predictions-en)

_posts/en/2025-01-13-gitmessageai-en.md

Lines changed: 123 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,102 @@ import os
1616
from openai import OpenAI
1717
from dotenv import load_dotenv
1818
import argparse
19+
import requests
1920

2021
load_dotenv()
2122

22-
def gitmessageai(push=True, only_message=False):
23+
def call_mistral_api(prompt):
24+
api_key = os.environ.get("MISTRAL_API_KEY")
25+
if not api_key:
26+
print("Error: MISTRAL_API_KEY environment variable not set.")
27+
return None
28+
29+
url = "https://api.mistral.ai/v1/chat/completions"
30+
headers = {
31+
"Content-Type": "application/json",
32+
"Accept": "application/json",
33+
"Authorization": f"Bearer {api_key}"
34+
}
35+
data = {
36+
"model": "mistral-large-latest",
37+
"messages": [
38+
{
39+
"role": "user",
40+
"content": prompt
41+
}
42+
]
43+
}
44+
try:
45+
response = requests.post(url, headers=headers, json=data)
46+
response.raise_for_status()
47+
response_json = response.json()
48+
if response_json and response_json['choices']:
49+
return response_json['choices'][0]['message']['content']
50+
else:
51+
print(f"Mistral API Error: Invalid response format: {response_json}")
52+
return None
53+
except requests.exceptions.RequestException as e:
54+
print(f"Mistral API Error: {e}")
55+
if e.response:
56+
print(f"Response status code: {e.response.status_code}")
57+
print(f"Response content: {e.response.text}")
58+
return None
59+
60+
61+
def call_gemini_api(prompt):
62+
gemini_api_key = os.environ.get("GEMINI_API_KEY")
63+
if not gemini_api_key:
64+
print("Error: GEMINI_API_KEY environment variable not set.")
65+
return None
66+
url = "https://generativelanguage.googleapis.com/v1beta/models/gemini-1.5-flash:generateContent"
67+
params = {"key": gemini_api_key}
68+
payload = {"contents": [{"parts": [{"text": prompt}]}]}
69+
try:
70+
response = requests.post(url, json=payload, params=params)
71+
response.raise_for_status() # Raise an exception for bad status codes
72+
response_json = response.json()
73+
if response_json and 'candidates' in response_json and response_json['candidates']:
74+
return response_json['candidates'][0]['content']['parts'][0]['text']
75+
else:
76+
print(f"Gemini API Error: Invalid response format: {response_json}")
77+
return None
78+
except requests.exceptions.RequestException as e:
79+
print(f"Gemini API Error: {e}")
80+
if e.response:
81+
print(f"Response status code: {e.response.status_code}")
82+
print(f"Response content: {e.response.text}")
83+
return None
84+
85+
def call_deepseek_api(prompt):
86+
api_key = os.environ.get("DEEPSEEK_API_KEY")
87+
if not api_key:
88+
print("Error: DEEPSEEK_API_KEY environment variable not set.")
89+
return None
90+
91+
client = OpenAI(api_key=api_key, base_url="https://api.deepseek.com")
92+
93+
try:
94+
response = client.chat.completions.create(
95+
model="deepseek-chat",
96+
messages=[
97+
{"role": "user", "content": prompt}
98+
],
99+
max_tokens=100
100+
)
101+
if response and response.choices:
102+
commit_message = response.choices[0].message.content.strip()
103+
commit_message = commit_message.replace('`', '')
104+
return commit_message
105+
else:
106+
print("Error: No response from the API.")
107+
return None
108+
except Exception as e:
109+
print(f"Error during API call: {e}")
110+
print(e)
111+
return None
112+
113+
114+
def gitmessageai(push=True, only_message=False, api='deepseek'):
23115
# Stage all changes
24116
subprocess.run(["git", "add", "-A"], check=True)
25117

@@ -44,31 +136,22 @@ Changed files:
44136
Commit message:
45137
"""
46138

47-
# Send the prompt to the DeepSeek API
48-
api_key = os.environ.get("DEEPSEEK_API_KEY")
49-
if not api_key:
50-
print("Error: DEEPSEEK_API_KEY environment variable not set.")
51-
return
52-
53-
client = OpenAI(api_key=api_key, base_url="https://api.deepseek.com")
54-
55-
try:
56-
response = client.chat.completions.create(
57-
model="deepseek-chat",
58-
messages=[
59-
{"role": "user", "content": prompt}
60-
],
61-
max_tokens=100
62-
)
63-
if response and response.choices:
64-
commit_message = response.choices[0].message.content.strip()
65-
commit_message = commit_message.replace('`', '')
66-
else:
67-
print("Error: No response from the API.")
139+
if api == 'deepseek':
140+
commit_message = call_deepseek_api(prompt)
141+
if not commit_message:
68142
return
69-
except Exception as e:
70-
print(f"Error during API call: {e}")
71-
print(e)
143+
elif api == 'gemini':
144+
commit_message = call_gemini_api(prompt)
145+
if not commit_message:
146+
print("Error: No response from Gemini API.")
147+
return
148+
elif api == 'mistral':
149+
commit_message = call_mistral_api(prompt)
150+
if not commit_message:
151+
print("Error: No response from Mistral API.")
152+
return
153+
else:
154+
print(f"Error: Invalid API specified: {api}")
72155
return
73156

74157
# Check if the commit message is empty
@@ -93,13 +176,26 @@ if __name__ == "__main__":
93176
parser = argparse.ArgumentParser(description="Generate commit message with AI and commit changes.")
94177
parser.add_argument('--no-push', dest='push', action='store_false', help='Commit changes locally without pushing.')
95178
parser.add_argument('--only-message', dest='only_message', action='store_true', help='Only print the AI generated commit message.')
179+
parser.add_argument('--api', type=str, default='deepseek', choices=['deepseek', 'gemini', 'mistral'], help='API to use for commit message generation (deepseek, gemini, or mistral).')
96180
args = parser.parse_args()
97-
gitmessageai(push=args.push, only_message=args.only_message)
181+
gitmessageai(push=args.push, only_message=args.only_message, api=args.api)
98182
```
99183

100-
Then, in your `~/.zprofile` file, add the following:
184+
This script can be called with different APIs. For example:
101185

186+
```bash
187+
python ~/bin/gitmessageai.py
188+
python ~/bin/gitmessageai.py --no-push
189+
python ~/bin/gitmessageai.py --only-message
190+
python ~/bin/gitmessageai.py --api gemini
191+
python ~/bin/gitmessageai.py --api mistral --no-push
192+
python ~/bin/gitmessageai.py --api deepseek --only-message
102193
```
194+
195+
196+
Then, in your `~/.zprofile` file, add the following:
197+
198+
```bash
103199
alias gpa='python ~/bin/gitmessageai.py'
104200
alias gca='python ~/bin/gitmessageai.py --no-push'
105201
alias gm='python ~/bin/gitmessageai.py --only-message'

_posts/en/2025-01-15-context-length-en.md

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,17 @@ translated: false
77
---
88

99

10-
I recently used the DeepSeek API to generate a commit message, as described in [AI-Powered Git Commit Messages](./gitmessageai-en).
1110

12-
When a commit involves many changed files, the DeepSeek API reported that the input exceeded its context length limit of 65,535 tokens (2^16 - 1).
11+
I recently encountered the context length limit of the DeepSeek API while generating a commit message, as detailed in [AI-Powered Git Commit Messages](./gitmessageai-en).
1312

14-
Here are the context window sizes of some other models:
13+
Specifically, when a commit involved numerous changed files, the API reported that the input exceeded its context length limit of 65,535 tokens (2^16 - 1).
14+
15+
According to their documentation: [https://api-docs.deepseek.com/quick_start/pricing](https://api-docs.deepseek.com/quick_start/pricing), the context length is 64k tokens, with a maximum output of 8k tokens.
16+
17+
Here's a comparison of context window sizes for several other models:
18+
19+
* **Claude 3 Family:** Launched in March 2024, these models offer context windows starting at 200,000 tokens.
20+
* **GPT-4:** The standard version has a context window of 8,192 tokens, while the extended version (GPT-4-32k) supports 32,768 tokens.
21+
* **Meta's LLaMA 2:** The base model supports 4,096 tokens, but fine-tuned versions can handle up to 16,384 tokens.
22+
* **Mistral 7B:** Supports a context window of 8,000 tokens.
1523

16-
* **Claude 3 Family:** Introduced in March 2024, these models have context windows starting at 200,000 tokens.
17-
* **GPT-4:** The standard version supports 8,192 tokens, while the extended version (GPT-4-32k) supports 32,768 tokens.
18-
* **Meta's LLaMA 2:** The standard version supports 4,096 tokens, but fine-tuned versions can handle up to 16,384 tokens.
19-
* **Mistral 7B:** Supports up to 8,000 tokens.

_posts/en/2025-01-15-language-support-en.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ translated: false
77
---
88

99

10+
1011
My blog now supports nine languages: Japanese (`ja`), Spanish (`es`), Hindi (`hi`), Chinese (`zh`), English (`en`), French (`fr`), German (`de`), Arabic (`ar`), and Traditional Chinese (`hant`). You can find the site at [https://lzwjava.github.io](https://lzwjava.github.io)
1112

1213
When dealing with multiple languages in a computer environment, several aspects need consideration.
@@ -89,3 +90,8 @@ I utilize Google Text-to-Speech to generate audio versions of my blog posts. The
8990
```
9091

9192
Currently, audio is generated for Chinese and English content. To extend support to other languages, the corresponding language codes must be configured.
93+
94+
## Summary
95+
96+
Languages differ in two primary aspects: their written representation (shape) and their spoken form (pronunciation). The font selection and text-to-speech configurations address these two aspects, respectively.
97+

0 commit comments

Comments
 (0)