Skip to content

Commit aaf34a0

Browse files
committed
*修改宣传图
*更新文案 *修改语言搜索逻辑 *增加图片翻译以及其他提示词 *优化Gemini错误提示 *增加图片模型提示 *修改api以及服务器配置逻辑 *增加联系邮件
1 parent 7286a5a commit aaf34a0

28 files changed

+223
-86
lines changed

README.md

+5-4
Original file line numberDiff line numberDiff line change
@@ -2,29 +2,30 @@
22
<p align="left">
33
<a align="center" href="https://miaoyan.app/" target="_blank"><img src=https://github.com/flyun/chatAir/blob/chatair/TMessagesProj/src/main/ic_launcher-playstore.png width=138 /></a>
44
<h1 align="left">ChatAir</h1>
5-
<div align="left">ChatAir is a native client for OpenAI and ChatGPT</div>
5+
<div align="left">ChatAir is a native client for ChatGPT and Gemini</div>
66
</p>
77

88

99
## ChatAir for Android
1010

11-
ChatAir is a native client for OpenAI and ChatGPT, providing a smoother and faster chat experience than ChatGPT.
11+
ChatAir is a native client for OpenAI and Gemini, providing a smoother and faster chat experience than ChatGPT.
1212

1313
<div align="left">
1414
<img src = "https://github.com/flyun/chatAir/blob/chatair/ScreenShots/01.png" width ="160" />
1515
<img src = "https://github.com/flyun/chatAir/blob/chatair/ScreenShots/02.png" width ="160" />
1616
<img src = "https://github.com/flyun/chatAir/blob/chatair/ScreenShots/03.png" width ="160" />
1717
<img src = "https://github.com/flyun/chatAir/blob/chatair/ScreenShots/04.png" width ="160" />
1818
<img src = "https://github.com/flyun/chatAir/blob/chatair/ScreenShots/05.png" width ="160" />
19+
<img src = "https://github.com/flyun/chatAir/blob/chatair/ScreenShots/06.png" width ="160" />
1920
</div>
2021

2122
## Installation
2223
download and install the APK package from the [Releases section](https://github.com/flyun/chatAir/releases/latest).
2324

2425
## Features
2526
- 🚀 **Smooth**: Developed natively on Android, showcasing efficient performance and creating a seamless user experience.
26-
- 🔬 **Advanced**: Supports OpenAI API calls, as well as the replacement of custom server addresses like OpenRouter, allowing flexible customization of your server address.
27+
- 🔬 **Advanced**: Supports OpenAI/Gemini API calls, as well as the replacement of custom server addresses like OpenRouter, allowing flexible customization of your server address.
2728
- 📝 **Professional**: Supports Markdown, code highlighting feature makes your code clear and easy to read.
2829
- 🛠️ **Customizable**: Customizable prompts, model, temperature, history, and reply length limit settings, offering a personalized user experience.
2930
- 🌙 **Stylish**: Provides dark mode and customized themes to protect your eyes while enhancing user experience.
30-
31+
- 🖼️ **Image recognition**: Supports image recognition function to quickly and accurately obtain image information.

README_CN.md

+5-3
Original file line numberDiff line numberDiff line change
@@ -2,29 +2,31 @@
22
<p align="left">
33
<a align="center" href="https://miaoyan.app/" target="_blank"><img src=https://github.com/flyun/chatAir/blob/chatair/TMessagesProj/src/main/ic_launcher-playstore.png width=138 /></a>
44
<h1 align="left">ChatAir</h1>
5-
<div align="left">ChatAir 是 OpenAIChatGPT 的原生客户端</div>
5+
<div align="left">ChatAir 是 ChatGPTGemini 的原生客户端</div>
66
</p>
77

88

99
## Android 版 ChatAir
1010

11-
ChatAir 是 OpenAI 和 ChatGPT 的原生客户端,提供比 ChatGPT 更流畅、更快速的聊天体验。
11+
ChatAir 是 OpenAI 和 Gemini 的原生客户端,提供比 ChatGPT 更流畅、更快速的聊天体验。
1212

1313
<div align="left">
1414
<img src = "https://github.com/flyun/chatAir/blob/chatair/ScreenShots/01.png" width ="160" />
1515
<img src = "https://github.com/flyun/chatAir/blob/chatair/ScreenShots/02.png" width ="160" />
1616
<img src = "https://github.com/flyun/chatAir/blob/chatair/ScreenShots/03.png" width ="160" />
1717
<img src = "https://github.com/flyun/chatAir/blob/chatair/ScreenShots/04.png" width ="160" />
1818
<img src = "https://github.com/flyun/chatAir/blob/chatair/ScreenShots/05.png" width ="160" />
19+
<img src = "https://github.com/flyun/chatAir/blob/chatair/ScreenShots/06.png" width ="160" />
1920
</div>
2021

2122
## 安装
2223
从以下位置下载并安装 APK 包 [Releases section](https://github.com/flyun/chatAir/releases/latest).
2324

2425
## Features
2526
- 🚀 **流畅**: 使用Android原生开发,高效的性能表现,打造无缝切换的使用体验
26-
- 🔬 **高级**: 支持 OpenAI 的 API 调用,以及 OpenRouter 等自定义服务器地址替换,灵活定制你的服务器地址
27+
- 🔬 **高级**: 支持 OpenAI/Gemini 的 API 调用,以及 OpenRouter 等自定义服务器地址替换,灵活定制你的服务器地址
2728
- 📝 **专业**: 支持 Markdown,代码高亮功能让你的代码清晰易读
2829
- 🛠️ **定制**: 自定义 Prompt,模型、温度、历史记录以及回复长度限制参数设置,提供个性化的使用体验
2930
- 🌙 **酷炫**: 提供暗黑模式和自定义主题,护眼同时增加使用的体验性
31+
- 🖼️ **识图**: 支持图片识别功能,快速准确获取图像信息
3032

ScreenShots/06.png

3.16 MB
Loading

TMessagesProj/src/main/AndroidManifest.xml

+33-33
Original file line numberDiff line numberDiff line change
@@ -253,23 +253,23 @@
253253
<!-- <category android:name="android.intent.category.DEFAULT"/>-->
254254
<!-- <data android:mimeType="vnd.android.cursor.item/vnd.org.telegram.messenger.android.profile"/>-->
255255
<!-- </intent-filter>-->
256-
<intent-filter>
257-
<action android:name="android.intent.action.VIEW"/>
258-
<category android:name="android.intent.category.DEFAULT" />
259-
<category android:name="android.intent.category.BROWSABLE" />
260-
<data android:host="telegram.me" android:scheme="http" />
261-
<data android:host="telegram.me" android:scheme="https" />
262-
<data android:host="telegram.dog" android:scheme="http" />
263-
<data android:host="telegram.dog" android:scheme="https" />
264-
<data android:host="t.me" android:scheme="http" />
265-
<data android:host="t.me" android:scheme="https" />
266-
</intent-filter>
267-
<intent-filter android:icon="@mipmap/ic_launcher" android:roundIcon="@mipmap/ic_launcher_round" android:priority="1">
268-
<action android:name="android.intent.action.VIEW" />
269-
<category android:name="android.intent.category.BROWSABLE" />
270-
<category android:name="android.intent.category.DEFAULT" />
271-
<data android:scheme="tg" />
272-
</intent-filter>
256+
<!-- <intent-filter>-->
257+
<!-- <action android:name="android.intent.action.VIEW"/>-->
258+
<!-- <category android:name="android.intent.category.DEFAULT" />-->
259+
<!-- <category android:name="android.intent.category.BROWSABLE" />-->
260+
<!-- <data android:host="telegram.me" android:scheme="http" />-->
261+
<!-- <data android:host="telegram.me" android:scheme="https" />-->
262+
<!-- <data android:host="telegram.dog" android:scheme="http" />-->
263+
<!-- <data android:host="telegram.dog" android:scheme="https" />-->
264+
<!-- <data android:host="t.me" android:scheme="http" />-->
265+
<!-- <data android:host="t.me" android:scheme="https" />-->
266+
<!-- </intent-filter>-->
267+
<!-- <intent-filter android:icon="@mipmap/ic_launcher" android:roundIcon="@mipmap/ic_launcher_round" android:priority="1">-->
268+
<!-- <action android:name="android.intent.action.VIEW" />-->
269+
<!-- <category android:name="android.intent.category.BROWSABLE" />-->
270+
<!-- <category android:name="android.intent.category.DEFAULT" />-->
271+
<!-- <data android:scheme="tg" />-->
272+
<!-- </intent-filter>-->
273273
<!-- <intent-filter>-->
274274
<!-- <action android:name="org.telegram.messenger.CREATE_STICKER_PACK"/>-->
275275
<!-- <category android:name="android.intent.category.DEFAULT"/>-->
@@ -298,22 +298,22 @@
298298
android:allowEmbedded="true"
299299
android:documentLaunchMode="always"
300300
android:resizeableActivity="true"/>
301-
<activity
302-
android:name="org.telegram.ui.ShareActivity"
303-
android:configChanges="keyboard|keyboardHidden|orientation|screenSize|uiMode"
304-
android:hardwareAccelerated="@bool/useHardwareAcceleration"
305-
android:windowSoftInputMode="adjustPan"
306-
android:excludeFromRecents="true"
307-
android:stateNotNeeded="true"
308-
android:theme="@style/Theme.TMessages.Transparent"
309-
android:exported="true">
310-
<intent-filter android:icon="@mipmap/ic_launcher" android:roundIcon="@mipmap/ic_launcher_round" android:priority="1">
311-
<action android:name="android.intent.action.VIEW" />
312-
<category android:name="android.intent.category.BROWSABLE" />
313-
<category android:name="android.intent.category.DEFAULT" />
314-
<data android:scheme="tgb" />
315-
</intent-filter>
316-
</activity>
301+
<!-- <activity-->
302+
<!-- android:name="org.telegram.ui.ShareActivity"-->
303+
<!-- android:configChanges="keyboard|keyboardHidden|orientation|screenSize|uiMode"-->
304+
<!-- android:hardwareAccelerated="@bool/useHardwareAcceleration"-->
305+
<!-- android:windowSoftInputMode="adjustPan"-->
306+
<!-- android:excludeFromRecents="true"-->
307+
<!-- android:stateNotNeeded="true"-->
308+
<!-- android:theme="@style/Theme.TMessages.Transparent"-->
309+
<!-- android:exported="true">-->
310+
<!-- <intent-filter android:icon="@mipmap/ic_launcher" android:roundIcon="@mipmap/ic_launcher_round" android:priority="1">-->
311+
<!-- <action android:name="android.intent.action.VIEW" />-->
312+
<!-- <category android:name="android.intent.category.BROWSABLE" />-->
313+
<!-- <category android:name="android.intent.category.DEFAULT" />-->
314+
<!-- <data android:scheme="tgb" />-->
315+
<!-- </intent-filter>-->
316+
<!-- </activity>-->
317317
<activity
318318
android:name="org.telegram.ui.ExternalActionActivity"
319319
android:configChanges="keyboard|keyboardHidden|orientation|screenSize|uiMode"

TMessagesProj/src/main/java/org/telegram/messenger/LocaleController.java

+19-8
Original file line numberDiff line numberDiff line change
@@ -103,8 +103,9 @@ public void onReceive(Context context, Intent intent) {
103103

104104
public static class LocaleInfo {
105105

106-
public String name;
107-
public String nameEnglish;
106+
public String name;// 本土语言名称
107+
public String nameEnglish;// 英语语言名称
108+
public String nameChinese;// 中文语言名称
108109
public String shortName;// 自定义配置
109110
public String pathToFile;
110111
public String baseLangCode;
@@ -264,6 +265,7 @@ public LocaleController() {
264265
LocaleInfo localeInfo = new LocaleInfo();
265266
localeInfo.name = "English";
266267
localeInfo.nameEnglish = "English";
268+
localeInfo.nameChinese = "英语";
267269
localeInfo.shortName = localeInfo.pluralLangCode = "en";
268270
localeInfo.pathToFile = null;
269271
localeInfo.builtIn = true;
@@ -273,6 +275,7 @@ public LocaleController() {
273275
localeInfo = new LocaleInfo();
274276
localeInfo.name = "Italiano";
275277
localeInfo.nameEnglish = "Italian";
278+
localeInfo.nameChinese = "意大利语";
276279
localeInfo.shortName = localeInfo.pluralLangCode = "it";
277280
localeInfo.pathToFile = null;
278281
localeInfo.builtIn = true;
@@ -282,6 +285,7 @@ public LocaleController() {
282285
localeInfo = new LocaleInfo();
283286
localeInfo.name = "Español";
284287
localeInfo.nameEnglish = "Spanish";
288+
localeInfo.nameChinese = "西班牙语";
285289
localeInfo.shortName = localeInfo.pluralLangCode = "es";
286290
localeInfo.builtIn = true;
287291
languages.add(localeInfo);
@@ -290,6 +294,7 @@ public LocaleController() {
290294
localeInfo = new LocaleInfo();
291295
localeInfo.name = "Deutsch";
292296
localeInfo.nameEnglish = "German";
297+
localeInfo.nameChinese = "德语";
293298
localeInfo.shortName = localeInfo.pluralLangCode = "de";
294299
localeInfo.pathToFile = null;
295300
localeInfo.builtIn = true;
@@ -299,6 +304,7 @@ public LocaleController() {
299304
localeInfo = new LocaleInfo();
300305
localeInfo.name = "Nederlands";
301306
localeInfo.nameEnglish = "Dutch";
307+
localeInfo.nameChinese = "荷兰语";
302308
localeInfo.shortName = localeInfo.pluralLangCode = "nl";
303309
localeInfo.pathToFile = null;
304310
localeInfo.builtIn = true;
@@ -308,6 +314,7 @@ public LocaleController() {
308314
localeInfo = new LocaleInfo();
309315
localeInfo.name = "العربية";
310316
localeInfo.nameEnglish = "Arabic";
317+
localeInfo.nameChinese = "阿拉伯语";
311318
localeInfo.shortName = localeInfo.pluralLangCode = "ar";
312319
localeInfo.pathToFile = null;
313320
localeInfo.builtIn = true;
@@ -318,6 +325,7 @@ public LocaleController() {
318325
localeInfo = new LocaleInfo();
319326
localeInfo.name = "Português (Brasil)";
320327
localeInfo.nameEnglish = "Portuguese (Brazil)";
328+
localeInfo.nameChinese = "葡萄牙语(巴西)";
321329
localeInfo.shortName = localeInfo.pluralLangCode = "pt_br";
322330
localeInfo.pathToFile = null;
323331
localeInfo.builtIn = true;
@@ -327,6 +335,7 @@ public LocaleController() {
327335
localeInfo = new LocaleInfo();
328336
localeInfo.name = "한국어";
329337
localeInfo.nameEnglish = "Korean";
338+
localeInfo.nameChinese = "韩语";
330339
localeInfo.shortName = localeInfo.pluralLangCode = "ko";
331340
localeInfo.pathToFile = null;
332341
localeInfo.builtIn = true;
@@ -335,26 +344,28 @@ public LocaleController() {
335344

336345
localeInfo = new LocaleInfo();
337346
localeInfo.name = "简体中文";
338-
localeInfo.nameEnglish = "简体中文";
347+
localeInfo.nameEnglish = "Simplified Chinese";
348+
localeInfo.nameChinese = "简体中文";
339349
localeInfo.shortName = localeInfo.pluralLangCode = "zh";
340350
localeInfo.pathToFile = null;
341351
localeInfo.builtIn = true;
342352
languages.add(localeInfo);
343353
languagesDict.put(localeInfo.shortName, localeInfo);
344354

345355
localeInfo = new LocaleInfo();
346-
localeInfo.name = "台灣正體";
347-
localeInfo.nameEnglish = "台灣正體";
356+
localeInfo.name = "繁体中文(台灣)";
357+
localeInfo.nameEnglish = "Traditional Chinese (Taiwan)";
358+
localeInfo.nameChinese = "繁体中文(台湾)";
348359
localeInfo.shortName = localeInfo.pluralLangCode = "zh_tw";
349360
localeInfo.pathToFile = null;
350361
localeInfo.builtIn = true;
351362
languages.add(localeInfo);
352363
languagesDict.put(localeInfo.shortName, localeInfo);
353364

354-
355365
localeInfo = new LocaleInfo();
356-
localeInfo.name = "繁体中文";
357-
localeInfo.nameEnglish = "繁体(香港/澳门)";
366+
localeInfo.name = "繁体中文(香港/澳门)";
367+
localeInfo.nameEnglish = "Traditional Chinese (Hong Kong/Macau)";
368+
localeInfo.nameChinese = "繁体中文(香港/澳门)";
358369
localeInfo.shortName = localeInfo.pluralLangCode = "zh_hk";
359370
localeInfo.pathToFile = null;
360371
localeInfo.builtIn = true;

TMessagesProj/src/main/java/org/telegram/messenger/SendMessagesHelper.java

+22-14
Original file line numberDiff line numberDiff line change
@@ -5822,7 +5822,9 @@ protected void performSendMessageRequest(final TLObject req, final MessageObject
58225822
chatCompletionRequest = ChatCompletionRequest.builder()
58235823
.model(aiModelReal)
58245824
.temperature(temperature != -100 ? temperature : null)
5825-
.maxTokens(tokenLimit != -100 ? tokenLimit : null)
5825+
// todo gpt-4-vision-preview如果不配置maxTokens,则会按照最短的maxTokens配置。
5826+
// 导致输出文字过短,而图片模型无法进行多轮会话导致无法发送继续,输出更多内容。
5827+
.maxTokens(tokenLimit != -100 ? tokenLimit : 4096)
58265828
.build().setMessages(chatMessageList);
58275829

58285830
} else {
@@ -6835,9 +6837,11 @@ public void onError(GoogleHttpException error, Throwable throwable) {
68356837

68366838
String errorTx;
68376839
if (error != null) {
6838-
errorTx = error.getMessage();
6840+
// 增加Gemini 一问一答的错误提示
6841+
errorTx = getGeminiError(error.getMessage());
68396842
} else {
6840-
errorTx = throwable.getMessage();
6843+
// 增加Gemini 一问一答的错误提示
6844+
errorTx = getGeminiError(throwable.getMessage());
68416845
}
68426846

68436847
if (!TextUtils.isEmpty(errorTx)) {
@@ -6944,20 +6948,13 @@ public void onError(GoogleHttpException error, Throwable throwable) {
69446948

69456949
String errorTx;
69466950
if (error != null) {
6947-
6948-
// Log.e("test","err:"
6949-
// + " ,statusCode:"+ error.statusCode
6950-
// + " ,code:"+ error.code
6951-
// + " ,param:"+ error.param
6952-
// + " ,type:"+ error.type);
6953-
69546951
errorTx = "code:" + error.code
69556952
+ "\n" + "status:" + error.status
6956-
+ "\n" + "message:" + error.getMessage();
6953+
// 增加Gemini 一问一答的错误提示
6954+
+ "\n" + "message:" + getGeminiError(error.getMessage());
69576955
} else {
6958-
6959-
// Log.e("test","err:" + throwable);
6960-
errorTx = throwable.getMessage();
6956+
// 增加Gemini 一问一答的错误提示
6957+
errorTx = getGeminiError(throwable.getMessage());
69616958
}
69626959

69636960
if (!TextUtils.isEmpty(errorTx)) {
@@ -6997,6 +6994,17 @@ public void onLoading(boolean isLoading) {
69976994

69986995
}
69996996

6997+
private String getGeminiError(String errorMessage) {
6998+
String errorTx;
6999+
if (!TextUtils.isEmpty(errorMessage)
7000+
&& errorMessage.contains("Please ensure that multiturn requests")) {
7001+
7002+
errorTx = errorMessage + "\n\nPlease click Clear context or clear history and try again.";
7003+
} else {
7004+
errorTx = errorMessage;
7005+
}
7006+
return errorTx;
7007+
}
70007008

70017009
private void updateMediaPaths(MessageObject newMsgObj, TLRPC.Message sentMessage, int newMsgId, String originalPath, boolean post) {
70027010
TLRPC.Message newMsg = newMsgObj.messageOwner;

TMessagesProj/src/main/java/org/telegram/messenger/UserConfig.java

+4-2
Original file line numberDiff line numberDiff line change
@@ -506,7 +506,8 @@ private void initAiModelList() {
506506
aiModelList.put(7, new AiModelBean("GPT-4-32k", "gpt-4-32k", true));
507507
aiModelList.put(8, new AiModelBean("GPT-4-32k-0613", "gpt-4-32k-0613", false));
508508
aiModelList.put(9, new AiModelBean("GPT-4-1106-preview", "gpt-4-1106-preview", true));
509-
aiModelList.put(10, new AiModelBean("GPT-4-vision-preview", "gpt-4-vision-preview", true));
509+
aiModelList.put(10, new AiModelBean("GPT-4-vision-preview", "gpt-4-vision-preview",
510+
"GPT-4-vision-preview (Picture model)", true));
510511
// initOpenrouter();
511512
initGoogle();
512513
aiModelList.put(0, new AiModelBean(LocaleController.getString("CustomModel", R.string.CustomModel), "custom Model", true));
@@ -541,7 +542,8 @@ private void initOpenrouter() {
541542
public void initGoogle() {
542543
if (aiModelList == null) return;
543544
aiModelList.put(801, new AiModelBean("Gemini Pro", "gemini-pro", true));
544-
aiModelList.put(802, new AiModelBean("Gemini Pro Vision", "gemini-pro-vision", true));
545+
aiModelList.put(802, new AiModelBean("Gemini Pro Vision", "gemini-pro-vision",
546+
"Gemini Pro Vision (Picture model)", true));
545547

546548
}
547549

TMessagesProj/src/main/java/org/telegram/tgnet/AiModelBean.java

+11
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,20 @@
66
public class AiModelBean {
77

88
public final String name;
9+
public final String tips;
910
public final String aiModel;
1011
public final boolean isShow;
1112

1213
public AiModelBean(String name, String aiModel, boolean isShow) {
1314
this.name = name;
1415
this.aiModel = aiModel;
16+
this.tips = name;
17+
this.isShow = isShow;
18+
}
19+
public AiModelBean(String name, String aiModel, String tips, boolean isShow) {
20+
this.name = name;
21+
this.aiModel = aiModel;
22+
this.tips = tips;
1523
this.isShow = isShow;
1624
}
1725

@@ -22,6 +30,9 @@ public String getName() {
2230
public String getAiModel() {
2331
return aiModel;
2432
}
33+
public String getTips() {
34+
return tips;
35+
}
2536

2637
public boolean isShow() {
2738
return isShow;

0 commit comments

Comments
 (0)