Files
devops-portal/ui.py
2026-04-07 18:53:46 +03:00

39 lines
1.7 KiB
Python
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import streamlit as st
import requests
st.set_page_config(page_title="AI DevOps Assistant", layout="wide")
st.title("🚀 CI/CD AI Generator & Validator")
st.subheader("Генерация и проверка конфигураций пайплайнов")
backend_url = "http://localhost:8000/generate_config"
with st.sidebar:
st.info("Настройки")
model_name = st.selectbox("Выберите модель Ollama", ["codellama", "llama3", "mistral"])
task = st.text_area("Опишите задачу (напр. 'Pipeline for Dockerized Node.js app with Jest tests'):")
if st.button("Сгенерировать и проверить"):
if task:
with st.spinner("ИИ формирует конфигурацию..."):
res = requests.post(backend_url, json={"task_description": task, "model": model_name})
if res.status_code == 200:
data = res.json()
col1, col2 = st.columns(2)
with col1:
st.markdown("### Сгенерированный YAML")
st.code(data["config"], language="yaml")
with col2:
st.markdown("### Статус валидации")
if data["is_valid"]:
st.success("✅ Конфигурация синтаксически верна")
else:
st.error(f"❌ Ошибка в YAML: {data['validation_message']}")
else:
st.error("Ошибка связи с бекендом")
else:
st.warning("Введите описание задачи")