mirror of
https://github.com/lfnovo/open-notebook.git
synced 2026-04-29 03:50:04 +00:00
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
This commit is contained in:
parent
124d7d110c
commit
b7e656a319
319 changed files with 46747 additions and 7408 deletions
|
|
@ -18,14 +18,15 @@ class TransformationState(TypedDict):
|
|||
|
||||
|
||||
async def run_transformation(state: dict, config: RunnableConfig) -> dict:
|
||||
source: Source = state.get("source")
|
||||
source_obj = state.get("source")
|
||||
source: Source = source_obj if isinstance(source_obj, Source) else None # type: ignore[assignment]
|
||||
content = state.get("input_text")
|
||||
assert source or content, "No content to transform"
|
||||
transformation: Transformation = state["transformation"]
|
||||
if not content:
|
||||
content = source.full_text
|
||||
transformation_template_text = transformation.prompt
|
||||
default_prompts: DefaultPrompts = DefaultPrompts()
|
||||
default_prompts: DefaultPrompts = DefaultPrompts(transformation_instructions=None)
|
||||
if default_prompts.transformation_instructions:
|
||||
transformation_template_text = f"{default_prompts.transformation_instructions}\n\n{transformation_template_text}"
|
||||
|
||||
|
|
@ -34,7 +35,8 @@ async def run_transformation(state: dict, config: RunnableConfig) -> dict:
|
|||
system_prompt = Prompter(template_text=transformation_template_text).render(
|
||||
data=state
|
||||
)
|
||||
payload = [SystemMessage(content=system_prompt)] + [HumanMessage(content=content)]
|
||||
content_str = str(content) if content else ""
|
||||
payload = [SystemMessage(content=system_prompt), HumanMessage(content=content_str)]
|
||||
chain = await provision_langchain_model(
|
||||
str(payload),
|
||||
config.get("configurable", {}).get("model_id"),
|
||||
|
|
@ -45,7 +47,8 @@ async def run_transformation(state: dict, config: RunnableConfig) -> dict:
|
|||
response = await chain.ainvoke(payload)
|
||||
|
||||
# Clean thinking content from the response
|
||||
cleaned_content = clean_thinking_content(response.content)
|
||||
response_content = response.content if isinstance(response.content, str) else str(response.content)
|
||||
cleaned_content = clean_thinking_content(response_content)
|
||||
|
||||
if source:
|
||||
await source.add_insight(transformation.title, cleaned_content)
|
||||
|
|
@ -56,7 +59,7 @@ async def run_transformation(state: dict, config: RunnableConfig) -> dict:
|
|||
|
||||
|
||||
agent_state = StateGraph(TransformationState)
|
||||
agent_state.add_node("agent", run_transformation)
|
||||
agent_state.add_node("agent", run_transformation) # type: ignore[type-var]
|
||||
agent_state.add_edge(START, "agent")
|
||||
agent_state.add_edge("agent", END)
|
||||
graph = agent_state.compile()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue