assistant: Add support for claude-3-7-sonnet-thinking
(#27085)
Closes #25671 Release Notes: - Added support for `claude-3-7-sonnet-thinking` in the assistant panel --------- Co-authored-by: Danilo Leal <daniloleal09@gmail.com> Co-authored-by: Antonio Scandurra <me@as-cii.com> Co-authored-by: Agus Zubiaga <hi@aguz.me>
This commit is contained in:
parent
2ffce4f516
commit
a709d4c7c6
16 changed files with 1212 additions and 177 deletions
|
@ -1240,20 +1240,11 @@ impl Element for Div {
|
|||
let mut state = scroll_handle.0.borrow_mut();
|
||||
state.child_bounds = Vec::with_capacity(request_layout.child_layout_ids.len());
|
||||
state.bounds = bounds;
|
||||
let requested = state.requested_scroll_top.take();
|
||||
|
||||
for (ix, child_layout_id) in request_layout.child_layout_ids.iter().enumerate() {
|
||||
for child_layout_id in &request_layout.child_layout_ids {
|
||||
let child_bounds = window.layout_bounds(*child_layout_id);
|
||||
child_min = child_min.min(&child_bounds.origin);
|
||||
child_max = child_max.max(&child_bounds.bottom_right());
|
||||
state.child_bounds.push(child_bounds);
|
||||
|
||||
if let Some(requested) = requested.as_ref() {
|
||||
if requested.0 == ix {
|
||||
*state.offset.borrow_mut() =
|
||||
bounds.origin - (child_bounds.origin - point(px(0.), requested.1));
|
||||
}
|
||||
}
|
||||
}
|
||||
(child_max - child_min).into()
|
||||
} else {
|
||||
|
@ -1528,8 +1519,11 @@ impl Interactivity {
|
|||
_cx: &mut App,
|
||||
) -> Point<Pixels> {
|
||||
if let Some(scroll_offset) = self.scroll_offset.as_ref() {
|
||||
let mut scroll_to_bottom = false;
|
||||
if let Some(scroll_handle) = &self.tracked_scroll_handle {
|
||||
scroll_handle.0.borrow_mut().overflow = style.overflow;
|
||||
let mut state = scroll_handle.0.borrow_mut();
|
||||
state.overflow = style.overflow;
|
||||
scroll_to_bottom = mem::take(&mut state.scroll_to_bottom);
|
||||
}
|
||||
|
||||
let rem_size = window.rem_size();
|
||||
|
@ -1555,8 +1549,14 @@ impl Interactivity {
|
|||
// Clamp scroll offset in case scroll max is smaller now (e.g., if children
|
||||
// were removed or the bounds became larger).
|
||||
let mut scroll_offset = scroll_offset.borrow_mut();
|
||||
|
||||
scroll_offset.x = scroll_offset.x.clamp(-scroll_max.width, px(0.));
|
||||
scroll_offset.y = scroll_offset.y.clamp(-scroll_max.height, px(0.));
|
||||
if scroll_to_bottom {
|
||||
scroll_offset.y = -scroll_max.height;
|
||||
} else {
|
||||
scroll_offset.y = scroll_offset.y.clamp(-scroll_max.height, px(0.));
|
||||
}
|
||||
|
||||
*scroll_offset
|
||||
} else {
|
||||
Point::default()
|
||||
|
@ -2861,12 +2861,13 @@ impl ScrollAnchor {
|
|||
});
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Default, Debug)]
|
||||
struct ScrollHandleState {
|
||||
offset: Rc<RefCell<Point<Pixels>>>,
|
||||
bounds: Bounds<Pixels>,
|
||||
child_bounds: Vec<Bounds<Pixels>>,
|
||||
requested_scroll_top: Option<(usize, Pixels)>,
|
||||
scroll_to_bottom: bool,
|
||||
overflow: Point<Overflow>,
|
||||
}
|
||||
|
||||
|
@ -2955,6 +2956,12 @@ impl ScrollHandle {
|
|||
}
|
||||
}
|
||||
|
||||
/// Scrolls to the bottom.
|
||||
pub fn scroll_to_bottom(&self) {
|
||||
let mut state = self.0.borrow_mut();
|
||||
state.scroll_to_bottom = true;
|
||||
}
|
||||
|
||||
/// Set the offset explicitly. The offset is the distance from the top left of the
|
||||
/// parent container to the top left of the first child.
|
||||
/// As you scroll further down the offset becomes more negative.
|
||||
|
@ -2978,11 +2985,6 @@ impl ScrollHandle {
|
|||
}
|
||||
}
|
||||
|
||||
/// Set the logical scroll top, based on a child index and a pixel offset.
|
||||
pub fn set_logical_scroll_top(&self, ix: usize, px: Pixels) {
|
||||
self.0.borrow_mut().requested_scroll_top = Some((ix, px));
|
||||
}
|
||||
|
||||
/// Get the count of children for scrollable item.
|
||||
pub fn children_count(&self) -> usize {
|
||||
self.0.borrow().child_bounds.len()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue