Skip to content

Commit 5ec35d1

Browse files
committed
Restore previous finger handling code in chat selector, after fixing issues in Makepad side
1 parent a29416b commit 5ec35d1

5 files changed

+82
-124
lines changed

Cargo.lock

+31-31
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/chat/chat_history_card.rs

-12
Original file line numberDiff line numberDiff line change
@@ -204,18 +204,6 @@ impl WidgetMatchEvent for ChatHistoryCard {
204204
);
205205
return;
206206
}
207-
208-
//if let Some(fe) = self.view(id!(content)).finger_down(actions) {
209-
// if fe.tap_count == 1 {
210-
// cx.widget_action(
211-
// widget_uid,
212-
// &scope.path,
213-
// ChatHistoryCardAction::ChatSelected(self.chat_id),
214-
// );
215-
// store.select_chat(self.chat_id);
216-
// self.redraw(cx);
217-
// }
218-
// }
219207
}
220208
}
221209

src/chat/chat_params.rs

+20-8
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,7 @@ live_design! {
170170
color: #000
171171
}
172172
text: "Stream"
173+
hover_actions_enabled: true
173174
}
174175
stream = <MoxinSwitch> {
175176
// Match the default value to avoid the animation on start.
@@ -201,6 +202,7 @@ live_design! {
201202
color: #000
202203
}
203204
text: "Stop"
205+
hover_actions_enabled: true
204206
}
205207
<ChatParamsTextInputWrapper> {
206208
height: 65,
@@ -262,6 +264,7 @@ live_design! {
262264
}
263265

264266
const TOOLTIP_OFFSET: DVec2 = DVec2 { x: -320.0, y: -30.0 };
267+
const TOOLTIP_OFFSET_BOTTOM: DVec2 = DVec2 { x: -320.0, y: -100.0 };
265268

266269
#[derive(Live, LiveHook, Widget)]
267270
pub struct ChatParams {
@@ -406,42 +409,49 @@ impl ChatParams {
406409
self.handle_tooltip_actions_for_slider(
407410
id!(temperature),
408411
"Influences the randomness of the model’s output. A higher value leads to more random and diverse responses, while a lower value produces more predictable outputs.".to_string(),
412+
TOOLTIP_OFFSET,
409413
cx, actions, scope
410414
);
411415

412416
self.handle_tooltip_actions_for_slider(
413417
id!(top_p),
414418
"Top P, also known as nucleus sampling, is another parameter that influences the randomness of LLM output. This parameter determines the threshold probability for including tokens in a candidate set used by the LLM to generate output. Lower values of this parameter result in more precise and fact-based responses from the LLM, while higher values increase randomness and diversity in the generated output.".to_string(),
419+
TOOLTIP_OFFSET,
415420
cx, actions, scope
416421
);
417422

418423
self.handle_tooltip_actions_for_label(
419424
id!(stream_label),
420425
"Streaming is the sending of words as they are created by the AI language model one at a time, so you can show them as they are being generated.".to_string(),
426+
TOOLTIP_OFFSET,
421427
cx, actions, scope
422428
);
423429

424430
self.handle_tooltip_actions_for_slider(
425431
id!(max_tokens),
426432
"The max tokens parameter sets the upper limit for the total number of tokens, encompassing both the input provided to the LLM as a prompt and the output tokens generated by the LLM in response to that prompt.".to_string(),
433+
TOOLTIP_OFFSET,
434+
cx, actions, scope
435+
);
436+
437+
self.handle_tooltip_actions_for_label(
438+
id!(stop_label),
439+
"Stop sequences are used to make the model stop generating tokens at a desired point, such as the end of a sentence or a list. The model response will not contain the stop sequence and you can pass up to four stop sequences.".to_string(),
440+
TOOLTIP_OFFSET,
427441
cx, actions, scope
428442
);
429443

430444
self.handle_tooltip_actions_for_slider(
431445
id!(frequency_penalty),
432446
"This parameter is used to discourage the model from repeating the same words or phrases too frequently within the generated text. It is a value that is added to the log-probability of a token each time it occurs in the generated text. A higher frequency_penalty value will result in the model being more conservative in its use of repeated tokens.".to_string(),
447+
TOOLTIP_OFFSET_BOTTOM,
433448
cx, actions, scope
434449
);
435450

436451
self.handle_tooltip_actions_for_slider(
437452
id!(presence_penalty),
438453
"This parameter is used to encourage the model to include a diverse range of tokens in the generated text. It is a value that is subtracted from the log-probability of a token each time it is generated. A higher presence_penalty value will result in the model being more likely to generate tokens that have not yet been included in the generated text.".to_string(),
439-
cx, actions, scope
440-
);
441-
442-
self.handle_tooltip_actions_for_label(
443-
id!(stop_label),
444-
"Stop sequences are used to make the model stop generating tokens at a desired point, such as the end of a sentence or a list. The model response will not contain the stop sequence and you can pass up to four stop sequences.".to_string(),
454+
TOOLTIP_OFFSET_BOTTOM,
445455
cx, actions, scope
446456
);
447457
}
@@ -450,6 +460,7 @@ impl ChatParams {
450460
&mut self,
451461
slider_id: &[LiveId],
452462
text: String,
463+
offset: DVec2,
453464
cx: &mut Cx,
454465
actions: &Actions,
455466
scope: &mut Scope,
@@ -460,7 +471,7 @@ impl ChatParams {
460471
cx.widget_action(
461472
widget_uid,
462473
&scope.path,
463-
TooltipAction::Show(text, rect.pos + TOOLTIP_OFFSET),
474+
TooltipAction::Show(text, rect.pos + offset),
464475
);
465476
}
466477
if slider.label_hover_out(&actions) {
@@ -472,6 +483,7 @@ impl ChatParams {
472483
&mut self,
473484
label_id: &[LiveId],
474485
text: String,
486+
offset: DVec2,
475487
cx: &mut Cx,
476488
actions: &Actions,
477489
scope: &mut Scope,
@@ -482,7 +494,7 @@ impl ChatParams {
482494
cx.widget_action(
483495
widget_uid,
484496
&scope.path,
485-
TooltipAction::Show(text, rect.pos + TOOLTIP_OFFSET),
497+
TooltipAction::Show(text, rect.pos + offset),
486498
);
487499
}
488500
if label.hover_out(&actions) {

0 commit comments

Comments
 (0)