Files
liqiang b119135836
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
ai-agent-book 精选快照(<2MB 代码与文档,来自 github.com/bojieli/ai-agent-book)
2026-08-20 13:12:50 +00:00

44 lines
1.3 KiB
Python
Executable File

#!/usr/bin/env python3
"""Launch the fixed-parameter control arm of Phone Agent add-on."""
from __future__ import annotations
import argparse
import threading
import urllib.parse
import webbrowser
import uvicorn
def main() -> None:
parser = argparse.ArgumentParser(description=__doc__)
parser.add_argument("--name", required=True, help="Name shown in the AI's opening line")
parser.add_argument("--goal", required=True)
parser.add_argument("--context", required=True)
parser.add_argument("--instructions", required=True)
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": "direct",
"callee_name": args.name,
"goal": args.goal,
"context": args.context,
"instructions": args.instructions,
}
)
url = f"http://{args.host}:{args.port}/?{query}"
print(f"Phone Agent add-on direct 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()