open-notebook/pages/components/source_insight.py
Luis Novo b7e656a319
Version 1 (#160)
New front-end
Launch Chat API
Manage Sources
Enable re-embedding of all contents
Sources can be added without a notebook now
Improved settings
Enable model selector on all chats
Background processing for better experience
Dark mode
Improved Notes

Improved Docs: 
- Remove all Streamlit references from documentation
- Update deployment guides with React frontend setup
- Fix Docker environment variables format (SURREAL_URL, SURREAL_PASSWORD)
- Update docker image tag from :latest to :v1-latest
- Change navigation references (Settings → Models to just Models)
- Update development setup to include frontend npm commands
- Add MIGRATION.md guide for users upgrading from Streamlit
- Update quick-start guide with correct environment variables
- Add port 5055 documentation for API access
- Update project structure to reflect frontend/ directory
- Remove outdated source-chat documentation files
2025-10-18 12:46:22 -03:00

27 lines
906 B
Python

import asyncio
import nest_asyncio
import streamlit as st
nest_asyncio.apply()
from api.insights_service import insights_service
from open_notebook.domain.notebook import SourceInsight
def source_insight_panel(source, notebook_id=None):
si: SourceInsight = insights_service.get_insight(source)
if not si:
raise ValueError(f"insight not found {source}")
st.subheader(si.insight_type)
with st.container(border=True):
# Get source information by querying the database relationship
source_obj = asyncio.run(si.get_source())
url = f"Navigator?object_id={source_obj.id}"
st.markdown("**Original Source**")
st.markdown(f"{source_obj.title} [link](%s)" % url)
st.markdown(si.content)
if st.button("Delete", type="primary", key=f"delete_insight_{si.id or 'new'}"):
insights_service.delete_insight(si.id or "")
st.rerun()