Build latest book artifacts / build (push) Canceled after 0s
dependency resolution / resolve (3.11) (push) Canceled after 0s
dependency resolution / resolve (3.13) (push) Canceled after 0s
deploy-pages / build (push) Canceled after 0s
deploy-pages / deploy (push) Canceled after 0s
i18n consistency check / check (push) Canceled after 0s
provider adoption tests / test (chapter2/context-compression) (push) Canceled after 0s
provider adoption tests / test (chapter2/prompt-injection) (push) Canceled after 0s
provider adoption tests / test (chapter2/system-hint) (push) Canceled after 0s
provider adoption tests / test (chapter3/log-sanitization) (push) Canceled after 0s
web-search-agent tests / test (push) Canceled after 0s
web-search-agent tests / agentbook (push) Canceled after 0s
38 lines
1.2 KiB
Python
Executable File
38 lines
1.2 KiB
Python
Executable File
#!/usr/bin/env python3
|
|
"""Launch the ReAct arm of the local Phone Agent add-on browser call."""
|
|
|
|
from __future__ import annotations
|
|
|
|
import argparse
|
|
import threading
|
|
import urllib.parse
|
|
import webbrowser
|
|
|
|
import uvicorn
|
|
|
|
DEFAULT_TASK = (
|
|
"Call me to arrange a dental checkup. I did not include the exact time or confirmation code, "
|
|
"so ask me for both by voice, repeat the details, and save only what I explicitly confirm."
|
|
)
|
|
|
|
|
|
def main() -> None:
|
|
parser = argparse.ArgumentParser(description=__doc__)
|
|
parser.add_argument("--task", default=DEFAULT_TASK)
|
|
parser.add_argument("--host", default="127.0.0.1")
|
|
parser.add_argument("--port", type=int, default=8765)
|
|
parser.add_argument(
|
|
"--no-open", action="store_true", help="Do not open the browser automatically"
|
|
)
|
|
args = parser.parse_args()
|
|
query = urllib.parse.urlencode({"mode": "react", "task": args.task})
|
|
url = f"http://{args.host}:{args.port}/?{query}"
|
|
print(f"Phone Agent add-on ReAct endpoint: {url}")
|
|
if not args.no_open:
|
|
threading.Timer(0.8, lambda: webbrowser.open(url)).start()
|
|
uvicorn.run("webrtc_app:app", host=args.host, port=args.port)
|
|
|
|
|
|
if __name__ == "__main__":
|
|
main()
|