2024-10-28 20:05:06 -04:00
|
|
|
import json
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ARCH_STATE_HEADER = "x-arch-state"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def get_data_chunks(stream, n=1):
|
|
|
|
|
chunks = []
|
|
|
|
|
for chunk in stream.iter_lines():
|
|
|
|
|
if chunk:
|
|
|
|
|
chunk = chunk.decode("utf-8")
|
|
|
|
|
chunk_data_id = chunk[0:6]
|
|
|
|
|
assert chunk_data_id == "data: "
|
|
|
|
|
chunk_data = chunk[6:]
|
|
|
|
|
chunk_data = chunk_data.strip()
|
|
|
|
|
chunks.append(chunk_data)
|
|
|
|
|
if len(chunks) >= n:
|
|
|
|
|
break
|
|
|
|
|
return chunks
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def get_arch_messages(response_json):
|
|
|
|
|
arch_messages = []
|
|
|
|
|
if response_json and "metadata" in response_json:
|
|
|
|
|
# load arch_state from metadata
|
|
|
|
|
arch_state_str = response_json.get("metadata", {}).get(ARCH_STATE_HEADER, "{}")
|
|
|
|
|
# parse arch_state into json object
|
|
|
|
|
arch_state = json.loads(arch_state_str)
|
|
|
|
|
# load messages from arch_state
|
|
|
|
|
arch_messages_str = arch_state.get("messages", "[]")
|
|
|
|
|
# parse messages into json object
|
|
|
|
|
arch_messages = json.loads(arch_messages_str)
|
Rename all arch references to plano across the codebase
Complete rebrand from "Arch"/"archgw" to "Plano" including:
- Config files: arch_config_schema.yaml, workflow, demo configs
- Environment variables: ARCH_CONFIG_* → PLANO_CONFIG_*
- Python CLI: variables, functions, file paths, docker mounts
- Rust crates: config paths, log messages, metadata keys
- Docker/build: Dockerfile, supervisord, .dockerignore, .gitignore
- Docker Compose: volume mounts and env vars across all demos/tests
- GitHub workflows: job/step names
- Shell scripts: log messages
- Demos: Python code, READMEs, VS Code configs, Grafana dashboard
- Docs: RST includes, code comments, config references
- Package metadata: package.json, pyproject.toml, uv.lock
External URLs (docs.archgw.com, github.com/katanemo/archgw) left as-is.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-11 20:15:37 -08:00
|
|
|
# append messages from Plano gateway to history
|
2024-10-28 20:05:06 -04:00
|
|
|
return arch_messages
|
|
|
|
|
return []
|