refactor: remove websocket_session_id from message request (#206)

* refactor: remove websocket_session_id from message request

* chore: update relese notes
This commit is contained in:
Medcl
2025-02-26 12:48:54 +08:00
committed by GitHub
parent 7734954edf
commit afa15f75a1
4 changed files with 565 additions and 575 deletions

View File

@@ -23,6 +23,8 @@ Information about release notes of Coco Server is provided here.
- Init icons in background during start #176
- Refactoring health api #187
- Refactoring assistant api #195
- Refactor: remove websocket_session_id from message request #206

View File

@@ -157,7 +157,6 @@ pub async fn send_message<R: Runtime>(
app_handle: AppHandle<R>,
server_id: String,
session_id: String,
websocket_id: String,
message: String,
query_params: Option<HashMap<String, String>>, //search,deep_thinking
) -> Result<String, String> {
@@ -165,19 +164,17 @@ pub async fn send_message<R: Runtime>(
let msg = ChatRequestMessage {
message: Some(message),
};
let mut headers = HashMap::new();
headers.insert("WEBSOCKET-SESSION-ID".to_string(), websocket_id);
let body = reqwest::Body::from(serde_json::to_string(&msg).unwrap());
let response = HttpClient::advanced_post(
&server_id,
path.as_str(),
Some(headers),
None,
query_params,
Some(body),
)
.await
.map_err(|e| format!("Error cancel session: {}", e))?;
.await
.map_err(|e| format!("Error cancel session: {}", e))?;
handle_raw_response(response).await?
}

View File

@@ -1,10 +1,11 @@
use serde::{Deserialize, Serialize};
use crate::common::connector::Connector;
use serde::{Deserialize, Serialize};
// The DataSource struct representing a datasource, which includes the Connector
#[derive(Debug,Clone, Serialize, Deserialize)]
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct DataSource {
pub id: String,
pub icon: Option<String>,
pub created: Option<String>,
pub updated: Option<String>,
pub r#type: Option<String>, // Using 'r#type' to escape the reserved keyword 'type'
@@ -13,7 +14,7 @@ pub struct DataSource {
pub connector_info: Option<Connector>,
}
#[derive(Debug,Clone, Serialize, Deserialize)]
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct ConnectorConfig {
pub id: Option<String>,
pub config: Option<serde_json::Value>, // Using serde_json::Value to handle any type of config

File diff suppressed because it is too large Load Diff