pub struct PromptInput {
pub deref: View,
pub empty_text: String,
pub realtime_empty_text: String,
pub task: Task,
pub interactivity: Interactivity,
pub bot_capabilities: Option<BotCapabilities>,
}Expand description
A prepared text input for conversation with bots.
This is mostly a dummy widget. Prefer using and adapting crate::widgets::chat::Chat instead.
Fields§
§deref: View§empty_text: StringPlaceholder text shown when the input is empty.
realtime_empty_text: StringPlaceholder text shown when a realtime model is selected.
task: TaskIf this widget should provoke sending a message or stopping the current response.
interactivity: InteractivityIf this widget should be interactive or not.
bot_capabilities: Option<BotCapabilities>Capabilities of the currently selected bot
Implementations§
Source§impl PromptInput
impl PromptInput
Sourcepub fn reset(&mut self, cx: &mut Cx)
pub fn reset(&mut self, cx: &mut Cx)
Reset this prompt input erasing text, removing attachments, etc.
Sourcepub fn text_input_ref(&self, cx: &Cx) -> TextInputRef
pub fn text_input_ref(&self, cx: &Cx) -> TextInputRef
Returns a reference to the inner TextInput widget.
Sourcepub fn submitted(&self, cx: &Cx, actions: &Actions) -> bool
pub fn submitted(&self, cx: &Cx, actions: &Actions) -> bool
Check if the submit button or the return key was pressed.
Note: To know what the button submission means, check Self::task or the utility methods.
pub fn call_pressed(&self, cx: &Cx, actions: &Actions) -> bool
pub fn stt_pressed(&self, cx: &Cx, actions: &Actions) -> bool
Sourcepub fn has_send_task(&self) -> bool
pub fn has_send_task(&self) -> bool
Shorthand to check if Self::task is set to Task::Send.
Sourcepub fn has_stop_task(&self) -> bool
pub fn has_stop_task(&self) -> bool
Shorthand to check if Self::task is set to Task::Stop.
Sourcepub fn set_send(&mut self)
pub fn set_send(&mut self)
Shorthand to set Self::task to Task::Send.
Sourcepub fn set_stop(&mut self)
pub fn set_stop(&mut self)
Shorthand to set Self::task to Task::Stop.
Sourcepub fn set_chat_controller(
&mut self,
cx: &Cx,
controller: Option<Arc<Mutex<ChatController>>>,
)
pub fn set_chat_controller( &mut self, cx: &Cx, controller: Option<Arc<Mutex<ChatController>>>, )
Set the chat controller for the model selector
Sourcepub fn set_bot_capabilities(
&mut self,
cx: &mut Cx,
capabilities: Option<BotCapabilities>,
)
pub fn set_bot_capabilities( &mut self, cx: &mut Cx, capabilities: Option<BotCapabilities>, )
Set the capabilities of the currently selected bot
Sourcepub fn set_stt_visible(&mut self, cx: &mut Cx, visible: bool)
pub fn set_stt_visible(&mut self, cx: &mut Cx, visible: bool)
Set whether the speech-to-text button is visible.
Methods from Deref<Target = View>§
pub fn set_debug_dump(&mut self, cx: &mut Cx, debug: bool)
pub fn repaint(&mut self, cx: &mut Cx)
pub fn swap_child(&mut self, pos_a: usize, pos_b: usize)
pub fn child_index(&mut self, comp: &WidgetRef) -> Option<usize>
pub fn child_at_index(&mut self, index: usize) -> Option<&WidgetRef>
pub fn set_scroll_pos(&mut self, cx: &mut Cx, v: Vec2d)
pub fn area(&self) -> Area
pub fn walk_from_previous_size(&self, walk: Walk) -> Walk
pub fn child_count(&self) -> usize
pub fn debug_print_children(&self)
pub fn debug_props(&self) -> String
pub fn debug_dump_tree(&self, depth: usize) -> String
pub fn set_key_focus(&self, cx: &mut Cx)
Trait Implementations§
Source§impl Deref for PromptInput
impl Deref for PromptInput
Source§impl DerefMut for PromptInput
impl DerefMut for PromptInput
Source§impl ScriptApply for PromptInput
impl ScriptApply for PromptInput
fn script_type_id(&self) -> ScriptTypeId
fn script_apply( &mut self, vm: &mut ScriptVm<'_>, apply: &Apply, scope: &mut Scope<'_, '_>, value: ScriptValue, )
fn script_to_value(&self, vm: &mut ScriptVm<'_>) -> ScriptValue
fn script_to_value_props(&self, vm: &mut ScriptVm<'_>, obj: ScriptObject)
fn script_source(&self) -> ScriptObject
§fn script_apply_eval(&mut self, vm: &mut ScriptVm<'_>, script_mod: ScriptMod)
fn script_apply_eval(&mut self, vm: &mut ScriptVm<'_>, script_mod: ScriptMod)
__script_source__{...} and this method
sets __script_source__ on the scope to self.script_source() before evaluation.Source§impl ScriptHook for PromptInput
impl ScriptHook for PromptInput
fn on_after_new(&mut self, _vm: &mut ScriptVm<'_>)
fn on_before_apply( &mut self, _vm: &mut ScriptVm<'_>, _apply: &Apply, _scope: &mut Scope<'_, '_>, _value: ScriptValue, )
fn on_before_dispatch( &mut self, vm: &mut ScriptVm<'_>, apply: &Apply, scope: &mut Scope<'_, '_>, _value: ScriptValue, )
fn on_after_apply( &mut self, _vm: &mut ScriptVm<'_>, _apply: &Apply, _scope: &mut Scope<'_, '_>, _value: ScriptValue, )
fn on_after_dispatch( &mut self, vm: &mut ScriptVm<'_>, apply: &Apply, scope: &mut Scope<'_, '_>, _value: ScriptValue, )
fn on_custom_apply( &mut self, _vm: &mut ScriptVm<'_>, _apply: &Apply, _scope: &mut Scope<'_, '_>, _value: ScriptValue, ) -> bool
fn on_type_check(_heap: &ScriptHeap, _value: ScriptValue) -> bool
fn on_proto_build( _vm: &mut ScriptVm<'_>, _obj: ScriptObject, _props: &mut ScriptTypeProps, )
fn on_proto_methods(_vm: &mut ScriptVm<'_>, _obj: ScriptObject)
fn on_alive(&self)
fn on_before_new(&mut self, _vm: &mut ScriptVm<'_>)
fn on_before_reload(&mut self, _vm: &mut ScriptVm<'_>)
fn on_after_reload(&mut self, _vm: &mut ScriptVm<'_>)
fn on_before_new_scoped( &mut self, vm: &mut ScriptVm<'_>, _scope: &mut Scope<'_, '_>, )
fn on_before_reload_scoped( &mut self, vm: &mut ScriptVm<'_>, _scope: &mut Scope<'_, '_>, )
fn on_after_new_scoped( &mut self, vm: &mut ScriptVm<'_>, _scope: &mut Scope<'_, '_>, )
fn on_after_reload_scoped( &mut self, vm: &mut ScriptVm<'_>, _scope: &mut Scope<'_, '_>, )
Source§impl ScriptHookDeref for PromptInput
impl ScriptHookDeref for PromptInput
fn on_deref_before_apply( &mut self, vm: &mut ScriptVm<'_>, apply: &Apply, scope: &mut Scope<'_, '_>, value: ScriptValue, )
fn on_deref_after_apply( &mut self, vm: &mut ScriptVm<'_>, apply: &Apply, scope: &mut Scope<'_, '_>, value: ScriptValue, )
Source§impl ScriptNew for PromptInput
impl ScriptNew for PromptInput
fn script_type_id_static() -> ScriptTypeId
Source§fn script_type_name() -> Option<LiveId>
fn script_type_name() -> Option<LiveId>
fn script_new(vm: &mut ScriptVm<'_>) -> Self
fn script_proto_props( vm: &mut ScriptVm<'_>, obj: ScriptObject, props: &mut ScriptTypeProps, )
§fn is_repr_u32_enum() -> bool
fn is_repr_u32_enum() -> bool
repr(u32) enum.
Override in derive macro for enums with discriminants.
Used by shader compiler to treat the enum as u32.fn script_type_check(heap: &ScriptHeap, value: ScriptValue) -> bool
§fn script_pod(vm: &mut ScriptVm<'_>) -> Option<ScriptPodType>where
Self: Sized,
fn script_pod(vm: &mut ScriptVm<'_>) -> Option<ScriptPodType>where
Self: Sized,
fn script_default(vm: &mut ScriptVm<'_>) -> ScriptValuewhere
Self: Sized,
fn script_reload_default(vm: &mut ScriptVm<'_>) -> ScriptValuewhere
Self: Sized,
fn script_new_with_default(vm: &mut ScriptVm<'_>) -> Selfwhere
Self: Sized,
fn from_script_mod(
vm: &mut ScriptVm<'_>,
f: fn(&mut ScriptVm<'_>) -> ScriptValue,
) -> Selfwhere
Self: Sized,
fn script_from_value(vm: &mut ScriptVm<'_>, value: ScriptValue) -> Selfwhere
Self: Sized,
fn script_from_value_scoped(
vm: &mut ScriptVm<'_>,
scope: &mut Scope<'_, '_>,
value: ScriptValue,
) -> Selfwhere
Self: Sized,
fn script_proto(vm: &mut ScriptVm<'_>) -> ScriptValue
fn script_proto_build( vm: &mut ScriptVm<'_>, props: &mut ScriptTypeProps, ) -> ScriptValue
fn script_api(vm: &mut ScriptVm<'_>) -> ScriptValue
fn script_component(vm: &mut ScriptVm<'_>) -> ScriptValue
fn script_shader(vm: &mut ScriptVm<'_>) -> ScriptValue
fn script_ext(vm: &mut ScriptVm<'_>) -> ScriptValue
fn script_enum_lookup_variant( vm: &mut ScriptVm<'_>, variant: LiveId, ) -> ScriptValue
Source§impl Widget for PromptInput
impl Widget for PromptInput
fn set_text(&mut self, cx: &mut Cx, v: &str)
fn text(&self) -> String
fn handle_event( &mut self, cx: &mut Cx, event: &Event, scope: &mut Scope<'_, '_>, )
fn draw_walk( &mut self, cx: &mut Cx2d<'_, '_>, scope: &mut Scope<'_, '_>, walk: Walk, ) -> DrawStep
fn handle_event_with( &mut self, cx: &mut Cx, event: &Event, scope: &mut Scope<'_, '_>, _sweep_area: Area, )
fn script_call( &mut self, _vm: &mut ScriptVm<'_>, _method: LiveId, _args: ScriptValue, ) -> ScriptAsyncResult
fn script_result( &mut self, _vm: &mut ScriptVm<'_>, _id: ScriptAsyncId, _result: ScriptValue, )
§fn is_interactive(&self) -> bool
fn is_interactive(&self) -> bool
fn widget(&self, cx: &Cx, path: &[LiveId]) -> WidgetRef
fn widgets(&self, cx: &Cx, paths: &[&[LiveId]]) -> WidgetSet
§fn widget_flood(&self, cx: &Cx, path: &[LiveId]) -> WidgetRef
fn widget_flood(&self, cx: &Cx, path: &[LiveId]) -> WidgetRef
§fn widgets_flood(&self, cx: &Cx, paths: &[&[LiveId]]) -> WidgetSet
fn widgets_flood(&self, cx: &Cx, paths: &[&[LiveId]]) -> WidgetSet
fn draw_3d( &mut self, _cx: &mut Cx3d<'_, '_>, _scope: &mut Scope<'_, '_>, ) -> Result<(), WidgetRef>
fn draw_3d_all(&mut self, cx: &mut Cx3d<'_, '_>, scope: &mut Scope<'_, '_>)
fn draw( &mut self, cx: &mut Cx2d<'_, '_>, scope: &mut Scope<'_, '_>, ) -> Result<(), WidgetRef>
fn draw_walk_all( &mut self, cx: &mut Cx2d<'_, '_>, scope: &mut Scope<'_, '_>, walk: Walk, )
fn draw_all(&mut self, cx: &mut Cx2d<'_, '_>, scope: &mut Scope<'_, '_>)
fn draw_unscoped(&mut self, cx: &mut Cx2d<'_, '_>) -> Result<(), WidgetRef>
fn draw_all_unscoped(&mut self, cx: &mut Cx2d<'_, '_>)
fn set_key_focus(&self, cx: &mut Cx)
fn key_focus(&self, cx: &Cx) -> bool
fn set_disabled(&mut self, _cx: &mut Cx, _disabled: bool)
fn disabled(&self, _cx: &Cx) -> bool
fn ref_cast_type_id(&self) -> TypeIdwhere
Self: 'static,
fn ui_runner(&self) -> UiRunner<Self>where
Self: Sized + 'static,
Source§impl WidgetNode for PromptInput
impl WidgetNode for PromptInput
fn widget_uid(&self) -> WidgetUid
fn visible(&self) -> bool
fn set_visible(&mut self, cx: &mut Cx, visible: bool)
fn area(&self) -> Area
fn walk(&mut self, cx: &mut Cx) -> Walk
fn redraw(&mut self, cx: &mut Cx)
Source§fn children(&self, visit: &mut dyn FnMut(LiveId, WidgetRef))
fn children(&self, visit: &mut dyn FnMut(LiveId, WidgetRef))
Source§fn skip_widget_tree_search(&self) -> bool
fn skip_widget_tree_search(&self) -> bool
Source§fn find_widgets_from_point(
&self,
cx: &Cx,
point: DVec2,
found: &mut dyn FnMut(&WidgetRef),
)
fn find_widgets_from_point( &self, cx: &Cx, point: DVec2, found: &mut dyn FnMut(&WidgetRef), )
fn selection_text_len(&self) -> usize
fn selection_point_to_char_index(&self, cx: &Cx, abs: DVec2) -> Option<usize>
fn selection_set(&mut self, anchor: usize, cursor: usize)
fn selection_clear(&mut self)
fn selection_select_all(&mut self)
fn selection_get_text_for_range(&self, start: usize, end: usize) -> String
fn selection_get_full_text(&self) -> String
§fn child_by_path(&self, path: &[LiveId]) -> WidgetRef
fn child_by_path(&self, path: &[LiveId]) -> WidgetRef
children().
Each segment is matched anywhere in the current subtree, i.e.
a.b behaves like *.a.*.b.fn child(&self, id: LiveId) -> WidgetRef
§fn find_interactive_widget_from_point(
&self,
cx: &Cx,
point: Vec2d,
) -> Option<WidgetRef>
fn find_interactive_widget_from_point( &self, cx: &Cx, point: Vec2d, ) -> Option<WidgetRef>
§fn point_hits_area(&self, cx: &Cx, point: Vec2d) -> bool
fn point_hits_area(&self, cx: &Cx, point: Vec2d) -> bool
fn set_action_data(&mut self, _data: Arc<dyn ActionTrait>)
fn action_data(&self) -> Option<Arc<dyn ActionTrait>>
fn cast_inner_any(&self, _type_id: TypeId) -> Option<&(dyn Any + 'static)>
fn cast_inner_any_mut( &mut self, _type_id: TypeId, ) -> Option<&mut (dyn Any + 'static)>
fn script_call_live( &mut self, _vm: &mut ScriptVm<'_>, _method: LiveId, _args: ScriptValue, ) -> ScriptAsyncResult
fn script_result_live( &mut self, _vm: &mut ScriptVm<'_>, _id: ScriptAsyncId, _result: ScriptValue, )
Source§impl WidgetRegister for PromptInput
impl WidgetRegister for PromptInput
fn register_widget(vm: &mut ScriptVm<'_>) -> ScriptValue
impl ScriptDeriveMarker for PromptInput
Auto Trait Implementations§
impl Freeze for PromptInput
impl !RefUnwindSafe for PromptInput
impl !Send for PromptInput
impl !Sync for PromptInput
impl Unpin for PromptInput
impl !UnwindSafe for PromptInput
Blanket Implementations§
§impl<T> AdaptiveViewWidgetExt for Twhere
T: Widget,
impl<T> AdaptiveViewWidgetExt for Twhere
T: Widget,
fn adaptive_view(&self, cx: &Cx, path: &[LiveId]) -> AdaptiveViewRef
§impl<T> AreaChartSetWidgetExt for Twhere
T: Widget,
impl<T> AreaChartSetWidgetExt for Twhere
T: Widget,
fn area_chart_set(&self, cx: &Cx, paths: &[&[LiveId]]) -> AreaChartSet
§impl<T> AreaChartWidgetExt for Twhere
T: Widget,
impl<T> AreaChartWidgetExt for Twhere
T: Widget,
fn area_chart(&self, cx: &Cx, path: &[LiveId]) -> AreaChartRef
§impl<T> BarChartSetWidgetExt for Twhere
T: Widget,
impl<T> BarChartSetWidgetExt for Twhere
T: Widget,
fn bar_chart_set(&self, cx: &Cx, paths: &[&[LiveId]]) -> BarChartSet
§impl<T> BarChartWidgetExt for Twhere
T: Widget,
impl<T> BarChartWidgetExt for Twhere
T: Widget,
§impl<T> BareStepSetWidgetExt for Twhere
T: Widget,
impl<T> BareStepSetWidgetExt for Twhere
T: Widget,
fn bare_step_set(&self, cx: &Cx, paths: &[&[LiveId]]) -> BareStepSet
§impl<T> BareStepWidgetExt for Twhere
T: Widget,
impl<T> BareStepWidgetExt for Twhere
T: Widget,
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<T> BrowserSetWidgetExt for Twhere
T: Widget,
impl<T> BrowserSetWidgetExt for Twhere
T: Widget,
fn browser_set(&self, cx: &Cx, paths: &[&[LiveId]]) -> BrowserSet
§impl<T> BrowserWidgetExt for Twhere
T: Widget,
impl<T> BrowserWidgetExt for Twhere
T: Widget,
§impl<T> ButtonSetWidgetExt for Twhere
T: Widget,
impl<T> ButtonSetWidgetExt for Twhere
T: Widget,
§impl<T> ButtonWidgetExt for Twhere
T: Widget,
impl<T> ButtonWidgetExt for Twhere
T: Widget,
§impl<T> CachedWidgetWidgetExt for Twhere
T: Widget,
impl<T> CachedWidgetWidgetExt for Twhere
T: Widget,
fn cached_widget(&self, cx: &Cx, path: &[LiveId]) -> CachedWidgetRef
§impl<T> CalloutTooltipSetWidgetExt for Twhere
T: Widget,
impl<T> CalloutTooltipSetWidgetExt for Twhere
T: Widget,
fn callout_tooltip_set(&self, cx: &Cx, paths: &[&[LiveId]]) -> CalloutTooltipSet
§impl<T> CalloutTooltipWidgetExt for Twhere
T: Widget,
impl<T> CalloutTooltipWidgetExt for Twhere
T: Widget,
fn callout_tooltip(&self, cx: &Cx, path: &[LiveId]) -> CalloutTooltipRef
§impl<T> CandlestickChartSetWidgetExt for Twhere
T: Widget,
impl<T> CandlestickChartSetWidgetExt for Twhere
T: Widget,
fn candlestick_chart_set( &self, cx: &Cx, paths: &[&[LiveId]], ) -> CandlestickChartSet
§impl<T> CandlestickChartWidgetExt for Twhere
T: Widget,
impl<T> CandlestickChartWidgetExt for Twhere
T: Widget,
fn candlestick_chart(&self, cx: &Cx, path: &[LiveId]) -> CandlestickChartRef
§impl<T> ChartViewSetWidgetExt for Twhere
T: Widget,
impl<T> ChartViewSetWidgetExt for Twhere
T: Widget,
fn chart_view_set(&self, cx: &Cx, paths: &[&[LiveId]]) -> ChartViewSet
§impl<T> ChartViewWidgetExt for Twhere
T: Widget,
impl<T> ChartViewWidgetExt for Twhere
T: Widget,
fn chart_view(&self, cx: &Cx, path: &[LiveId]) -> ChartViewRef
Source§impl<T> ChatSetWidgetExt for Twhere
T: Widget,
impl<T> ChatSetWidgetExt for Twhere
T: Widget,
Source§impl<T> ChatWidgetExt for Twhere
T: Widget,
impl<T> ChatWidgetExt for Twhere
T: Widget,
§impl<T> CheckBoxSetWidgetExt for Twhere
T: Widget,
impl<T> CheckBoxSetWidgetExt for Twhere
T: Widget,
fn check_box_set(&self, cx: &Cx, paths: &[&[LiveId]]) -> CheckBoxSet
§impl<T> CheckBoxWidgetExt for Twhere
T: Widget,
impl<T> CheckBoxWidgetExt for Twhere
T: Widget,
Source§impl<T> CitationListSetWidgetExt for Twhere
T: Widget,
impl<T> CitationListSetWidgetExt for Twhere
T: Widget,
fn citation_list_set(&self, cx: &Cx, paths: &[&[LiveId]]) -> CitationListSet
Source§impl<T> CitationListWidgetExt for Twhere
T: Widget,
impl<T> CitationListWidgetExt for Twhere
T: Widget,
fn citation_list(&self, cx: &Cx, path: &[LiveId]) -> CitationListRef
§impl<T> CodeViewSetWidgetExt for Twhere
T: Widget,
impl<T> CodeViewSetWidgetExt for Twhere
T: Widget,
fn code_view_set(&self, cx: &Cx, paths: &[&[LiveId]]) -> CodeViewSet
§impl<T> CodeViewWidgetExt for Twhere
T: Widget,
impl<T> CodeViewWidgetExt for Twhere
T: Widget,
§impl<T> CommandTextInputSetWidgetExt for Twhere
T: Widget,
impl<T> CommandTextInputSetWidgetExt for Twhere
T: Widget,
fn command_text_input_set( &self, cx: &Cx, paths: &[&[LiveId]], ) -> CommandTextInputSet
§impl<T> CommandTextInputWidgetExt for Twhere
T: Widget,
impl<T> CommandTextInputWidgetExt for Twhere
T: Widget,
fn command_text_input(&self, cx: &Cx, path: &[LiveId]) -> CommandTextInputRef
§impl<T> DesktopButtonSetWidgetExt for Twhere
T: Widget,
impl<T> DesktopButtonSetWidgetExt for Twhere
T: Widget,
§impl<T> DesktopButtonWidgetExt for Twhere
T: Widget,
impl<T> DesktopButtonWidgetExt for Twhere
T: Widget,
§impl<T> DockSetWidgetExt for Twhere
T: Widget,
impl<T> DockSetWidgetExt for Twhere
T: Widget,
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.