mirror of
https://github.com/AppFlowy-IO/AppFlowy.git
synced 2025-07-24 09:26:49 +00:00

* chore: ai type * chore: use patch to fix version issue * chore: update * chore: update * chore: integrate client api * chore: add schema * chore: setup event * chore: add event test * chore: add test * chore: update test * chore: load chat message * chore: load chat message * chore: chat ui * chore: disable create chat * chore: update client api * chore: disable chat * chore: ui theme * chore: ui theme * chore: copy message * chore: fix test * chore: show error * chore: update bloc * chore: update test * chore: lint * chore: icon * chore: hover * chore: show unsupported page * chore: adjust mobile ui * chore: adjust view title bar * chore: return related question * chore: error page * chore: error page * chore: code format * chore: prompt * chore: fix test * chore: ui adjust * chore: disable create chat * chore: add loading page * chore: fix test * chore: disable chat action * chore: add maximum text limit
67 lines
1.9 KiB
Rust
67 lines
1.9 KiB
Rust
use client_api::entity::ai_dto::RepeatedRelatedQuestion;
|
|
use client_api::entity::{ChatMessageType, MessageCursor, RepeatedChatMessage};
|
|
use flowy_chat_pub::cloud::{ChatCloudService, ChatMessage, ChatMessageStream};
|
|
use flowy_error::FlowyError;
|
|
use lib_infra::async_trait::async_trait;
|
|
use lib_infra::future::FutureResult;
|
|
|
|
pub(crate) struct DefaultChatCloudServiceImpl;
|
|
|
|
#[async_trait]
|
|
impl ChatCloudService for DefaultChatCloudServiceImpl {
|
|
fn create_chat(
|
|
&self,
|
|
_uid: &i64,
|
|
_workspace_id: &str,
|
|
_chat_id: &str,
|
|
) -> FutureResult<(), FlowyError> {
|
|
FutureResult::new(async move {
|
|
Err(FlowyError::not_support().with_context("Chat is not supported in local server."))
|
|
})
|
|
}
|
|
|
|
async fn send_chat_message(
|
|
&self,
|
|
_workspace_id: &str,
|
|
_chat_id: &str,
|
|
_message: &str,
|
|
_message_type: ChatMessageType,
|
|
) -> Result<ChatMessageStream, FlowyError> {
|
|
Err(FlowyError::not_support().with_context("Chat is not supported in local server."))
|
|
}
|
|
|
|
fn get_chat_messages(
|
|
&self,
|
|
_workspace_id: &str,
|
|
_chat_id: &str,
|
|
_offset: MessageCursor,
|
|
_limit: u64,
|
|
) -> FutureResult<RepeatedChatMessage, FlowyError> {
|
|
FutureResult::new(async move {
|
|
Err(FlowyError::not_support().with_context("Chat is not supported in local server."))
|
|
})
|
|
}
|
|
|
|
fn get_related_message(
|
|
&self,
|
|
_workspace_id: &str,
|
|
_chat_id: &str,
|
|
_message_id: i64,
|
|
) -> FutureResult<RepeatedRelatedQuestion, FlowyError> {
|
|
FutureResult::new(async move {
|
|
Err(FlowyError::not_support().with_context("Chat is not supported in local server."))
|
|
})
|
|
}
|
|
|
|
fn generate_answer(
|
|
&self,
|
|
_workspace_id: &str,
|
|
_chat_id: &str,
|
|
_question_message_id: i64,
|
|
) -> FutureResult<ChatMessage, FlowyError> {
|
|
FutureResult::new(async move {
|
|
Err(FlowyError::not_support().with_context("Chat is not supported in local server."))
|
|
})
|
|
}
|
|
}
|