chore(lint): clean up frontend and Rust lint issues

This commit is contained in:
xintaofei
2026-04-23 15:56:41 +08:00
parent 1dd40d0baf
commit 022172a9ea
69 changed files with 1138 additions and 1248 deletions

View File

@@ -20,22 +20,14 @@ impl MigrationTrait for Migration {
.primary_key(),
)
.col(ColumnDef::new(ChatChannel::Name).string().not_null())
.col(
ColumnDef::new(ChatChannel::ChannelType)
.string()
.not_null(),
)
.col(ColumnDef::new(ChatChannel::ChannelType).string().not_null())
.col(
ColumnDef::new(ChatChannel::Enabled)
.boolean()
.not_null()
.default(true),
)
.col(
ColumnDef::new(ChatChannel::ConfigJson)
.text()
.not_null(),
)
.col(ColumnDef::new(ChatChannel::ConfigJson).text().not_null())
.col(ColumnDef::new(ChatChannel::EventFilterJson).text().null())
.col(
ColumnDef::new(ChatChannel::DailyReportEnabled)
@@ -43,11 +35,7 @@ impl MigrationTrait for Migration {
.not_null()
.default(false),
)
.col(
ColumnDef::new(ChatChannel::DailyReportTime)
.string()
.null(),
)
.col(ColumnDef::new(ChatChannel::DailyReportTime).string().null())
.col(
ColumnDef::new(ChatChannel::CreatedAt)
.timestamp_with_time_zone()
@@ -138,11 +126,7 @@ impl MigrationTrait for Migration {
async fn down(&self, manager: &SchemaManager) -> Result<(), DbErr> {
manager
.drop_table(
Table::drop()
.table(ChatChannelMessageLog::Table)
.to_owned(),
)
.drop_table(Table::drop().table(ChatChannelMessageLog::Table).to_owned())
.await?;
manager
.drop_table(Table::drop().table(ChatChannel::Table).to_owned())

View File

@@ -10,7 +10,11 @@ impl MigrationTrait for Migration {
.alter_table(
Table::alter()
.table(AgentSetting::Table)
.add_column(ColumnDef::new(AgentSetting::ModelProviderId).integer().null())
.add_column(
ColumnDef::new(AgentSetting::ModelProviderId)
.integer()
.null(),
)
.to_owned(),
)
.await

View File

@@ -1,7 +1,7 @@
use chrono::Utc;
use sea_orm::sea_query::OnConflict;
use sea_orm::{ConnectionTrait, DatabaseConnection};
use sea_orm::{ActiveValue::NotSet, ColumnTrait, EntityTrait, QueryFilter, Set};
use sea_orm::{ConnectionTrait, DatabaseConnection};
use crate::db::entities::app_metadata;
use crate::db::error::DbError;

View File

@@ -207,8 +207,7 @@ pub async fn list_all(
sort_by: Option<String>,
status: Option<String>,
) -> Result<Vec<DbConversationSummary>, DbError> {
let mut query = conversation::Entity::find()
.filter(conversation::Column::DeletedAt.is_null());
let mut query = conversation::Entity::find().filter(conversation::Column::DeletedAt.is_null());
match folder_ids {
Some(ids) if !ids.is_empty() => {

View File

@@ -181,10 +181,7 @@ pub async fn list_all_folder_details(
Ok(rows.into_iter().map(to_detail).collect())
}
pub async fn reorder_folders(
conn: &DatabaseConnection,
ids: Vec<i32>,
) -> Result<(), DbError> {
pub async fn reorder_folders(conn: &DatabaseConnection, ids: Vec<i32>) -> Result<(), DbError> {
if ids.is_empty() {
return Ok(());
}

View File

@@ -87,10 +87,7 @@ pub async fn delete_tabs_for_folder(
conn: &DatabaseConnection,
folder_id: i32,
) -> Result<(), DbError> {
let sql = format!(
"DELETE FROM opened_tab WHERE folder_id = {}",
folder_id
);
let sql = format!("DELETE FROM opened_tab WHERE folder_id = {}", folder_id);
conn.execute(Statement::from_string(DbBackend::Sqlite, sql))
.await?;
Ok(())