mirror of
https://github.com/AppFlowy-IO/AppFlowy.git
synced 2024-08-30 18:12:39 +00:00
* chore: load plugin * chore: sidecar * chore: fix test * chore: clippy * chore: save chat config * chore: arc plugin * chore: add plugins * chore: clippy * chore: test streaming * chore: config chat * chore: stream message * chore: response with local ai * chore: fix compile * chore: config ui * chore: fix load plugin * chore: add docs * chore: update docs * chore: disable local ai * chore: fix compile * chore: clippy
32 lines
859 B
Rust
32 lines
859 B
Rust
use std::sync::Weak;
|
|
|
|
use strum_macros::Display;
|
|
|
|
use flowy_derive::{Flowy_Event, ProtoBuf_Enum};
|
|
use flowy_sqlite::kv::KVStorePreferences;
|
|
use lib_dispatch::prelude::AFPlugin;
|
|
|
|
use crate::event_handler::*;
|
|
|
|
pub fn init(store_preferences: Weak<KVStorePreferences>) -> AFPlugin {
|
|
AFPlugin::new()
|
|
.name(env!("CARGO_PKG_NAME"))
|
|
.state(store_preferences)
|
|
.event(ConfigEvent::SetKeyValue, set_key_value_handler)
|
|
.event(ConfigEvent::GetKeyValue, get_key_value_handler)
|
|
.event(ConfigEvent::RemoveKeyValue, remove_key_value_handler)
|
|
}
|
|
|
|
#[derive(Debug, Clone, PartialEq, Eq, Hash, Display, ProtoBuf_Enum, Flowy_Event)]
|
|
#[event_err = "FlowyError"]
|
|
pub enum ConfigEvent {
|
|
#[event(input = "KeyValuePB")]
|
|
SetKeyValue = 0,
|
|
|
|
#[event(input = "KeyPB", output = "KeyValuePB")]
|
|
GetKeyValue = 1,
|
|
|
|
#[event(input = "KeyPB")]
|
|
RemoveKeyValue = 2,
|
|
}
|