Skip to content

Commit

Permalink
Add missing spaces after (cx,...) for consistency
Browse files Browse the repository at this point in the history
  • Loading branch information
joulei committed Jan 22, 2025
1 parent f1cd519 commit 8502b16
Show file tree
Hide file tree
Showing 24 changed files with 86 additions and 86 deletions.
2 changes: 1 addition & 1 deletion src/chat/chat_history.rs
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ impl Widget for ChatHistory {
}
Item::NoAgentsWarning(text) => {
let item = list.item(cx, item_id, live_id!(NoAgentsWarning));
item.set_text(cx,text);
item.set_text(cx, text);
item.draw_all(cx, scope);
}
Item::AgentButton(agent) => {
Expand Down
6 changes: 3 additions & 3 deletions src/chat/chat_history_card.rs
Original file line number Diff line number Diff line change
Expand Up @@ -450,12 +450,12 @@ impl ChatHistoryCard {
}

fn set_title_text(&mut self, cx: &mut Cx, text: &str, caption: &str) {
self.view.label(id!(title_label)).set_text(cx,text.trim());
self.view.label(id!(title_label)).set_text(cx, text.trim());
if let TitleState::Editable = self.title_edition_state {
self.view.text_input(id!(title_input)).set_text(cx,text.trim());
self.view.text_input(id!(title_input)).set_text(cx, text.trim());
}
self.label(id!(model_or_agent_name_label))
.set_text(cx,&human_readable_name(caption));
.set_text(cx, &human_readable_name(caption));
}

fn update_title_visibility(&mut self, cx: &mut Cx) {
Expand Down
16 changes: 8 additions & 8 deletions src/chat/chat_line.rs
Original file line number Diff line number Diff line change
Expand Up @@ -413,7 +413,7 @@ impl ChatLineRef {
let Some(inner) = self.borrow_mut() else {
return;
};
inner.label(id!(sender_name)).set_text(cx,text);
inner.label(id!(sender_name)).set_text(cx, text);
}

pub fn set_model_avatar_text(&mut self, cx: &mut Cx, text: &str) {
Expand All @@ -422,7 +422,7 @@ impl ChatLineRef {
};
inner.view(id!(avatar_section.model)).set_visible(cx, true);
inner.chat_agent_avatar(id!(avatar_section.agent)).set_visible(false);
inner.label(id!(avatar_label)).set_text(cx,text);
inner.label(id!(avatar_label)).set_text(cx, text);
}

pub fn set_model_avatar(&mut self, cx: &mut Cx, agent: &MofaAgent) {
Expand All @@ -444,13 +444,13 @@ impl ChatLineRef {
ChatLineState::Editable | ChatLineState::NotEditable => {
if is_streaming && !text.is_empty() {
let output = format!("{}{}", text, "●");
inner.text_input(id!(input)).set_text(cx,&output.trim());
inner.label(id!(plain_text_message)).set_text(cx,&output.trim());
inner.markdown(id!(markdown_message)).set_text(cx,&output.trim());
inner.text_input(id!(input)).set_text(cx, &output.trim());
inner.label(id!(plain_text_message)).set_text(cx, &output.trim());
inner.markdown(id!(markdown_message)).set_text(cx, &output.trim());
} else {
inner.text_input(id!(input)).set_text(cx,text.trim());
inner.label(id!(plain_text_message)).set_text(cx,text.trim());
inner.markdown(id!(markdown_message)).set_text(cx,text.trim());
inner.text_input(id!(input)).set_text(cx, text.trim());
inner.label(id!(plain_text_message)).set_text(cx, text.trim());
inner.markdown(id!(markdown_message)).set_text(cx, text.trim());
}

// We know only AI assistant messages could be empty, so it is never
Expand Down
8 changes: 4 additions & 4 deletions src/chat/chat_panel.rs
Original file line number Diff line number Diff line change
Expand Up @@ -424,7 +424,7 @@ impl Widget for ChatPanel {
if self.focus_on_prompt_input_pending {
self.focus_on_prompt_input_pending = false;

self.prompt_input(id!(main_prompt_input)).reset_text(cx,true);
self.prompt_input(id!(main_prompt_input)).reset_text(cx, true);
}

let message_list_uid = self.portal_list(id!(chat)).widget_uid();
Expand Down Expand Up @@ -807,7 +807,7 @@ impl ChatPanel {
store.send_message_to_current_entity(prompt, regenerate_from);
}

self.prompt_input(id!(main_prompt_input)).reset_text(cx,false);
self.prompt_input(id!(main_prompt_input)).reset_text(cx, false);

// Scroll to the bottom when the message is sent
self.scroll_messages_to_bottom(cx);
Expand Down Expand Up @@ -847,7 +847,7 @@ impl ChatPanel {

empty_view
.label(id!(avatar_label))
.set_text(cx,&get_model_initial_letter(store).unwrap_or('A').to_string());
.set_text(cx, &get_model_initial_letter(store).unwrap_or('A').to_string());
}
}
}
Expand Down Expand Up @@ -920,7 +920,7 @@ impl ChatPanel {

let username = chat_line_data.username.as_ref().map_or("", String::as_str);
chat_line_item.set_sender_name(cx, &username);
chat_line_item.set_regenerate_button_visible(cx,false);
chat_line_item.set_regenerate_button_visible(cx, false);

match &chat_line_data.entity {
Some(ChatEntityId::Agent(agent_id)) => {
Expand Down
4 changes: 2 additions & 2 deletions src/chat/chat_params.rs
Original file line number Diff line number Diff line change
Expand Up @@ -275,10 +275,10 @@ impl Widget for ChatParams {
max_tokens.set_value(cx, ip.max_tokens as f64);
frequency_penalty.set_value(cx, ip.frequency_penalty as f64);
presence_penalty.set_value(cx, ip.presence_penalty as f64);
stop.set_text(cx,&ip.stop);
stop.set_text(cx, &ip.stop);

let system_prompt_value = chat.system_prompt.clone().unwrap_or_default();
system_prompt.set_text(cx,&system_prompt_value);
system_prompt.set_text(cx, &system_prompt_value);

// Currently, `selected` and `set_selected` interact with the animator of
// the widget to do what they do. To avoid some visual issues, we should not
Expand Down
2 changes: 1 addition & 1 deletion src/chat/delete_chat_modal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ impl Widget for DeleteChatModal {
chat_title
);
self.label(id!(wrapper.body.delete_prompt))
.set_text(cx,&prompt_text);
.set_text(cx, &prompt_text);

self.view
.draw_walk(cx, scope, walk.with_abs_pos(DVec2 { x: 0., y: 0. }))
Expand Down
8 changes: 4 additions & 4 deletions src/chat/entity_button.rs
Original file line number Diff line number Diff line change
Expand Up @@ -173,21 +173,21 @@ impl EntityButton {
let mut avatar = self.chat_agent_avatar(id!(agent_avatar));
let server_url = self.label(id!(server_url.label));

name_label.set_text(cx,&entity.name());
name_label.set_text(cx, &entity.name());

if let ChatEntityRef::Agent(agent) = entity {
avatar.set_visible(true);
avatar.set_agent(agent);
description_label.set_text(cx,&agent.description);
description_label.set_text(cx, &agent.description);

let formatted_server_url = agent.server_id.0
.strip_prefix("https://")
.or_else(|| agent.server_id.0.strip_prefix("http://"))
.unwrap_or(&agent.server_id.0);
server_url.set_text(cx,formatted_server_url);
server_url.set_text(cx, formatted_server_url);
} else {
avatar.set_visible(false);
description_label.set_text(cx,"");
description_label.set_text(cx, "");
}

self.entity = Some(entity.id());
Expand Down
2 changes: 1 addition & 1 deletion src/chat/model_selector.rs
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ impl Widget for ModelSelector {
self.view(id!(choose)).set_visible(cx, true);
self.view(id!(selected_agent)).set_visible(cx, false);
self.view(id!(selected_model)).set_visible(cx, false);
choose_label.set_text(cx,"Choose a Model or Agent");
choose_label.set_text(cx, "Choose a Model or Agent");
let color = vec3(0.0, 0.0, 0.0);
choose_label.apply_over(
cx,
Expand Down
8 changes: 4 additions & 4 deletions src/chat/prompt_input.rs
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ impl WidgetMatchEvent for PromptInput {
{
if idx == 0 {
let label = WidgetRef::new_from_ptr(cx, self.section_label_template);
label.set_text(cx,"Agents");
label.set_text(cx, "Agents");
prompt.add_unselectable_item(label);
}

Expand All @@ -271,7 +271,7 @@ impl WidgetMatchEvent for PromptInput {
{
if idx == 0 {
let label = WidgetRef::new_from_ptr(cx, self.section_label_template);
label.set_text(cx,"Models");
label.set_text(cx, "Models");
prompt.add_unselectable_item(label);
}

Expand Down Expand Up @@ -318,7 +318,7 @@ impl PromptInput {
match entity {
ChatEntityId::Agent(agent_id) => {
let agent = store.chats.get_agent_or_placeholder(agent_id);
label.set_text(cx,&agent.name);
label.set_text(cx, &agent.name);
agent_avatar.set_agent(agent);
}
ChatEntityId::ModelFile(file_id) => {
Expand All @@ -327,7 +327,7 @@ impl PromptInput {
.downloads
.get_file(file_id)
.expect("selected file not found");
label.set_text(cx,&file.name);
label.set_text(cx, &file.name);
agent_avatar.set_visible(false);
}
}
Expand Down
16 changes: 8 additions & 8 deletions src/landing/download_item.rs
Original file line number Diff line number Diff line change
Expand Up @@ -227,21 +227,21 @@ impl Widget for DownloadItem {
self.file_id = Some(download.file.id.clone());

self.label(id!(filename))
.set_text(cx,download.file.name.as_str());
.set_text(cx, download.file.name.as_str());

self.label(id!(architecture_tag.caption))
.set_text(cx,download.model.architecture.as_str());
.set_text(cx, download.model.architecture.as_str());

self.label(id!(params_size_tag.caption))
.set_text(cx,&&download.model.requires.as_str());
.set_text(cx, &&download.model.requires.as_str());

let progress_bar_width = download.progress * 6.0; // 6.0 = 600px / 100%
let label = self.label(id!(progress));
match download.status {
PendingDownloadsStatus::Initializing => {
let downloading_color = vec3(0.035, 0.572, 0.314); //#099250

label.set_text(cx,&format!("Downloading {:.1}%", download.progress));
label.set_text(cx, &format!("Downloading {:.1}%", download.progress));
label.apply_over(
cx,
live! { draw_text: { color: (downloading_color) }
Expand All @@ -264,7 +264,7 @@ impl Widget for DownloadItem {
PendingDownloadsStatus::Downloading => {
let downloading_color = vec3(0.035, 0.572, 0.314); //#099250

label.set_text(cx,&format!("Downloading {:.1}%", download.progress));
label.set_text(cx, &format!("Downloading {:.1}%", download.progress));
label.apply_over(
cx,
live! { draw_text: { color: (downloading_color) }
Expand All @@ -287,7 +287,7 @@ impl Widget for DownloadItem {
PendingDownloadsStatus::Paused => {
let paused_color = vec3(0.4, 0.44, 0.52); //#667085

label.set_text(cx,&format!("Paused {:.1}%", download.progress));
label.set_text(cx, &format!("Paused {:.1}%", download.progress));
label.apply_over(
cx,
live! { draw_text: { color: (paused_color) }
Expand All @@ -310,7 +310,7 @@ impl Widget for DownloadItem {
PendingDownloadsStatus::Error => {
let failed_color = vec3(0.7, 0.11, 0.09); // #B42318

label.set_text(cx,&format!("Error {:.1}%", download.progress));
label.set_text(cx, &format!("Error {:.1}%", download.progress));
label.apply_over(
cx,
live! { draw_text: { color: (failed_color) }
Expand All @@ -337,7 +337,7 @@ impl Widget for DownloadItem {
.unwrap_or("-".to_string());

self.label(id!(downloaded_size))
.set_text(cx,&format!("{} / {}", downloaded_size, total_size));
.set_text(cx, &format!("{} / {}", downloaded_size, total_size));

self.view.draw_walk(cx, scope, walk)
}
Expand Down
8 changes: 4 additions & 4 deletions src/landing/downloads.rs
Original file line number Diff line number Diff line change
Expand Up @@ -166,14 +166,14 @@ impl Widget for Downloads {
})
.count();
self.label(id!(downloading_count))
.set_text(cx,&format!("{} downloading", download_count));
.set_text(cx, &format!("{} downloading", download_count));

let paused_count = pending_downloads
.iter()
.filter(|d| matches!(d.status, PendingDownloadsStatus::Paused))
.count();
self.label(id!(paused_count))
.set_text(cx,&format!("{} paused", paused_count));
.set_text(cx, &format!("{} paused", paused_count));

let failed_count = pending_downloads
.iter()
Expand All @@ -182,9 +182,9 @@ impl Widget for Downloads {

if failed_count > 0 {
self.label(id!(failed_count))
.set_text(cx,&format!("{} failed", failed_count));
.set_text(cx, &format!("{} failed", failed_count));
} else {
self.label(id!(failed_count)).set_text(cx,"");
self.label(id!(failed_count)).set_text(cx, "");
}

while let Some(view_item) = self.view.draw_walk(cx, &mut Scope::empty(), walk).step() {
Expand Down
4 changes: 2 additions & 2 deletions src/landing/landing_screen.rs
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,9 @@ impl Widget for LandingScreen {
let models = &search.models;
let models_count = models.len();
self.label(id!(heading_with_filters.results))
.set_text(cx,&format!("{} Results", models_count));
.set_text(cx, &format!("{} Results", models_count));
self.label(id!(heading_with_filters.keyword))
.set_text(cx,&format!(" for \"{}\"", keyword));
.set_text(cx, &format!(" for \"{}\"", keyword));
} else {
self.view(id!(heading_with_filters)).set_visible(cx, false);
}
Expand Down
24 changes: 12 additions & 12 deletions src/landing/model_card.rs
Original file line number Diff line number Diff line change
Expand Up @@ -348,26 +348,26 @@ impl Widget for ModelCard {
self.model_id = model.model_id.clone();

let name = &model.name;
self.label(id!(model_name)).set_text(cx,name);
self.label(id!(model_name)).set_text(cx, name);

let download_count = &model.download_count;
self.label(id!(model_download_count.attr_value))
.set_text(cx,&format!("{}", download_count));
.set_text(cx, &format!("{}", download_count));

let like_count = &model.like_count;
self.label(id!(model_like_count.attr_value))
.set_text(cx,&format!("{}", like_count));
.set_text(cx, &format!("{}", like_count));

let size = &model.size;
self.label(id!(model_size_tag.attr_value)).set_text(cx,size);
self.label(id!(model_size_tag.attr_value)).set_text(cx, size);

let requires = &model.requires;
self.label(id!(model_requires_tag.attr_value))
.set_text(cx,requires);
.set_text(cx, requires);

let architecture = &model.architecture;
self.label(id!(model_architecture_tag.attr_value))
.set_text(cx,architecture);
.set_text(cx, architecture);

let summary = &model.summary;
const MAX_SUMMARY_LENGTH: usize = 500;
Expand All @@ -380,14 +380,14 @@ impl Widget for ModelCard {
} else {
summary.to_string()
};
self.label(id!(model_summary)).set_text(cx,&trimmed_summary);
self.label(id!(model_summary)).set_text(cx, &trimmed_summary);

let author_name = &model.author.name;
let author_url = &model.author.url;
let mut author_external_link = self.external_link(id!(author_link));
author_external_link
.link_label(id!(link))
.set_text(cx,author_name);
.set_text(cx, author_name);
author_external_link.set_url(author_url);

let model_hugging_face_url = hugging_face_model_url(&model.model_id);
Expand All @@ -396,11 +396,11 @@ impl Widget for ModelCard {

let author_description = &model.author.description;
self.label(id!(author_description))
.set_text(cx,author_description);
.set_text(cx, author_description);

let released_at_str = formatted_model_release_date(&model);
self.label(id!(model_released_at_tag.attr_value))
.set_text(cx,&released_at_str);
.set_text(cx, &released_at_str);

self.view.draw_walk(cx, scope, walk)
}
Expand Down Expand Up @@ -444,10 +444,10 @@ impl Widget for ModelCardViewAllModal {
let model = &scope.data.get::<ModelWithDownloadInfo>().unwrap();

let name = &model.name;
self.label(id!(view_all_model_name)).set_text(cx,name);
self.label(id!(view_all_model_name)).set_text(cx, name);

let summary = &model.summary;
self.label(id!(view_all_model_summary)).set_text(cx,summary);
self.label(id!(view_all_model_summary)).set_text(cx, summary);

self.view
.draw_walk(cx, scope, walk.with_abs_pos(DVec2 { x: 0., y: 0. }))
Expand Down
4 changes: 2 additions & 2 deletions src/landing/model_files.rs
Original file line number Diff line number Diff line change
Expand Up @@ -208,10 +208,10 @@ impl Widget for ModelFiles {
let featured_count = model.files.iter().filter(|f| f.file.featured).count();

let show_all_button = self.radio_button(id!(tab_buttons.show_all_button));
show_all_button.set_text(cx,&format!("All Files ({})", files_count));
show_all_button.set_text(cx, &format!("All Files ({})", files_count));

let show_all_button = self.radio_button(id!(tab_buttons.only_recommended_button));
show_all_button.set_text(cx,&format!("Only Recommended Files ({})", featured_count));
show_all_button.set_text(cx, &format!("Only Recommended Files ({})", featured_count));

let _ = self.view.draw_walk(cx, scope, walk);

Expand Down
Loading

0 comments on commit 8502b16

Please sign in to comment.