-
Notifications
You must be signed in to change notification settings - Fork 926
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Added temporal codec server route & cookbooks. Updated the CONT…
…RIBUTING.md file (#543) Added temporal payload decoding route, updated setup instructions in `CONTRIBUTING.md`, and modified Docker and FastAPI configurations. - **New Features**: - Added `/temporal/decode` route in `router.py` for decoding temporal payloads using `PydanticEncodingPayloadConverter`. - **Documentation**: - Updated `CONTRIBUTING.md` with setup instructions, including environment setup, Docker volume creation, and running the project in single or multi-tenant mode. - **Configuration**: - Added `internal.router` to `web.py` to include the new internal routes. - Updated `docker-compose.yml` to expose port `8080` for `agents-api` and `agents-api-multi-tenant` services.
- Loading branch information
1 parent
990ea1a
commit e97ca4e
Showing
10 changed files
with
1,601 additions
and
44 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
from .router import router |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
from fastapi import APIRouter, Request, Response | ||
from google.protobuf import json_format | ||
from temporalio.api.common.v1 import Payloads | ||
|
||
from ...worker.codec import PydanticEncodingPayloadConverter | ||
|
||
router: APIRouter = APIRouter() | ||
|
||
converter = PydanticEncodingPayloadConverter() | ||
|
||
|
||
# Decode route | ||
@router.post("/temporal/decode", tags=["temporal"]) | ||
async def decode_payloads(req: Request) -> dict: | ||
body = json_format.Parse(await req.body(), Payloads()) | ||
payloads = body.payloads | ||
|
||
decoded_payloads = [] | ||
|
||
for p in payloads: | ||
data = converter.from_payload(p) | ||
|
||
if hasattr(data, "model_dump"): | ||
data = data.model_dump() | ||
|
||
decoded_payloads.append({"data": data, "metadata": p.metadata}) | ||
|
||
return {"payloads": decoded_payloads} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.