Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 34 additions & 0 deletions tools/tool_unoserver_file_converter/1.0.0/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
## 1.0.0 版本说明

- 支持 DOC->DOCX 文件转换
- 支持 WPS->DOCX 文件转换
- 支持 PPT->PPTX 文件转换

## unoserver 文档类型转换工具

### 启动参数
| 参数名称 | 参数类型 | 参数说明 | 默认值 |
|------------------|------|----------------------|---------------------------|
| `unoserver_host` | 字符串 | unoserver 部署服务 ip 地址 | |
| `api_base_url` | 字符串 | MaxKB 服务地址 | `http://xxx.x.xx.xx:8080` |
| `api_auth_token` | 字符串 | MaxKB 用户的 APIKey | `user-XXXXX` |

### 输入参数
| 参数名称 | 参数类型 | 参数说明 | 默认值 |
| -------- |------|--------------------------------------------------------------------------------------------------------------------------|--------------|
| `username` | 字符串 | MaxKB 用户登录名 | `<username>` |
| `password` | 字符串 | MaxKB 密码 | `<password>` |
| `file_info` | 字典 | MaxKB 文件上传信息 | |
| `source_type` | 字符串 | 文件资源上传类型(类型候选[KNOWLEDGE,APPLICATION,TOOL,DOCUMENT,CHAT,SYSTEM,TEMPORARY_30_MINUTE,TEMPORARY_120_MINUTE,TEMPORARY_1_DAY]) | |
| `source_id` | 字符串 | 资源 id ,如果 source_type 为[TEMPORARY_30_MINUTE,TEMPORARY_120_MINUTE,TEMPORARY_1_DAY,SYSTEM] 其他的需要为对应资源的id | |


### 输出结果:
转换文件后上传至 MaxKB 的成功响应,如:
```
{
"code": 200,
"message": "成功",
"data": "./oss/file/019fd683-f9b6-7e71-b22f-14cd2ab21557"
}
```
Binary file not shown.
49 changes: 49 additions & 0 deletions tools/tool_unoserver_file_converter/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# unoserver 文档类型转换工具

本工具借助 Unoserver 达到文件类型转换的功能,并将转换后的文件上传至 MaxKB,返回上传响应信息。

## 功能特性

- ✅ 支持 DOC->DOCX 文件转换
- ✅ 支持 WPS->DOCX 文件转换
- ✅ 支持 PPT->PPTX 文件转换


## 环境准备

### 1.1 Unoserver 安装

Unoserver 是基于 LibreOffice UNO 接口的‌客户端 - 服务器架构文档转换服务,支持 LibreOffice 兼容的所有格式(如 docx/odt/xlsx/pptx 等)互转.

安装步骤如下:

```
docker run -d -p 2003:2003 --name unoserver-service ghcr.io/unoconv/unoserver-docker
```

### 1.2 安装依赖

```
docker exec -it maxkb pip install unoserver==3.4
```

## 参数说明

### 启动参数
| 参数名称 | 参数类型 | 参数说明 | 默认值 |
|------------------|------|----------------------|---------------------------|
| `unoserver_host` | 字符串 | unoserver 部署服务 ip 地址 | |
| `api_base_url` | 字符串 | MaxKB 服务地址 | `http://xxx.x.xx.xx:8080` |
| `api_auth_token` | 字符串 | MaxKB 用户的 APIKey | `user-XXXXX` |

### 输入参数
| 参数名称 | 参数类型 | 参数说明 | 默认值 |
| -------- |------|--------------------------------------------------------------------------------------------------------------------------|--------------|
| `username` | 字符串 | MaxKB 用户登录名 | `<username>` |
| `password` | 字符串 | MaxKB 密码 | `<password>` |
| `file_info` | 字典 | MaxKB 文件上传信息 | |
| `source_type` | 字符串 | 文件资源上传类型(类型候选[KNOWLEDGE,APPLICATION,TOOL,DOCUMENT,CHAT,SYSTEM,TEMPORARY_30_MINUTE,TEMPORARY_120_MINUTE,TEMPORARY_1_DAY]) | |
| `source_id` | 字符串 | 资源 id ,如果 source_type 为[TEMPORARY_30_MINUTE,TEMPORARY_120_MINUTE,TEMPORARY_1_DAY,SYSTEM] 其他的需要为对应资源的id | |

**知识库工作流使用示例**
链接: https://pan.baidu.com/s/1_F84cUXaIuI20WaW4l1XMg?pwd=cn5y 提取码: cn5y
5 changes: 5 additions & 0 deletions tools/tool_unoserver_file_converter/data.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
name: unoserver 文档类型转换工具
tags:
- 内容处理
title: 支持 DOC->DOCX、WPS->DOCX、PPT->PPTX 文档类型转换。
description: 实现DOC->DOCX、WPS->DOCX、PPT->PPTX 以上文档类型转换,并上传至MaxKB,返回响应信息。
Binary file added tools/tool_unoserver_file_converter/logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading