Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

changed backend base url from "api" to "vapi" #63

Merged
merged 1 commit into from
Nov 23, 2024
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
20 changes: 10 additions & 10 deletions docs/IntegrationsManual/getting_started.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ By default, we use `admin` as both the username and password in our development

The typical lifecycle of a task in Visionatrix involves the following steps:

1. **Creating a Task**: You send a `PUT` request to the `/api/tasks/create/{name}` endpoint, where `{name}` is the ID of the flow you want to use. The request must use `multipart/form-data` and include the necessary parameters for the flow.
1. **Creating a Task**: You send a `PUT` request to the `/vapi/tasks/create/{name}` endpoint, where `{name}` is the ID of the flow you want to use. The request must use `multipart/form-data` and include the necessary parameters for the flow.

- For the **SDXL Lighting** (`sdxl_lighting`) flow, required parameters are:
- `prompt` (string): The text prompt for image generation.
Expand All @@ -54,7 +54,7 @@ The typical lifecycle of a task in Visionatrix involves the following steps:
- **Other Parameters**:
- There are additional optional parameters such as `webhook_url`, `webhook_headers`, `translate`, `group_scope`, etc. These parameters are not covered in this beginner guide.

2. **Checking Task Progress**: After creating a task, you can check its progress using the `/api/tasks/progress/{task_id}` endpoint. The response includes details such as the task's `progress`, `error` (if any), and a list of `outputs`.
2. **Checking Task Progress**: After creating a task, you can check its progress using the `/vapi/tasks/progress/{task_id}` endpoint. The response includes details such as the task's `progress`, `error` (if any), and a list of `outputs`.

- **Progress Values**:
- `0.0`: Task is queued and has not started yet.
Expand All @@ -65,9 +65,9 @@ The typical lifecycle of a task in Visionatrix involves the following steps:
- If the `error` field is not empty, the task has encountered an error.
- You can retry the task or investigate the issue based on the error message.

3. **Retrieving Task Results**: Once a task is completed (`progress` reaches `100.0`), you can retrieve the results using the `/api/tasks/results` endpoint. The `outputs` from the task details contain a list of output nodes, each with a `comfy_node_id`. You should iterate over all the outputs to retrieve all results.
3. **Retrieving Task Results**: Once a task is completed (`progress` reaches `100.0`), you can retrieve the results using the `/vapi/tasks/results` endpoint. The `outputs` from the task details contain a list of output nodes, each with a `comfy_node_id`. You should iterate over all the outputs to retrieve all results.

- To retrieve each result, you send a `GET` request to `/api/tasks/results` with the `task_id` and `node_id` (which is the `comfy_node_id` from the outputs).
- To retrieve each result, you send a `GET` request to `/vapi/tasks/results` with the `task_id` and `node_id` (which is the `comfy_node_id` from the outputs).
- The result files can then be saved locally. The format of the result file depends on the flow and the output node's type.

!!! note
Expand Down Expand Up @@ -114,7 +114,7 @@ def create_sdxl_lighting_task():

# Create the task
response = httpx.put(
f"{base_url}/api/tasks/create/sdxl_lighting",
f"{base_url}/vapi/tasks/create/sdxl_lighting",
auth=(username, password),
files=files
)
Expand All @@ -137,7 +137,7 @@ def create_sdxl_lighting_task():
def check_task_progress(task_id):
while True:
response = httpx.get(
f"{base_url}/api/tasks/progress/{task_id}",
f"{base_url}/vapi/tasks/progress/{task_id}",
auth=(username, password)
)

Expand Down Expand Up @@ -172,7 +172,7 @@ def retrieve_task_results(task_id, outputs):
'node_id': node_id
}
result_response = httpx.get(
f"{base_url}/api/tasks/results",
f"{base_url}/vapi/tasks/results",
auth=(username, password),
params=params
)
Expand Down Expand Up @@ -224,7 +224,7 @@ def create_remove_background_task():

# Create the task
response = httpx.put(
f"{base_url}/api/tasks/create/remove_background_birefnet",
f"{base_url}/vapi/tasks/create/remove_background_birefnet",
auth=(username, password),
files=files
)
Expand All @@ -247,7 +247,7 @@ def create_remove_background_task():
def check_task_progress(task_id):
while True:
response = httpx.get(
f"{base_url}/api/tasks/progress/{task_id}",
f"{base_url}/vapi/tasks/progress/{task_id}",
auth=(username, password)
)

Expand Down Expand Up @@ -282,7 +282,7 @@ def retrieve_task_results(task_id, outputs):
'node_id': node_id
}
result_response = httpx.get(
f"{base_url}/api/tasks/results",
f"{base_url}/vapi/tasks/results",
auth=(username, password),
params=params
)
Expand Down
18 changes: 9 additions & 9 deletions scripts/benchmarks/benchmark.py
Original file line number Diff line number Diff line change
Expand Up @@ -400,7 +400,7 @@ async def select_test_flow_suite():
async def is_server_online() -> bool:
async with httpx.AsyncClient(auth=BASIC_AUTH) as client:
try:
response = await client.get(f"{SERVER_URL}/api/flows/installed")
response = await client.get(f"{SERVER_URL}/vapi/flows/installed")
response.raise_for_status() # Ensure server responds correctly
return True
except (httpx.RequestError, httpx.HTTPStatusError):
Expand All @@ -414,7 +414,7 @@ async def get_installed_flows() -> list:
if INSTALLED_FLOWS_CACHE:
return INSTALLED_FLOWS_CACHE
async with httpx.AsyncClient(auth=BASIC_AUTH) as client:
response = await client.get(f"{SERVER_URL}/api/flows/installed", timeout=60)
response = await client.get(f"{SERVER_URL}/vapi/flows/installed", timeout=60)
response.raise_for_status()
INSTALLED_FLOWS_CACHE = response.json()
return INSTALLED_FLOWS_CACHE
Expand All @@ -435,7 +435,7 @@ async def install_flow(flow_name: str) -> bool:
async with httpx.AsyncClient(auth=BASIC_AUTH) as client:
try:
response = await client.post(
f"{SERVER_URL}/api/flows/flow", params={"name": flow_name}
f"{SERVER_URL}/vapi/flows/flow", params={"name": flow_name}
)
if response.status_code == 204:
print(f"Successfully started the installation of flow '{flow_name}'.")
Expand All @@ -462,7 +462,7 @@ async def wait_for_installation_to_complete(
async with httpx.AsyncClient(auth=BASIC_AUTH) as client:
while elapsed_time < timeout:
try:
response = await client.get(f"{SERVER_URL}/api/flows/install-progress")
response = await client.get(f"{SERVER_URL}/vapi/flows/install-progress")
response.raise_for_status()
install_progress = response.json()

Expand Down Expand Up @@ -531,7 +531,7 @@ async def create_task(
**input_params,
}
response = await client.put(
f"{SERVER_URL}/api/tasks/create/{flow_name}",
f"{SERVER_URL}/vapi/tasks/create/{flow_name}",
data=form_data,
files=files_to_upload,
headers={
Expand Down Expand Up @@ -568,7 +568,7 @@ async def get_task_progress(task_id: int, poll_interval: int = 5) -> dict:
while True:
try:
response = await client.get(
f"{SERVER_URL}/api/tasks/progress/{task_id}"
f"{SERVER_URL}/vapi/tasks/progress/{task_id}"
)
if response.status_code == 200:
task_data = response.json()
Expand Down Expand Up @@ -912,7 +912,7 @@ async def delete_task(task_id: int) -> None:
async with httpx.AsyncClient(auth=BASIC_AUTH) as client:
try:
response = await client.delete(
f"{SERVER_URL}/api/tasks/task", params={"task_id": task_id}
f"{SERVER_URL}/vapi/tasks/task", params={"task_id": task_id}
)
if response.status_code != 204:
print(
Expand Down Expand Up @@ -940,7 +940,7 @@ async def get_task_results(task_id: int, node_id: int) -> bytes:
async with httpx.AsyncClient(auth=BASIC_AUTH) as client:
try:
response = await client.get(
f"{SERVER_URL}/api/tasks/results",
f"{SERVER_URL}/vapi/tasks/results",
params={"task_id": task_id, "node_id": node_id},
)
if response.status_code == 200:
Expand Down Expand Up @@ -1057,7 +1057,7 @@ async def get_available_workers() -> list[dict]:
"""
async with httpx.AsyncClient(auth=BASIC_AUTH) as client:
try:
response = await client.get(f"{SERVER_URL}/api/workers/info", timeout=60)
response = await client.get(f"{SERVER_URL}/vapi/workers/info", timeout=60)
response.raise_for_status()
return response.json()
except httpx.RequestError as exc:
Expand Down