Skip to content

Commit

Permalink
chore: missing rename
Browse files Browse the repository at this point in the history
  • Loading branch information
MistEO committed Dec 18, 2024
1 parent f8b5f29 commit f61e066
Show file tree
Hide file tree
Showing 16 changed files with 26 additions and 26 deletions.
4 changes: 2 additions & 2 deletions docs/en_us/1.1-QuickStarted.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ You can use low-code as a "wrapper" for invocation or register custom callbacks.
# This is pseudo code, for reference only, and cannot be run directly
# "Recognize and click the start button", "Recognize and click the confirmation icon" and so on are all logic in Json
def main():
detail = tasker.post_pipeline("Recognize and click the start button").wait().get()
detail = tasker.post_task("Recognize and click the start button").wait().get()

if detail.completed:
tasker.controller.post_click(100, 100).wait()
Expand All @@ -95,7 +95,7 @@ def main():
save_to_file(image)

tasker.resource.register_custom_action("MyAction", MyAction())
tasker.post_pipeline("Recognize and click the confirmation icon").wait()
tasker.post_task("Recognize and click the confirmation icon").wait()

image: np.ndarray = tasker.controller.post_screencap().wait().get()
```
Expand Down
6 changes: 3 additions & 3 deletions docs/en_us/NodeJS/J1.1-QuickStarted.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ async function main() {

// Launch task. Task1 is declared in pipeline/Task.json
if (await tskr
.post_pipeline('Task1')
.post_task('Task1')
.wait().success) {
console.log('success!')
}
Expand All @@ -87,7 +87,7 @@ main()

## Alter Resource Behavior on NodeJS Side

Take a look at this code `await tskr.post_pipeline('task', 'Task1').wait()`
Take a look at this code `await tskr.post_task('task', 'Task1').wait()`

Function `post` can be called with three params. The third one is an object, which has exact the same structure to json in `pipeline`, and will override the original `pipeline`. Thus, you can pass an object here to control the task (even create new task).

Expand All @@ -97,7 +97,7 @@ Function `post` can be called with three params. The third one is an object, whi
// 通过第三个参数, 创建了一个新的任务Task2, 然后执行它
// 此处创建的任务仅在当前执行中有效
await tskr
.post_pipeline('Task2', {
.post_task('Task2', {
Task2: {
next: [
'Task1'
Expand Down
4 changes: 2 additions & 2 deletions docs/zh_cn/1.1-快速开始.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ class MyAction(CustomAction):
# 此处为伪代码,仅供参考思路,无法直接运行
# "识别并点击开始按钮", "识别并点击确认图标" 等均为 Json 中的逻辑
def main():
detail = tasker.post_pipeline("识别并点击开始按钮").wait().get()
detail = tasker.post_task("识别并点击开始按钮").wait().get()

if detail.completed:
tasker.controller.post_click(100, 100).wait()
Expand All @@ -95,7 +95,7 @@ def main():
save_to_file(image)

tasker.resource.register_custom_action("MyAction", MyAction())
tasker.post_pipeline("识别并点击确认图标").wait()
tasker.post_task("识别并点击确认图标").wait()

image: np.ndarray = tasker.controller.post_screencap().wait().get()
```
Expand Down
6 changes: 3 additions & 3 deletions docs/zh_cn/NodeJS/J1.1-快速开始.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ async function main() {

// 执行任务, Task1定义在pipeline/Task.json
if (await tskr
.post_pipeline('Task1')
.post_task('Task1')
.wait().success) {
console.log('success!')
}
Expand All @@ -87,15 +87,15 @@ main()

## 在JS侧影响资源行为

注意执行任务的这段代码`await tskr.post_pipeline('task', 'Task1').wait()`
注意执行任务的这段代码`await tskr.post_task('task', 'Task1').wait()`

`post`函数可以传入第三个参数, 该参数是一个对象, 其结构和`pipeline`下的json完全一致, 会覆盖在原有的`pipeline`之上. 因此, 可以通过在此处传入一个对象来实现控制任务(甚至创建新的任务).

```javascript
// 通过第三个参数, 创建了一个新的任务Task2, 然后执行它
// 此处创建的任务仅在当前执行中有效
await tskr
.post_pipeline('Task2', {
.post_task('Task2', {
Task2: {
next: [
'Task1'
Expand Down
2 changes: 1 addition & 1 deletion sample/nodejs/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ async function main() {

res.register_custom_recognizer('MyRec', my_reco)

let task_detail = await tskr.post_pipeline('StartUpAndClickButton').wait().get()
let task_detail = await tskr.post_task('StartUpAndClickButton').wait().get()

tskr.destroy()
ctrl.destroy()
Expand Down
2 changes: 1 addition & 1 deletion sample/python/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ def main():

resource.register_custom_recognition("MyRec", MyRecongition())

task_detail = tasker.post_pipeline("StartUpAndClickButton").wait().get()
task_detail = tasker.post_task("StartUpAndClickButton").wait().get()
# do something with task_detail


Expand Down
2 changes: 1 addition & 1 deletion source/MaaFramework/API/MaaTasker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ MaaTaskId MaaTaskerPostTask(MaaTasker* tasker, const char* entry, const char* pi
return MaaInvalidId;
}

return tasker->post_pipeline(entry, ov_opt->as_object());
return tasker->post_task(entry, ov_opt->as_object());
}

MaaStatus MaaTaskerStatus(const MaaTasker* tasker, MaaTaskId id)
Expand Down
2 changes: 1 addition & 1 deletion source/MaaFramework/API/MaaTypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ struct MaaTasker

virtual bool set_option(MaaTaskerOption key, MaaOptionValue value, MaaOptionValueSize val_size) = 0;

virtual MaaTaskId post_pipeline(const std::string& entry, const json::object& pipeline_override) = 0;
virtual MaaTaskId post_task(const std::string& entry, const json::object& pipeline_override) = 0;

virtual MaaStatus status(MaaTaskId task_id) const = 0;
virtual MaaStatus wait(MaaTaskId task_id) const = 0;
Expand Down
2 changes: 1 addition & 1 deletion source/MaaFramework/Tasker/Tasker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ bool Tasker::set_option(MaaTaskerOption key, MaaOptionValue value, MaaOptionValu
return false;
}

MaaTaskId Tasker::post_pipeline(const std::string& entry, const json::object& pipeline_override)
MaaTaskId Tasker::post_task(const std::string& entry, const json::object& pipeline_override)
{
LogInfo << VAR(entry) << VAR(pipeline_override);

Expand Down
2 changes: 1 addition & 1 deletion source/MaaFramework/Tasker/Tasker.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class Tasker : public MaaTasker

virtual bool set_option(MaaTaskerOption key, MaaOptionValue value, MaaOptionValueSize val_size) override;

virtual MaaTaskId post_pipeline(const std::string& entry, const json::object& pipeline_override) override;
virtual MaaTaskId post_task(const std::string& entry, const json::object& pipeline_override) override;

virtual MaaStatus status(MaaTaskId task_id) const override;
virtual MaaStatus wait(MaaTaskId task_id) const override;
Expand Down
2 changes: 1 addition & 1 deletion source/binding/NodeJS/release/maa-node/src/maa.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ export declare function tasker_bind_controller(
controller: ControllerHandle | null
): boolean
export declare function tasker_inited(handle: TaskerHandle): boolean
export declare function tasker_post_pipeline(
export declare function tasker_post_task(
handle: TaskerHandle,
entry: string,
pipeline_override: string
Expand Down
4 changes: 2 additions & 2 deletions source/binding/NodeJS/release/maa-node/src/tasker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -117,11 +117,11 @@ export class TaskerBase {
}
}

post_pipeline(entry: string, param: Record<string, unknown> = {}) {
post_task(entry: string, param: Record<string, unknown> = {}) {
return new TaskJob(
this,
this.#source,
maa.tasker_post_pipeline(this.handle, entry, JSON.stringify(param))
maa.tasker_post_task(this.handle, entry, JSON.stringify(param))
)
}

Expand Down
4 changes: 2 additions & 2 deletions source/binding/NodeJS/src/instance/tasker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ bool tasker_inited(Napi::External<TaskerInfo> info)
return MaaTaskerInited(info.Data()->handle);
}

MaaTaskId tasker_post_pipeline(Napi::External<TaskerInfo> info, std::string entry, std::string overr)
MaaTaskId tasker_post_task(Napi::External<TaskerInfo> info, std::string entry, std::string overr)
{
return MaaTaskerPostTask(info.Data()->handle, entry.c_str(), overr.c_str());
}
Expand Down Expand Up @@ -208,7 +208,7 @@ void load_instance_tasker(Napi::Env env, Napi::Object& exports, Napi::External<E
BIND(tasker_bind_resource);
BIND(tasker_bind_controller);
BIND(tasker_inited);
BIND(tasker_post_pipeline);
BIND(tasker_post_task);
BIND(tasker_status);
BIND(tasker_wait);
BIND(tasker_running);
Expand Down
2 changes: 1 addition & 1 deletion source/binding/Python/maa/tasker.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ def controller(self) -> Controller:
def inited(self) -> bool:
return bool(Library.framework.MaaTaskerInited(self._handle))

def post_pipeline(self, entry: str, pipeline_override: Dict = {}) -> JobWithResult:
def post_task(self, entry: str, pipeline_override: Dict = {}) -> JobWithResult:
taskid = Library.framework.MaaTaskerPostTask(
self._handle,
*Tasker._gen_post_param(entry, pipeline_override),
Expand Down
2 changes: 1 addition & 1 deletion test/nodejs/binding.ts
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ async function api_test() {
}
}

let detail = await tasker.post_pipeline('Entry', ppover).wait().get()
let detail = await tasker.post_task('Entry', ppover).wait().get()
if (!detail) {
console.log('pipeline failed')
process.exit(1)
Expand Down
6 changes: 3 additions & 3 deletions test/python/binding_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ def api_test():
r2.post_bundle("C:/_maafw_testing_/aaabbbccc").wait()
t1 = Tasker()
t2 = Tasker()
t2.post_pipeline("Entry", {}).wait()
t2.post_task("Entry", {}).wait()

resource = Resource(MyNotificationHandler())
print(f"resource: {resource}")
Expand Down Expand Up @@ -158,14 +158,14 @@ def api_test():
},
}

detail = tasker.post_pipeline("Entry", ppover).wait().get()
detail = tasker.post_task("Entry", ppover).wait().get()
if detail:
print(f"pipeline detail: {detail}")
else:
print("pipeline failed")
raise RuntimeError("pipeline failed")

tasker.post_pipeline("Entry", ppover)
tasker.post_task("Entry", ppover)
stopped = tasker.post_stop().wait().succeeded
if not stopped:
raise RuntimeError("post_stop failed")
Expand Down

0 comments on commit f61e066

Please sign in to comment.