From 4520fb42b6d87136bd897af1f9580bb18204b5c3 Mon Sep 17 00:00:00 2001 From: Alexander Myasoedov Date: Wed, 11 Dec 2024 20:32:42 +0200 Subject: [PATCH] feat(split static): --- agentic_security/routes/static.py | 6 +++ agentic_security/static/base.js | 68 ++++++++++++++++++++++++++++ agentic_security/static/index.html | 1 + agentic_security/static/main.js | 72 ------------------------------ 4 files changed, 75 insertions(+), 72 deletions(-) create mode 100644 agentic_security/static/base.js diff --git a/agentic_security/routes/static.py b/agentic_security/routes/static.py index d36ce31..f14dd70 100644 --- a/agentic_security/routes/static.py +++ b/agentic_security/routes/static.py @@ -69,6 +69,12 @@ async def main_js() -> FileResponse: return get_static_file(STATIC_DIR / "main.js") +@router.get("/base.js") +async def base_js() -> FileResponse: + """Serve the base JavaScript file.""" + return get_static_file(STATIC_DIR / "base.js") + + @router.get("/telemetry.js") async def telemetry_js() -> FileResponse: """ diff --git a/agentic_security/static/base.js b/agentic_security/static/base.js new file mode 100644 index 0000000..d36ad7a --- /dev/null +++ b/agentic_security/static/base.js @@ -0,0 +1,68 @@ + +let URL = window.location.href; +if (URL.endsWith('/')) { + URL = URL.slice(0, -1); +} +URL = URL.replace('/#', ''); + +// Vue application +let LLM_SPECS = [ + `POST ${URL}/v1/self-probe +Authorization: Bearer XXXXX +Content-Type: application/json + +{ +"prompt": "<>" +} + +`, + `POST https://api.openai.com/v1/chat/completions +Authorization: Bearer sk-xxxxxxxxx +Content-Type: application/json + +{ +"model": "gpt-3.5-turbo", +"messages": [{"role": "user", "content": "<>"}], +"temperature": 0.7 +} +`, + `POST https://api.replicate.com/v1/models/mistralai/mixtral-8x7b-instruct-v0.1/predictions +Authorization: Bearer $APIKEY +Content-Type: application/json + +{ +"input": { +"top_k": 50, +"top_p": 0.9, +"prompt": "Write a bedtime story about neural networks I can read to my toddler", +"temperature": 0.6, +"max_new_tokens": 1024, +"prompt_template": "[INST] <> [/INST] ", +"presence_penalty": 0, +"frequency_penalty": 0 +} +} +`, + `POST https://api.groq.com/v1/request_manager/text_completion +Authorization: Bearer $APIKEY +Content-Type: application/json + +{ +"model_id": "codellama-34b", +"system_prompt": "You are helpful and concise coding assistant", +"user_prompt": "<>" +} +`, + `POST https://api.together.xyz/v1/chat/completions +Authorization: Bearer $TOGETHER_API_KEY +Content-Type: application/json + +{ +"model": "mistralai/Mixtral-8x7B-Instruct-v0.1", +"messages": [ +{"role": "system", "content": "You are an expert travel guide"}, +{"role": "user", "content": "<>"} +] +} +`, +] diff --git a/agentic_security/static/index.html b/agentic_security/static/index.html index a7e7ed2..3ab7dd7 100644 --- a/agentic_security/static/index.html +++ b/agentic_security/static/index.html @@ -467,6 +467,7 @@ +