Skip to content

Commit aa823df

Browse files
committed
Improve language and feature selector UI
1 parent 73f9be9 commit aa823df

File tree

17 files changed

+242
-92
lines changed

17 files changed

+242
-92
lines changed

Cargo.lock

Lines changed: 104 additions & 28 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

README-zh-CN.md

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -126,16 +126,12 @@ AiR 必须获得系统辅助功能权限。
126126
- 字体大小
127127
- 失去焦点时隐藏:当 AiR 失去焦点时隐藏它。
128128
- 置顶:保持 AiR 在其他窗口之上。
129-
- 激活的功能:使用非直接功能时启用的功能。
130129
- AI
131130
- API 基础:AI API 的基本 URL。确保不要忘记 `v1` 部分。(例如:https://api.openai.com/v1)。
132131
- API 密钥
133132
- 模型
134133
- 模型名称:仅当模型设置为 “自定义” 时可用。
135134
- 温度:人工智能的不可预测性。
136-
- 翻译
137-
- 语言 A:您希望从/向 B 翻译的语言。
138-
- 语言 B:您希望从/向 A 翻译的语言。
139135
- 快捷键
140136
- 重写​
141137
- 直接重写​

README.md

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -126,16 +126,12 @@ You can configure the settings by navigating to the "Settings" panel.
126126
- Font Size
127127
- Hide on Lost Focus: Hide AiR when it loses focus.
128128
- Stick to Top: Keep AiR on top of other windows.
129-
- Active Function: The active function when using non-directly functions.
130129
- AI
131130
- API Base: The base URL of the AI API. It's crucial to ensure you don't forget the `v1` part. (e.g., https://api.openai.com/v1).
132131
- API Key
133132
- Model
134133
- Model Name: Available only if the model is set to `Custom`.
135134
- Temperature: The unpredictability of AI.
136-
- Translation
137-
- Language A: The language you want to translate from/to B.
138-
- Language B: The language you want to translate from/to A.
139135
- Hotkey
140136
- Rewrite
141137
- Rewrite Directly

demo/ui-0.png

6.08 KB
Loading

demo/ui-1.png

-7.51 KB
Loading

src/component/function.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ impl ComboBoxItem for Function {
4848
[Self::Rewrite, Self::Translate]
4949
}
5050

51-
fn display(&self) -> Cow<str> {
51+
fn selectable_str(&self) -> Cow<str> {
5252
Cow::Borrowed(match self {
5353
Self::Rewrite | Self::RewriteDirectly => "Rewrite",
5454
Self::Translate | Self::TranslateDirectly => "Translate",

src/component/openai.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ impl ComboBoxItem for Model {
9797
[Self::Custom("".into()), Self::Gpt4o, Self::Gpt4Turbo, Self::Gpt35Turbo]
9898
}
9999

100-
fn display(&self) -> Cow<str> {
100+
fn selectable_str(&self) -> Cow<str> {
101101
Cow::Borrowed(match self {
102102
Self::Custom(_) => "Custom",
103103
Self::Gpt4o => "GPT-4o",

src/component/setting.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,6 @@ pub struct General {
7373
pub hide_on_lost_focus: bool,
7474
pub stick_to_top: bool,
7575
pub notification_sound: bool,
76-
pub active_func: Function,
7776
}
7877
impl Default for General {
7978
fn default() -> Self {
@@ -82,7 +81,6 @@ impl Default for General {
8281
hide_on_lost_focus: true,
8382
stick_to_top: Default::default(),
8483
notification_sound: true,
85-
active_func: Default::default(),
8684
}
8785
}
8886
}
@@ -110,6 +108,7 @@ impl Default for Ai {
110108
#[derive(Clone, Debug, Default, Serialize, Deserialize)]
111109
#[serde(default, rename_all = "kebab-case")]
112110
pub struct Chat {
111+
pub activated_function: Function,
113112
pub rewrite: Rewrite,
114113
pub translation: Translation,
115114
}
@@ -234,7 +233,7 @@ impl ComboBoxItem for LogLevel {
234233
[Self::Trace, Self::Debug, Self::Info, Self::Warn, Self::Error]
235234
}
236235

237-
fn display(&self) -> Cow<str> {
236+
fn selectable_str(&self) -> Cow<str> {
238237
Cow::Borrowed(match self {
239238
Self::Trace => "Trace",
240239
Self::Debug => "Debug",

src/service.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,7 @@ impl Services {
4747
let hotkey = Hotkey::new(
4848
ctx,
4949
&components.setting.hotkeys,
50-
state.general.notification_sound.clone(),
51-
state.ui.focused_panel.clone(),
50+
&state,
5251
keyboard.clone(),
5352
audio.clone(),
5453
chat.tx.clone(),

0 commit comments

Comments
 (0)