Spaces:
Runtime error
Runtime error
Create documentos.py
Browse files123456789101112131415161718192021222324252627import streamlit as stfrom modules.utils.supabase_client import sb
class DocumentManager: def __init__(self, ctx): self.ctx = ctx
def render(self): st.header("📄 Documentos") uploaded = st.file_uploader("Sube un documento", type=["pdf","docx","txt"]) if uploaded: path = f"{self.ctx.id}/{uploaded.name}" sb.storage.from_("docs").upload(path, uploaded) url = sb.storage.from_("docs").get_public_url(path) sb.table("documentos").insert({ "empresa_id": self.ctx.id, "usuario_id": self.ctx.id, "nombre": uploaded.name, "url": url }).execute() st.success("Documento guardado!")
docs = sb.table("documentos")\ .select("*")\ .eq("empresa_id", self.ctx.id)\ .execute().data for doc in docs: st.write(f"- [{doc['nombre']}]({doc['url']})")modules/documentos.pyAdded+27