Spaces:
Running
Running
Link to Streamlit.
Browse files
examples/LynxScribe/MCP/Demo.lynxkite.json
CHANGED
|
@@ -297,16 +297,16 @@
|
|
| 297 |
},
|
| 298 |
{
|
| 299 |
"data": {
|
| 300 |
-
"collapsed":
|
| 301 |
"display": {
|
| 302 |
"dataframes": {
|
| 303 |
"service": {
|
| 304 |
"columns": [
|
| 305 |
-
"
|
| 306 |
],
|
| 307 |
"data": [
|
| 308 |
[
|
| 309 |
-
"
|
| 310 |
]
|
| 311 |
]
|
| 312 |
}
|
|
@@ -343,14 +343,14 @@
|
|
| 343 |
"title": "Chat frontend"
|
| 344 |
},
|
| 345 |
"dragHandle": ".drag-handle",
|
| 346 |
-
"height":
|
| 347 |
"id": "Chat frontend 1",
|
| 348 |
"position": {
|
| 349 |
-
"x": -
|
| 350 |
-
"y": -
|
| 351 |
},
|
| 352 |
"type": "service",
|
| 353 |
-
"width":
|
| 354 |
},
|
| 355 |
{
|
| 356 |
"data": {
|
|
|
|
| 297 |
},
|
| 298 |
{
|
| 299 |
"data": {
|
| 300 |
+
"collapsed": false,
|
| 301 |
"display": {
|
| 302 |
"dataframes": {
|
| 303 |
"service": {
|
| 304 |
"columns": [
|
| 305 |
+
"markdown"
|
| 306 |
],
|
| 307 |
"data": [
|
| 308 |
[
|
| 309 |
+
"[Go to frontend](http://localhost:8501/?service=%2Fapi%2Fservice%2Flynxkite_graph_analytics%2FLynxScribe%2FMCP%2FDemo.lynxkite.json%2FChat+frontend+1/chat/completions)"
|
| 310 |
]
|
| 311 |
]
|
| 312 |
}
|
|
|
|
| 343 |
"title": "Chat frontend"
|
| 344 |
},
|
| 345 |
"dragHandle": ".drag-handle",
|
| 346 |
+
"height": 117.0,
|
| 347 |
"id": "Chat frontend 1",
|
| 348 |
"position": {
|
| 349 |
+
"x": -1.8364143940130049,
|
| 350 |
+
"y": -692.5252605263688
|
| 351 |
},
|
| 352 |
"type": "service",
|
| 353 |
+
"width": 169.0
|
| 354 |
},
|
| 355 |
{
|
| 356 |
"data": {
|
examples/LynxScribe/MCP/demo.py
CHANGED
|
@@ -9,6 +9,8 @@ from mcp.client.stdio import stdio_client
|
|
| 9 |
from lynxscribe.components.task_solver import TaskSolver
|
| 10 |
from lynxscribe.core.models.prompts import Function, Tool
|
| 11 |
|
|
|
|
|
|
|
| 12 |
lsop = ops.op_registration(
|
| 13 |
"LynxKite Graph Analytics", "LynxScribe", dir="bottom-to-top", color="blue"
|
| 14 |
)
|
|
@@ -135,6 +137,9 @@ class Agent:
|
|
| 135 |
max_tool_call_steps=999,
|
| 136 |
)
|
| 137 |
|
|
|
|
|
|
|
|
|
|
| 138 |
async def get(self, request: fastapi.Request) -> dict:
|
| 139 |
if request.state.remaining_path == "models":
|
| 140 |
return {
|
|
|
|
| 9 |
from lynxscribe.components.task_solver import TaskSolver
|
| 10 |
from lynxscribe.core.models.prompts import Function, Tool
|
| 11 |
|
| 12 |
+
FRONTEND_URL = "http://localhost:8501/"
|
| 13 |
+
|
| 14 |
lsop = ops.op_registration(
|
| 15 |
"LynxKite Graph Analytics", "LynxScribe", dir="bottom-to-top", color="blue"
|
| 16 |
)
|
|
|
|
| 137 |
max_tool_call_steps=999,
|
| 138 |
)
|
| 139 |
|
| 140 |
+
def get_description(self, url: str) -> str:
|
| 141 |
+
return f"[Go to frontend]({FRONTEND_URL}?service={url}/chat/completions)"
|
| 142 |
+
|
| 143 |
async def get(self, request: fastapi.Request) -> dict:
|
| 144 |
if request.state.remaining_path == "models":
|
| 145 |
return {
|
examples/LynxScribe/MCP/ui/main.py
CHANGED
|
@@ -1,7 +1,8 @@
|
|
| 1 |
import streamlit as st
|
| 2 |
import requests
|
| 3 |
|
| 4 |
-
|
|
|
|
| 5 |
|
| 6 |
st.title("LynxScribe Task Solver")
|
| 7 |
|
|
@@ -21,7 +22,7 @@ if question:
|
|
| 21 |
"stream": False,
|
| 22 |
"messages": [{"role": "user", "content": question}],
|
| 23 |
}
|
| 24 |
-
response = requests.post(
|
| 25 |
if response.ok:
|
| 26 |
st.write("\n".join(c["message"]["content"] for c in response.json()["choices"]))
|
| 27 |
else:
|
|
|
|
| 1 |
import streamlit as st
|
| 2 |
import requests
|
| 3 |
|
| 4 |
+
node_url = st.query_params["service"]
|
| 5 |
+
api_url = f"http://localhost:8000{node_url}"
|
| 6 |
|
| 7 |
st.title("LynxScribe Task Solver")
|
| 8 |
|
|
|
|
| 22 |
"stream": False,
|
| 23 |
"messages": [{"role": "user", "content": question}],
|
| 24 |
}
|
| 25 |
+
response = requests.post(api_url, json=payload)
|
| 26 |
if response.ok:
|
| 27 |
st.write("\n".join(c["message"]["content"] for c in response.json()["choices"]))
|
| 28 |
else:
|