Skip to content

Commit

Permalink
Return Value
Browse files Browse the repository at this point in the history
  • Loading branch information
Pylogmon committed Sep 8, 2023
1 parent 1c2567d commit 9b1427b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,3 +46,5 @@ cargo build --release # 编译
每次将仓库推送到 GitHub 之后 actions 会自动运行,将打包好的插件上传到 artifact,在 actions 页面可以下载

每次提交 Tag 之后,actions 会自动运行,将打包好的插件上传到 release,在 release 页面可以下载打包好的插件

> 注意需要在仓库设置中添加一个名为`TOKEN`的 secret,值为一个有权限的 GitHub Token,用于上传 release
4 changes: 2 additions & 2 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ pub fn recognize(
lang: &str, // 识别语言
// (pot会根据info.json 中的 language 字段传入插件需要的语言代码,无需再次转换)
needs: HashMap<String, String>, // 插件需要的其他参数,由info.json定义
) -> Result<String, Box<dyn Error>> {
) -> Result<Value, Box<dyn Error>> {
let client = reqwest::blocking::ClientBuilder::new().build()?;

let apikey = match needs.get("apikey") {
Expand Down Expand Up @@ -40,7 +40,7 @@ pub fn recognize(
}

if let Some(result) = parse_result(res) {
return Ok(result);
return Ok(Value::String(result));
} else {
return Err("Response Parse Error".into());
}
Expand Down

0 comments on commit 9b1427b

Please sign in to comment.