pixie-prompts 0.1.4__py3-none-any.whl → 0.1.6__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- pixie/prompts/server.py +52 -13
- {pixie_prompts-0.1.4.dist-info → pixie_prompts-0.1.6.dist-info}/METADATA +3 -1
- {pixie_prompts-0.1.4.dist-info → pixie_prompts-0.1.6.dist-info}/RECORD +6 -6
- {pixie_prompts-0.1.4.dist-info → pixie_prompts-0.1.6.dist-info}/WHEEL +0 -0
- {pixie_prompts-0.1.4.dist-info → pixie_prompts-0.1.6.dist-info}/entry_points.txt +0 -0
- {pixie_prompts-0.1.4.dist-info → pixie_prompts-0.1.6.dist-info}/licenses/LICENSE +0 -0
pixie/prompts/server.py
CHANGED
|
@@ -4,11 +4,15 @@ import argparse
|
|
|
4
4
|
import os
|
|
5
5
|
import colorlog
|
|
6
6
|
import logging
|
|
7
|
-
|
|
7
|
+
import webbrowser
|
|
8
|
+
import threading
|
|
9
|
+
import time
|
|
10
|
+
|
|
8
11
|
|
|
9
12
|
import dotenv
|
|
10
|
-
from fastapi import FastAPI
|
|
13
|
+
from fastapi import FastAPI, Request, Response
|
|
11
14
|
from fastapi.middleware.cors import CORSMiddleware
|
|
15
|
+
import httpx
|
|
12
16
|
from strawberry.fastapi import GraphQLRouter
|
|
13
17
|
import uvicorn
|
|
14
18
|
|
|
@@ -120,13 +124,41 @@ def create_app() -> FastAPI:
|
|
|
120
124
|
|
|
121
125
|
app.include_router(graphql_app, prefix="/graphql")
|
|
122
126
|
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
127
|
+
REMOTE_URL = "https://gopixie.ai"
|
|
128
|
+
|
|
129
|
+
@app.api_route("/{path:path}", methods=["GET", "POST", "PUT", "DELETE", "PATCH"])
|
|
130
|
+
async def proxy_all(request: Request, path: str):
|
|
131
|
+
url = f"{REMOTE_URL}/{path}"
|
|
132
|
+
if request.url.query:
|
|
133
|
+
url += f"?{request.url.query}"
|
|
134
|
+
|
|
135
|
+
logger.debug("Proxying request to: %s", url)
|
|
136
|
+
|
|
137
|
+
async with httpx.AsyncClient(follow_redirects=True, timeout=30.0) as client:
|
|
138
|
+
response = await client.request(
|
|
139
|
+
method=request.method,
|
|
140
|
+
url=url,
|
|
141
|
+
headers={
|
|
142
|
+
k: v
|
|
143
|
+
for k, v in request.headers.items()
|
|
144
|
+
if k.lower() not in ["host"]
|
|
145
|
+
},
|
|
146
|
+
content=await request.body(),
|
|
147
|
+
)
|
|
148
|
+
|
|
149
|
+
# Explicitly remove compression-related headers
|
|
150
|
+
headers = {
|
|
151
|
+
k: v
|
|
152
|
+
for k, v in response.headers.items()
|
|
153
|
+
if k.lower()
|
|
154
|
+
not in ["content-encoding", "content-length", "transfer-encoding"]
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
return Response(
|
|
158
|
+
content=response.content,
|
|
159
|
+
status_code=response.status_code,
|
|
160
|
+
headers=headers,
|
|
161
|
+
)
|
|
130
162
|
|
|
131
163
|
return app
|
|
132
164
|
|
|
@@ -163,18 +195,25 @@ def start_server(
|
|
|
163
195
|
logger.info("GraphQL: %s/graphql", server_url)
|
|
164
196
|
|
|
165
197
|
# Display gopixie.ai web link
|
|
166
|
-
encoded_url = quote(f"{server_url}/graphql", safe="")
|
|
167
|
-
pixie_web_url = f"https://gopixie.ai?url={encoded_url}"
|
|
198
|
+
# encoded_url = quote(f"{server_url}/graphql", safe="")
|
|
199
|
+
# pixie_web_url = f"https://gopixie.ai?url={encoded_url}"
|
|
168
200
|
logger.info("")
|
|
169
201
|
logger.info("=" * 60)
|
|
170
202
|
logger.info("")
|
|
171
|
-
logger.info("🎨
|
|
203
|
+
logger.info("🎨 Pixie Web UI:")
|
|
172
204
|
logger.info("")
|
|
173
|
-
logger.info(" %s",
|
|
205
|
+
logger.info(" %s", server_url)
|
|
174
206
|
logger.info("")
|
|
175
207
|
logger.info("=" * 60)
|
|
176
208
|
logger.info("")
|
|
177
209
|
|
|
210
|
+
# Open browser after a short delay (in a separate thread)
|
|
211
|
+
def open_browser():
|
|
212
|
+
time.sleep(1.5) # Wait for server to start
|
|
213
|
+
webbrowser.open(server_url)
|
|
214
|
+
|
|
215
|
+
threading.Thread(target=open_browser, daemon=True).start()
|
|
216
|
+
|
|
178
217
|
uvicorn.run(
|
|
179
218
|
"pixie.prompts.server:create_app",
|
|
180
219
|
host=host,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: pixie-prompts
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.6
|
|
4
4
|
Summary: Code-first, type-safe prompt management
|
|
5
5
|
License: MIT
|
|
6
6
|
License-File: LICENSE
|
|
@@ -15,11 +15,13 @@ Classifier: Programming Language :: Python :: 3.12
|
|
|
15
15
|
Classifier: Programming Language :: Python :: 3.13
|
|
16
16
|
Classifier: Programming Language :: Python :: 3.14
|
|
17
17
|
Provides-Extra: server
|
|
18
|
+
Requires-Dist: brotli (>=1.2.0,<2.0.0) ; extra == "server"
|
|
18
19
|
Requires-Dist: colorlog (>=6.10.1) ; extra == "server"
|
|
19
20
|
Requires-Dist: dotenv (>=0.9.9) ; extra == "server"
|
|
20
21
|
Requires-Dist: fastapi (>=0.128.0) ; extra == "server"
|
|
21
22
|
Requires-Dist: jinja2 (>=3.1.6,<4.0.0)
|
|
22
23
|
Requires-Dist: jsonsubschema (>=0.0.7,<0.0.8)
|
|
24
|
+
Requires-Dist: openai[server] (>=2.15.0,<3.0.0) ; extra == "server"
|
|
23
25
|
Requires-Dist: pydantic (>=2.12.5,<3.0.0)
|
|
24
26
|
Requires-Dist: pydantic-ai-slim (>=1.39.0) ; extra == "server"
|
|
25
27
|
Requires-Dist: strawberry-graphql (>=0.288.1) ; extra == "server"
|
|
@@ -3,11 +3,11 @@ pixie/prompts/file_watcher.py,sha256=YujSP6vo6clkKY_Bwh5faS_EtIupNOZDzEwrOgIwjew
|
|
|
3
3
|
pixie/prompts/graphql.py,sha256=SG0u9rZxxv7yseuk1s3c_iyiCv_Sg3gF5f20G4DzuBw,11801
|
|
4
4
|
pixie/prompts/prompt.py,sha256=7nBn1PCXNOVL6OflHak7MG9rlZ4Ooa14eTamYk2mE3I,11472
|
|
5
5
|
pixie/prompts/prompt_management.py,sha256=gq5Eklqy2_Sq8jATVae4eANNmyFE8s8a9cedxWs2P_Y,2816
|
|
6
|
-
pixie/prompts/server.py,sha256=
|
|
6
|
+
pixie/prompts/server.py,sha256=VXUxOjt7MQA6G06fRLXdFu0fyBkRXbO4RP4xtO7F_AU,7758
|
|
7
7
|
pixie/prompts/storage.py,sha256=syVHO5IWZXtN20ozPoBq_Anbu0NAH056EWbvlNNWLGU,14448
|
|
8
8
|
pixie/prompts/utils.py,sha256=ssAb4HdwZX__Fq50i2-DFsYXD5vpsYEliA_XI8GPx3Y,21929
|
|
9
|
-
pixie_prompts-0.1.
|
|
10
|
-
pixie_prompts-0.1.
|
|
11
|
-
pixie_prompts-0.1.
|
|
12
|
-
pixie_prompts-0.1.
|
|
13
|
-
pixie_prompts-0.1.
|
|
9
|
+
pixie_prompts-0.1.6.dist-info/METADATA,sha256=M8T2-aTf3FxpS2IOzSYswihrwml6q6cModRfBBzI020,1668
|
|
10
|
+
pixie_prompts-0.1.6.dist-info/WHEEL,sha256=3ny-bZhpXrU6vSQ1UPG34FoxZBp3lVcvK0LkgUz6VLk,88
|
|
11
|
+
pixie_prompts-0.1.6.dist-info/entry_points.txt,sha256=SWOSFuUXDxkJMmf28u7E0Go_LcEpofz7NAlV70Cp8Es,48
|
|
12
|
+
pixie_prompts-0.1.6.dist-info/licenses/LICENSE,sha256=nZoehBpdSXe6iTF2ZWzM-fgXdXECUZ0J8LrW_1tBwyk,1064
|
|
13
|
+
pixie_prompts-0.1.6.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|