mirror of
https://github.com/rowboatlabs/rowboat.git
synced 2026-06-06 19:35:44 +02:00
docker fixes for agents
This commit is contained in:
parent
695a961333
commit
277a553ee1
6 changed files with 46 additions and 13 deletions
|
|
@ -6,7 +6,7 @@ export async function GET(request: Request, { params }: { params: { streamId: st
|
|||
// Fetch the upstream SSE stream.
|
||||
const upstreamResponse = await fetch(upstreamUrl, {
|
||||
headers: {
|
||||
'Authorization': `Bearer ${process.env.AGENTS_API_KEY}`,
|
||||
'Authorization': `Bearer ${process.env.AGENTS_API_KEY || 'test'}`,
|
||||
},
|
||||
cache: 'no-store',
|
||||
});
|
||||
|
|
|
|||
|
|
@ -2,3 +2,4 @@
|
|||
.env*
|
||||
__pycache__/
|
||||
venv/
|
||||
.venv/
|
||||
|
|
@ -20,9 +20,9 @@ RUN poetry install --no-interaction --no-ansi
|
|||
COPY . .
|
||||
|
||||
# Set environment variables
|
||||
ENV FLASK_APP=src.app.main
|
||||
ENV QUART_APP=src.app.main
|
||||
ENV PYTHONUNBUFFERED=1
|
||||
ENV PYTHONPATH=/app
|
||||
|
||||
# Command to run Flask development server
|
||||
CMD ["flask", "run", "--host=0.0.0.0", "--port=3001"]
|
||||
CMD ["quart", "run", "--host=0.0.0.0", "--port=3001"]
|
||||
|
|
|
|||
42
apps/rowboat_agents/poetry.lock
generated
42
apps/rowboat_agents/poetry.lock
generated
|
|
@ -1,5 +1,18 @@
|
|||
# This file is automatically @generated by Poetry 2.0.1 and should not be changed by hand.
|
||||
|
||||
[[package]]
|
||||
name = "aiofiles"
|
||||
version = "24.1.0"
|
||||
description = "File support for asyncio."
|
||||
optional = false
|
||||
python-versions = ">=3.8"
|
||||
groups = ["main"]
|
||||
markers = "python_version <= \"3.11\" or python_version == \"3.12\" or python_version >= \"3.13\""
|
||||
files = [
|
||||
{file = "aiofiles-24.1.0-py3-none-any.whl", hash = "sha256:b4ec55f4195e3eb5d7abd1bf7e061763e864dd4954231fb8539a0ef8bb8260e5"},
|
||||
{file = "aiofiles-24.1.0.tar.gz", hash = "sha256:22a075c9e5a3810f0c2e48f3008c94d68c65d763b9b03857924c99e57355166c"},
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "aiohappyeyeballs"
|
||||
version = "2.6.1"
|
||||
|
|
@ -3037,6 +3050,33 @@ urllib3 = ">=1.26.14,<3"
|
|||
fastembed = ["fastembed (==0.5.1)"]
|
||||
fastembed-gpu = ["fastembed-gpu (==0.5.1)"]
|
||||
|
||||
[[package]]
|
||||
name = "quart"
|
||||
version = "0.20.0"
|
||||
description = "A Python ASGI web framework with the same API as Flask"
|
||||
optional = false
|
||||
python-versions = ">=3.9"
|
||||
groups = ["main"]
|
||||
markers = "python_version <= \"3.11\" or python_version == \"3.12\" or python_version >= \"3.13\""
|
||||
files = [
|
||||
{file = "quart-0.20.0-py3-none-any.whl", hash = "sha256:003c08f551746710acb757de49d9b768986fd431517d0eb127380b656b98b8f1"},
|
||||
{file = "quart-0.20.0.tar.gz", hash = "sha256:08793c206ff832483586f5ae47018c7e40bdd75d886fee3fabbdaa70c2cf505d"},
|
||||
]
|
||||
|
||||
[package.dependencies]
|
||||
aiofiles = "*"
|
||||
blinker = ">=1.6"
|
||||
click = ">=8.0"
|
||||
flask = ">=3.0"
|
||||
hypercorn = ">=0.11.2"
|
||||
itsdangerous = "*"
|
||||
jinja2 = "*"
|
||||
markupsafe = "*"
|
||||
werkzeug = ">=3.0"
|
||||
|
||||
[package.extras]
|
||||
dotenv = ["python-dotenv"]
|
||||
|
||||
[[package]]
|
||||
name = "rapidfuzz"
|
||||
version = "3.12.2"
|
||||
|
|
@ -4091,4 +4131,4 @@ cffi = ["cffi (>=1.11)"]
|
|||
[metadata]
|
||||
lock-version = "2.1"
|
||||
python-versions = ">=3.10,<4.0"
|
||||
content-hash = "fc7b2d64a9f856b5a0c1aceb6be83ac18f8f9c6f95b8db63b28e69d385dcd38b"
|
||||
content-hash = "fa1d4cfd411dca631759ca36e0c7a02c1fe4c11b1ee121557a92cd616867e9a7"
|
||||
|
|
|
|||
|
|
@ -120,8 +120,6 @@ async def chat_stream_init():
|
|||
data = await request.get_json()
|
||||
redis_client.setex(f"stream_request_{stream_id}", 600, json.dumps(data))
|
||||
|
||||
print('* stream init'*200)
|
||||
|
||||
return jsonify({"streamId": stream_id})
|
||||
|
||||
def format_sse(data: dict, event: str = None) -> str:
|
||||
|
|
@ -157,11 +155,8 @@ async def chat_stream(stream_id):
|
|||
elif not msg.get("role"):
|
||||
msg["role"] = "user"
|
||||
|
||||
print('*'*200)
|
||||
print("Request:")
|
||||
print('*'*200)
|
||||
pprint(request_data)
|
||||
print('='*200)
|
||||
|
||||
async def generate():
|
||||
try:
|
||||
|
|
@ -176,14 +171,10 @@ async def chat_stream(stream_id):
|
|||
complete_request=request_data
|
||||
):
|
||||
if event_type == 'message':
|
||||
print('*'*200)
|
||||
print("Yielding message:")
|
||||
print('*'*200)
|
||||
yield format_sse(event_data, "message")
|
||||
elif event_type == 'done':
|
||||
print('*'*200)
|
||||
print("Yielding done:")
|
||||
print('*'*200)
|
||||
yield format_sse(event_data, "done")
|
||||
|
||||
except Exception as e:
|
||||
|
|
|
|||
|
|
@ -46,6 +46,7 @@ services:
|
|||
environment:
|
||||
- OPENAI_API_KEY=${OPENAI_API_KEY}
|
||||
- API_KEY=${AGENTS_API_KEY}
|
||||
- REDIS_URL=redis://redis:6379
|
||||
restart: unless-stopped
|
||||
|
||||
copilot:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue