-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
15 changed files
with
213 additions
and
89 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
from agentuniverse.base.agentuniverse import AgentUniverse | ||
from agentuniverse_product.agentuniverse_product import AgentUniverseProduct | ||
import sys | ||
|
||
print(sys.path) | ||
|
||
|
||
class ProductApplication: | ||
""" | ||
Product application. | ||
""" | ||
|
||
@classmethod | ||
def start(cls): | ||
AgentUniverse().start() | ||
AgentUniverseProduct().start() | ||
|
||
|
||
if __name__ == "__main__": | ||
ProductApplication.start() |
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,10 @@ | ||
# python generated files | ||
__pycache__/ | ||
*.py[oc] | ||
build/ | ||
dist/ | ||
wheels/ | ||
*.egg-info | ||
|
||
# venv | ||
.venv |
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 @@ | ||
3.10.14 |
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,3 @@ | ||
# agent_ui | ||
|
||
Describe your project here. |
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,30 @@ | ||
[project] | ||
name = "agent_ui" | ||
version = "0.1.0" | ||
description = "Add your description here" | ||
authors = [ | ||
{ name = "shiyu", email = "[email protected]" } | ||
] | ||
|
||
packages = [ | ||
{ include = "agent_ui" } | ||
] | ||
|
||
dependencies = [] | ||
readme = "README.md" | ||
requires-python = ">= 3.10" | ||
|
||
[build-system] | ||
requires = ["hatchling"] | ||
build-backend = "hatchling.build" | ||
|
||
[tool.rye] | ||
managed = true | ||
|
||
dev-dependencies = [] | ||
|
||
[tool.hatch.metadata] | ||
allow-direct-references = true | ||
|
||
[tool.hatch.build.targets.wheel] | ||
packages = ["src/agent_ui"] |
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,2 @@ | ||
def hello() -> str: | ||
return "Hello from agent_ui!" |
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,32 @@ | ||
from fastapi import FastAPI | ||
from fastapi.staticfiles import StaticFiles | ||
from contextlib import asynccontextmanager | ||
import webbrowser | ||
import uvicorn | ||
from agent_ui.routers.main import api_router | ||
import os | ||
|
||
PORT = 3000 | ||
|
||
|
||
@asynccontextmanager | ||
async def lifespan(app: FastAPI): | ||
url = f"http://localhost:{PORT}" | ||
webbrowser.open(url) | ||
print(f"Server is running at {url}") | ||
yield | ||
print('finished') | ||
|
||
app = FastAPI(lifespan=lifespan) | ||
|
||
app.include_router(api_router, prefix='/api/v1') | ||
|
||
# 挂载 static 目录,使其可以访问静态文件 | ||
BASE_DIR = os.path.dirname(os.path.abspath(__file__)) | ||
dist_dir = os.path.join(BASE_DIR, 'dist') | ||
app.mount("/", StaticFiles(directory=dist_dir, html=True), name="dist") | ||
|
||
|
||
def start_ui_serve(): | ||
uvicorn.run("agent_ui.start:app", | ||
host="localhost", port=PORT, reload=True) |
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,6 @@ | ||
from agentuniverse.base.agentuniverse import AgentUniverse | ||
from agent_ui.start import start_ui_serve | ||
|
||
|
||
if __name__ == "__main__": | ||
start_ui_serve() |
Empty file.
Empty file.
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,15 @@ | ||
from fastapi import APIRouter, HTTPException | ||
# from sqlalchemy.orm import Session | ||
# from fastapi import Depends | ||
# from packages.magent.src.temps.au_agent import RagAgent | ||
# from agentuniverse.base.agentuniverse import AgentUniverse | ||
|
||
|
||
router = APIRouter() | ||
demos_router = router | ||
|
||
|
||
@router.get("/detail") | ||
async def get_account_by_id(): | ||
print('finish') | ||
return True |
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,7 @@ | ||
from fastapi import APIRouter | ||
from .demos.router import demos_router | ||
|
||
api_router = APIRouter() | ||
|
||
api_router.include_router( | ||
demos_router, prefix="/agentuniverse", tags=["agentuniverse"]) |
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.