pub struct HotReloadableRhaiPromptPlugin { /* private fields */ }Expand description
支持热重载的 Rhai 脚本 Prompt 模板插件
Implementations§
Source§impl HotReloadableRhaiPromptPlugin
impl HotReloadableRhaiPromptPlugin
Sourcepub async fn new(script_path: impl AsRef<Path>) -> HotReloadableRhaiPromptPlugin
pub async fn new(script_path: impl AsRef<Path>) -> HotReloadableRhaiPromptPlugin
创建新的支持热重载的 Prompt 模板插件
Sourcepub async fn start_reload_watcher(&self)
pub async fn start_reload_watcher(&self)
启动热重载监听
Sourcepub async fn stop_reload_watcher(&self)
pub async fn stop_reload_watcher(&self)
停止热重载监听
Sourcepub async fn inner(&self) -> Arc<RwLock<RhaiScriptPromptPlugin>>
pub async fn inner(&self) -> Arc<RwLock<RhaiScriptPromptPlugin>>
获取内部插件实例
Sourcepub async fn set_active_scenario(&self, scenario: impl Into<String>)
pub async fn set_active_scenario(&self, scenario: impl Into<String>)
设置当前活动的场景
Trait Implementations§
Source§impl PromptTemplatePlugin for HotReloadableRhaiPromptPlugin
impl PromptTemplatePlugin for HotReloadableRhaiPromptPlugin
Source§fn get_prompt_template<'life0, 'life1, 'async_trait>(
&'life0 self,
scenario: &'life1 str,
) -> Pin<Box<dyn Future<Output = Option<Arc<PromptTemplate>>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
HotReloadableRhaiPromptPlugin: 'async_trait,
fn get_prompt_template<'life0, 'life1, 'async_trait>(
&'life0 self,
scenario: &'life1 str,
) -> Pin<Box<dyn Future<Output = Option<Arc<PromptTemplate>>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
HotReloadableRhaiPromptPlugin: 'async_trait,
获取当前场景的 Prompt 模板
Source§fn get_active_scenario<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = String> + Send + 'async_trait>>where
'life0: 'async_trait,
HotReloadableRhaiPromptPlugin: 'async_trait,
fn get_active_scenario<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = String> + Send + 'async_trait>>where
'life0: 'async_trait,
HotReloadableRhaiPromptPlugin: 'async_trait,
获取当前活动场景
Source§fn set_active_scenario<'life0, 'life1, 'async_trait>(
&'life0 self,
scenario: &'life1 str,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
HotReloadableRhaiPromptPlugin: 'async_trait,
fn set_active_scenario<'life0, 'life1, 'async_trait>(
&'life0 self,
scenario: &'life1 str,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
HotReloadableRhaiPromptPlugin: 'async_trait,
设置当前活动的场景
Source§fn get_available_scenarios<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Vec<String>> + Send + 'async_trait>>where
'life0: 'async_trait,
HotReloadableRhaiPromptPlugin: 'async_trait,
fn get_available_scenarios<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Vec<String>> + Send + 'async_trait>>where
'life0: 'async_trait,
HotReloadableRhaiPromptPlugin: 'async_trait,
获取所有可用的场景
Source§fn refresh_templates<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
HotReloadableRhaiPromptPlugin: 'async_trait,
fn refresh_templates<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
HotReloadableRhaiPromptPlugin: 'async_trait,
刷新模板
Source§fn get_current_template<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Option<Arc<PromptTemplate>>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
fn get_current_template<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Option<Arc<PromptTemplate>>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
获取当前活动场景的模板
Auto Trait Implementations§
impl Freeze for HotReloadableRhaiPromptPlugin
impl !RefUnwindSafe for HotReloadableRhaiPromptPlugin
impl Send for HotReloadableRhaiPromptPlugin
impl Sync for HotReloadableRhaiPromptPlugin
impl Unpin for HotReloadableRhaiPromptPlugin
impl UnsafeUnpin for HotReloadableRhaiPromptPlugin
impl !UnwindSafe for HotReloadableRhaiPromptPlugin
Blanket Implementations§
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
Mutably borrows from an owned value. Read more
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> Message for T
impl<T> Message for T
Source§fn from_boxed(m: BoxedMessage) -> Result<Self, BoxedDowncastErr>
fn from_boxed(m: BoxedMessage) -> Result<Self, BoxedDowncastErr>
Convert a BoxedMessage to this concrete type
Source§fn box_message(self, pid: &ActorId) -> Result<BoxedMessage, BoxedDowncastErr>
fn box_message(self, pid: &ActorId) -> Result<BoxedMessage, BoxedDowncastErr>
Convert this message to a BoxedMessage