mirror of
https://github.com/MODSetter/SurfSense.git
synced 2025-09-01 18:19:08 +00:00
Merge pull request #175 from MODSetter/dev
refactor(backend): Separated services from utils
This commit is contained in:
commit
5d394f8bc6
14 changed files with 14 additions and 13 deletions
|
@ -14,7 +14,7 @@ from .configuration import Configuration
|
|||
from .state import PodcastTranscriptEntry, State, PodcastTranscripts
|
||||
from .prompts import get_podcast_generation_prompt
|
||||
from app.config import config as app_config
|
||||
from app.utils.llm_service import get_user_long_context_llm
|
||||
from app.services.llm_service import get_user_long_context_llm
|
||||
|
||||
|
||||
async def create_podcast_transcript(state: State, config: RunnableConfig) -> Dict[str, Any]:
|
||||
|
|
|
@ -2,7 +2,7 @@ import asyncio
|
|||
import json
|
||||
from typing import Any, Dict, List
|
||||
|
||||
from app.utils.connector_service import ConnectorService
|
||||
from app.services.connector_service import ConnectorService
|
||||
from langchain_core.messages import HumanMessage, SystemMessage
|
||||
from langchain_core.runnables import RunnableConfig
|
||||
|
||||
|
@ -16,7 +16,7 @@ from .sub_section_writer.configuration import SubSectionType
|
|||
from .qna_agent.graph import graph as qna_agent_graph
|
||||
from .utils import AnswerOutline, get_connector_emoji, get_connector_friendly_name
|
||||
|
||||
from app.utils.query_service import QueryService
|
||||
from app.services.query_service import QueryService
|
||||
|
||||
from langgraph.types import StreamWriter
|
||||
|
||||
|
@ -262,7 +262,7 @@ async def write_answer_outline(state: State, config: RunnableConfig, writer: Str
|
|||
Returns:
|
||||
Dict containing the answer outline in the "answer_outline" key for state update.
|
||||
"""
|
||||
from app.utils.llm_service import get_user_strategic_llm
|
||||
from app.services.llm_service import get_user_strategic_llm
|
||||
from app.db import get_async_session
|
||||
|
||||
streaming_service = state.streaming_service
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
from app.utils.reranker_service import RerankerService
|
||||
from app.services.reranker_service import RerankerService
|
||||
from .configuration import Configuration
|
||||
from langchain_core.runnables import RunnableConfig
|
||||
from .state import State
|
||||
|
@ -85,7 +85,7 @@ async def answer_question(state: State, config: RunnableConfig) -> Dict[str, Any
|
|||
Returns:
|
||||
Dict containing the final answer in the "final_answer" key.
|
||||
"""
|
||||
from app.utils.llm_service import get_user_fast_llm
|
||||
from app.services.llm_service import get_user_fast_llm
|
||||
|
||||
# Get configuration and relevant documents from configuration
|
||||
configuration = Configuration.from_runnable_config(config)
|
||||
|
|
|
@ -5,7 +5,7 @@ from __future__ import annotations
|
|||
from dataclasses import dataclass, field
|
||||
from typing import List, Optional, Any
|
||||
from sqlalchemy.ext.asyncio import AsyncSession
|
||||
from app.utils.streaming_service import StreamingService
|
||||
from app.services.streaming_service import StreamingService
|
||||
|
||||
@dataclass
|
||||
class State:
|
||||
|
|
|
@ -2,7 +2,7 @@ from .configuration import Configuration
|
|||
from langchain_core.runnables import RunnableConfig
|
||||
from .state import State
|
||||
from typing import Any, Dict
|
||||
from app.utils.reranker_service import RerankerService
|
||||
from app.services.reranker_service import RerankerService
|
||||
from .prompts import get_citation_system_prompt, get_no_documents_system_prompt
|
||||
from langchain_core.messages import HumanMessage, SystemMessage
|
||||
from .configuration import SubSectionType
|
||||
|
@ -91,7 +91,7 @@ async def write_sub_section(state: State, config: RunnableConfig) -> Dict[str, A
|
|||
Returns:
|
||||
Dict containing the final answer in the "final_answer" key.
|
||||
"""
|
||||
from app.utils.llm_service import get_user_fast_llm
|
||||
from app.services.llm_service import get_user_fast_llm
|
||||
|
||||
# Get configuration and relevant documents from configuration
|
||||
configuration = Configuration.from_runnable_config(config)
|
||||
|
|
1
surfsense_backend/app/services/__init__.py
Normal file
1
surfsense_backend/app/services/__init__.py
Normal file
|
@ -0,0 +1 @@
|
|||
# Services package
|
|
@ -1,7 +1,7 @@
|
|||
import datetime
|
||||
from langchain.schema import HumanMessage, SystemMessage, AIMessage
|
||||
from app.config import config
|
||||
from app.utils.llm_service import get_user_strategic_llm
|
||||
from app.services.llm_service import get_user_strategic_llm
|
||||
from sqlalchemy.ext.asyncio import AsyncSession
|
||||
from typing import Any, List, Optional
|
||||
|
|
@ -7,7 +7,7 @@ from app.schemas import ExtensionDocumentContent
|
|||
from app.config import config
|
||||
from app.prompts import SUMMARY_PROMPT_TEMPLATE
|
||||
from app.utils.document_converters import convert_document_to_markdown, generate_content_hash
|
||||
from app.utils.llm_service import get_user_long_context_llm
|
||||
from app.services.llm_service import get_user_long_context_llm
|
||||
from langchain_core.documents import Document as LangChainDocument
|
||||
from langchain_community.document_loaders import FireCrawlLoader, AsyncChromiumLoader
|
||||
from langchain_community.document_transformers import MarkdownifyTransformer
|
||||
|
|
|
@ -6,7 +6,7 @@ from datetime import datetime, timedelta, timezone
|
|||
from app.db import Document, DocumentType, Chunk, SearchSourceConnector, SearchSourceConnectorType, SearchSpace
|
||||
from app.config import config
|
||||
from app.prompts import SUMMARY_PROMPT_TEMPLATE
|
||||
from app.utils.llm_service import get_user_long_context_llm
|
||||
from app.services.llm_service import get_user_long_context_llm
|
||||
from app.connectors.slack_history import SlackHistory
|
||||
from app.connectors.notion_history import NotionHistoryConnector
|
||||
from app.connectors.github_connector import GitHubConnector
|
||||
|
|
|
@ -3,7 +3,7 @@ from uuid import UUID
|
|||
|
||||
from app.agents.researcher.graph import graph as researcher_graph
|
||||
from app.agents.researcher.state import State
|
||||
from app.utils.streaming_service import StreamingService
|
||||
from app.services.streaming_service import StreamingService
|
||||
from sqlalchemy.ext.asyncio import AsyncSession
|
||||
|
||||
from app.agents.researcher.configuration import SearchMode
|
||||
|
|
Loading…
Add table
Reference in a new issue