feat(middleware): 附件中间件迁移至 MinIO 存储
- 使用 MinIOBackend 替代本地文件系统存储附件 - 优化 thread_id 获取逻辑,支持多种来源 - 保留原始文件名而非 file_id.md 格式
This commit is contained in:
parent
fae17c3013
commit
c09bf30626
@ -210,7 +210,7 @@ class MinIOBackend(BackendProtocol):
|
||||
return f"Error reading {file_path}: {e}"
|
||||
|
||||
def write(self, file_path: str, content: str) -> WriteResult:
|
||||
"""写入文件。
|
||||
"""写入文件(同步)。
|
||||
|
||||
Args:
|
||||
file_path: 虚拟路径
|
||||
@ -240,6 +240,19 @@ class MinIOBackend(BackendProtocol):
|
||||
logger.error(f"MinIOBackend.write failed for {file_path}: {e}")
|
||||
return WriteResult(error=str(e))
|
||||
|
||||
async def awrite(self, file_path: str, content: str) -> WriteResult:
|
||||
"""异步写入文件。
|
||||
|
||||
Args:
|
||||
file_path: 虚拟路径
|
||||
content: 文件内容
|
||||
|
||||
Returns:
|
||||
WriteResult
|
||||
"""
|
||||
# 委托给同步 write 方法
|
||||
return self.write(file_path, content)
|
||||
|
||||
def edit(
|
||||
self,
|
||||
file_path: str,
|
||||
|
||||
Loading…
Reference in New Issue
Block a user