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

fix shareid inference #263

Merged
merged 3 commits into from
Dec 6, 2024
Merged
Changes from 1 commit
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
29 changes: 29 additions & 0 deletions src/bizy_server/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

API_PREFIX = "bizyair"
COMMUNITY_API = f"{API_PREFIX}/community"
MODEL_HOST_API = f"{API_PREFIX}/modelhost"
USER_API = f"{API_PREFIX}/user"

logging.basicConfig(level=logging.DEBUG)
Expand Down Expand Up @@ -471,6 +472,34 @@ async def get_workflow_json(request):
print(f"\033[31m[BizyAir]\033[0m Fail to download JSON: {str(e)}")
return ErrResponse(errnos.DOWNLOAD_JSON)

@self.prompt_server.routes.get(f"/{MODEL_HOST_API}" + "/{shareId}/models/files")
ccssu marked this conversation as resolved.
Show resolved Hide resolved
async def list_share_model_files(request):
shareId = request.match_info["shareId"]

if not is_string_valid(shareId):
return ErrResponse("INVALID_SHARE_ID")

err = check_type(request.rel_url.query)
if err is not None:
return err

payload = {
"type": request.rel_url.query["type"],
}

if "name" in request.rel_url.query:
payload["name"] = request.rel_url.query["name"]

if "ext_name" in request.rel_url.query:
payload["ext_name"] = request.rel_url.query["ext_name"]
model_files, err = await self.api_client.get_share_model_files(
shareId=shareId, payload=payload
)
if err is not None:
return ErrResponse(err)

return OKResponse(model_files)

async def send_json(self, event, data, sid=None):
message = {"type": event, "data": data}

Expand Down
Loading