背景
由于在网络上未能找到毕昇源码的相关参考资料,我在代码基础较薄弱的情况下学习起来相当吃力。最近趁着工作不忙,我根据毕昇源码的文件结构整理了一份相关文档,希望能帮助到有需要的新手。如有不准确之处,欢迎指正。
bisheng项目文件树获取
安装tree依赖包,使用tree自动生成文件树
Win:
pip install tree
tree
Linux:
sudo apt-get install tree
tree
bisheng项目文件树
bisheng-main
├─docker
│ ├─各个相关技术的docker配置项
│ └─docker-compose.yml 通过docker compose up -d命令启动使用的文件
└─src
├─backend (毕昇的后端代码)
│ ├─bisheng
│ │ ├─api
│ │ │ ├─errcode 存放各功能模块报错的错误码
│ │ │ ├─services (该文件夹下存放的是对应名称的模块的服务类函数)
│ │ │ │ ├─handler 定义对各种表格类文件(.csv、.xls、.xlsx)的分割处理方法
│ │ │ │ ├─tiktoken_file 创建的"cl100k_base"格式的编码器,处理原始文本为数字
│ │ │ │ └─workstation 定义了有关工作台模块的后端代码以及智能搜索的函数定义和调用
│ │ │ ├─v1 (该文件夹下存放的是对应名称的模块的api接口)
│ │ │ │ └─schema 有关shcma模式图的相关类函数
│ │ │ └─v2 (该文件夹下存放的是对应名称的模块的对v1的api接口的补充接口)
│ │ │ └─schema 同上
│ │ ├─cache 定义了redis代理的相关方法函数以及flow、manager的缓存方法
│ │ ├─chat (定义了有关聊天记录的代理,在对话界面加载或保存聊天记录)
│ │ │ └─clients 定义了基础抽象类和基于这个类定义的工作流聊天记录代理类
│ │ ├─components
│ │ │ └─custom_components
│ │ ├─core (创建Celery实例并加载配置,并为特定任务设置专属队列)
│ │ ├─custom (实例化了自定义节点在前端的参数模板)
│ │ ├─database (定义了数据库初始化的配置和创建用户组分配权限等初始化数据库的操作函数)
│ │ │ ├─data
│ │ │ └─models 存放所有模块的对应的数据库模型类以及数据库操作的方法函数
│ │ ├─field_typing 定义了LangChain框架的核心类型和自定义组件支持的类型
│ │ ├─graph
│ │ │ ├─edge 定义了工作流或者技能中组件和组件间连接的边的类和相关函数
│ │ │ ├─graph 定义了通过节点和边构成的图的类和函数
│ │ │ └─vertex定义了图中顶点这个概念的类和函数
│ │ ├─interface (定义了管理和创建LangChain中各种组件的类和函数,实现LangChain组件的动态管理和前端渲染)
│ │ │ ├─agents 有关代理的组件的构建函数和运行
│ │ │ ├─autogenRole 有关毕昇原创的多智能体角色工作链的组件的构建和运行函数
│ │ │ ├─chains 有关工作链的组件的构建函数和运行
│ │ │ ├─custom
│ │ │ │ ├─code_parser 定义了代码解析器的相关函数和方法
│ │ │ │ ├─custom_component 有关组件的后端构成代码
│ │ │ │ └─directory_reader 有关字符串压缩、阅读目录和处理文件等的类和方法
│ │ │ ├─document_loaders 构建了在前端创建文件加载节点或组件的类和方法
│ │ │ ├─embeddings 构建了在前端创建embedding嵌入模型的类和方法
│ │ │ ├─importing 动态加载各种组件所需的langchian依赖
│ │ │ ├─initialize 封装了Vertex AI客户端的初始化流程,定义了实例化各种LangChain组件的函数
│ │ │ ├─inputoutput 构建了在前端创建输入输出节点或组件的类和方法
│ │ │ ├─llms 构建了在前端创建llm节点或组件的类和方法
│ │ │ ├─memories 构建了在前端创建记忆器相关的节点或组件的类和方法
│ │ │ ├─output_parsers 构建了在前端创建输出解析器相关的节点或组件的类和方法
│ │ │ ├─prompts 构建了在前端创建提示词相关的节点或组件的类和方法
│ │ │ ├─retrievers 构建了在前端创建检索器相关的节点或组件的类和方法
│ │ │ ├─text_splitters 构建了在前端创建文本分割器相关的节点或组件的类和方法
│ │ │ ├─toolkits 构建了在前端创建工具箱相关的节点或组件的类和方法
│ │ │ ├─tools 构建了在前端创建工具相关的节点或组件的类和方法
│ │ │ ├─utilities 构建了在前端创建通用工具相关的节点或组件的类和方法
│ │ │ ├─vector_store 构建了在前端创建向量存储相关的节点或组件的类和方法
│ │ │ └─wrappers 构建了在前端创建装饰器相关的节点或组件的类和方法
│ │ ├─mcp_manage (有关mcp工具的代理相关的类和函数)
│ │ │ ├─clients 有关通过两种方式访问mcp服务器获取mcp工具的方法
│ │ │ └─langchain 定义了微服务以标准化工具形式接入LangChain生态的类和函数
│ │ ├─patches 补丁文件
│ │ ├─pptx2md 加入将ppt文件转换为markdown的工具
│ │ ├─processing
│ │ ├─script 解析嵌入模型的脚本文件
│ │ ├─services (构建以下各个模块的服务类的工厂函数)
│ │ │ ├─auth
│ │ │ ├─cache
│ │ │ ├─chat
│ │ │ ├─credentials
│ │ │ ├─database
│ │ │ │ └─models (定义了以下各个模块的数据库表的模型类)
│ │ │ │ ├─api_key
│ │ │ │ ├─component
│ │ │ │ ├─credential
│ │ │ │ ├─flow
│ │ │ │ └─user
│ │ │ ├─plugins
│ │ │ ├─session
│ │ │ ├─settings
│ │ │ ├─store
│ │ │ └─task
│ │ │ └─backends
│ │ ├─template (各个技能组件的前端参数类型和模板)
│ │ │ ├─field
│ │ │ ├─frontend_node
│ │ │ │ └─formatter
│ │ │ └─template
│ │ ├─utils (各种通用工具函数)
│ │ ├─worker
│ │ │ ├─knowledge 定义了有关知识库和qa库操作的函数
│ │ │ ├─test
│ │ │ └─workflow 定义了工作流的各种redis回调函数和任务函数
│ │ └─workflow
│ │ ├─callback 定义了工作流的各种回调函数
│ │ ├─common 工作流相关的各种数据库模型类
│ │ ├─edges 定义了边的管理器的类和相关函数
│ │ ├─graph 定义了工作流的图结构对象的执行等函数
│ │ └─nodes 工作流的各种前端节点的构建函数
│ │ ├─agent
│ │ ├─code
│ │ ├─condition
│ │ ├─end
│ │ ├─input
│ │ ├─llm
│ │ ├─output
│ │ ├─qa_retriever
│ │ ├─rag
│ │ ├─report
│ │ ├─start
│ │ └─tool
│ └─test
├─bisheng-langchain (根据毕昇功能在原生LangChain基础上开发的bisheng-langchian)
│ ├─bisheng_langchain
│ │ ├─agents (定义了两种代理,在ZeroShotAgent零样本代理的基础上加载不同的工具和函数实现)
│ │ │ ├─chatglm_functions_agent
│ │ │ └─llm_functions_agent
│ │ ├─autogen_role 构建了毕昇开发的多智能体角色相关的组件代码
│ │ ├─chains 构建了毕昇在LangChain基础上开发的几种工作链
│ │ │ ├─autogen
│ │ │ ├─combine_documents
│ │ │ ├─conversational_retrieval
│ │ │ ├─qa_generation
│ │ │ ├─question_answering
│ │ │ ├─retrieval
│ │ │ └─router
│ │ ├─chat_models (封装与各家服务商大语言模型进行交互的聊天模型,将各服务端的聊天模型接入到LangChain框架中)
│ │ │ └─interface 封装各家服务商的大模型调用函数流程
│ │ ├─document_loaders (定义了各种非结构化文件数据的拆分和加载)
│ │ │ └─parsers 封装ORC/ELLM的接口,统一处理图像识别场景的请求参数构建、数据编码和响应解析
│ │ ├─embeddings (封装与各家服务商嵌入模型进行交互的模型,将嵌入模型接入到LangChain框架中)
│ │ │ └─interface
│ │ ├─gpts (有关内置工具,还没看完)
│ │ │ ├─agent_types
│ │ │ ├─config
│ │ │ ├─prompts
│ │ │ └─tools
│ │ │ ├─api_tools
│ │ │ ├─bing_search
│ │ │ ├─calculator
│ │ │ ├─code_interpreter
│ │ │ ├─dalle_image_generator
│ │ │ ├─get_current_time
│ │ │ ├─message
│ │ │ └─sql_agent
│ │ ├─input_output
│ │ ├─memory
│ │ ├─rag
│ │ │ ├─api
│ │ │ ├─config
│ │ │ ├─init_retrievers
│ │ │ ├─prompts
│ │ │ ├─qa_corpus
│ │ │ ├─rerank
│ │ │ ├─scoring
│ │ │ └─test
│ │ ├─retrievers
│ │ ├─sql
│ │ ├─utils
│ │ └─vectorstores
│ ├─experimental
│ │ ├─api
│ │ ├─autoplanning
│ │ ├─chatglm3_function_agent
│ │ │ └─Tool
│ │ ├─document_ie
│ │ ├─document_ie_v2
│ │ │ └─scripts
│ │ ├─fin_glm
│ │ │ ├─llmchain
│ │ │ ├─test
│ │ │ ├─type1
│ │ │ ├─type2
│ │ │ └─type3
│ │ ├─others
│ │ └─travel_assistant
│ └─tests
│
│
│
│
└─frontend (毕昇的前端代码)
├─client (也许是毕昇工作台的前端构成代码)
│ ├─public
│ │ ├─assets
│ │ └─fonts
│ ├─src
│ │ ├─@types
│ │ ├─a11y
│ │ ├─common
│ │ ├─components
│ │ │ ├─Artifacts
│ │ │ ├─Audio
│ │ │ ├─Auth
│ │ │ │ └─__tests__
│ │ │ ├─Banners
│ │ │ ├─Bookmarks
│ │ │ ├─Chat
│ │ │ │ ├─Input
│ │ │ │ │ └─Files
│ │ │ │ │ └─Table
│ │ │ │ ├─Menus
│ │ │ │ │ ├─Bookmarks
│ │ │ │ │ ├─Endpoints
│ │ │ │ │ ├─Models
│ │ │ │ │ ├─Presets
│ │ │ │ │ └─UI
│ │ │ │ └─Messages
│ │ │ │ ├─Content
│ │ │ │ │ └─Parts
│ │ │ │ └─ui
│ │ │ ├─Conversations
│ │ │ │ └─ConvoOptions
│ │ │ ├─Endpoints
│ │ │ │ └─Settings
│ │ │ │ └─MultiView
│ │ │ ├─Files
│ │ │ │ ├─FileList
│ │ │ │ └─VectorStore
│ │ │ ├─Input
│ │ │ │ ├─Generations
│ │ │ │ │ └─__tests__
│ │ │ │ ├─ModelSelect
│ │ │ │ └─SetKeyDialog
│ │ │ ├─Messages
│ │ │ │ └─Content
│ │ │ ├─Nav
│ │ │ │ ├─Bookmarks
│ │ │ │ ├─ExportConversation
│ │ │ │ └─SettingsTabs
│ │ │ │ ├─Account
│ │ │ │ │ └─TwoFactorPhases
│ │ │ │ ├─Beta
│ │ │ │ ├─Chat
│ │ │ │ ├─Commands
│ │ │ │ ├─Data
│ │ │ │ ├─General
│ │ │ │ └─Speech
│ │ │ │ ├─STT
│ │ │ │ │ └─__tests__
│ │ │ │ └─TTS
│ │ │ │ └─__tests__
│ │ │ ├─Plugins
│ │ │ │ └─Store
│ │ │ │ └─__tests__
│ │ │ ├─Prompts
│ │ │ │ └─Groups
│ │ │ ├─Share
│ │ │ ├─SidePanel
│ │ │ │ ├─Agents
│ │ │ │ │ ├─ActionsTable
│ │ │ │ │ ├─Code
│ │ │ │ │ └─Sequential
│ │ │ │ ├─Bookmarks
│ │ │ │ ├─Builder
│ │ │ │ │ └─ActionsTable
│ │ │ │ ├─Files
│ │ │ │ └─Parameters
│ │ │ ├─svg
│ │ │ │ └─Files
│ │ │ ├─Tools
│ │ │ └─ui
│ │ ├─data-provider
│ │ │ ├─Agents
│ │ │ ├─Auth
│ │ │ ├─data-provider
│ │ │ │ ├─react-query
│ │ │ │ ├─specs
│ │ │ │ └─src
│ │ │ │ ├─react-query
│ │ │ │ └─types
│ │ │ ├─Endpoints
│ │ │ ├─Files
│ │ │ ├─Messages
│ │ │ ├─Misc
│ │ │ └─Tools
│ │ ├─hooks
│ │ │ ├─Agents
│ │ │ ├─Artifacts
│ │ │ ├─Assistants
│ │ │ ├─Audio
│ │ │ ├─Chat
│ │ │ ├─Config
│ │ │ ├─Conversations
│ │ │ ├─Files
│ │ │ ├─Generic
│ │ │ ├─Input
│ │ │ ├─Messages
│ │ │ ├─Nav
│ │ │ ├─Plugins
│ │ │ ├─Prompts
│ │ │ ├─Roles
│ │ │ └─SSE
│ │ ├─locales
│ │ │ ├─ar
│ │ │ ├─de
│ │ │ ├─en
│ │ │ ├─es
│ │ │ ├─et
│ │ │ ├─fi
│ │ │ ├─fr
│ │ │ ├─he
│ │ │ ├─id
│ │ │ ├─it
│ │ │ ├─ja
│ │ │ ├─ka
│ │ │ ├─ko
│ │ │ ├─nl
│ │ │ ├─pl
│ │ │ ├─pt-BR
│ │ │ ├─pt-PT
│ │ │ ├─ru
│ │ │ ├─sv
│ │ │ ├─tr
│ │ │ ├─vi
│ │ │ ├─zh-Hans
│ │ │ └─zh-Hant
│ │ ├─Providers
│ │ ├─routes
│ │ │ └─Layouts
│ │ ├─store
│ │ └─utils
│ └─test
└─platform (毕昇平台的前端构成代码)
├─public (存放各种静态文件,包括网页登录页和网站icon的图标)
│ ├─assets
│ │ ├─api
│ │ └─knowledge
│ ├─locales (各个模块的的中英语言的提示文本)
│ │ ├─dev 空
│ │ ├─en 英
│ │ └─zh 中
│ ├─models 大模型服务商接口格式下的预置的模型名和类型
│ ├─tabImages
│ └─vditor
└─src
├─alerts (构建了各种情况下的各种通知消息弹窗以及消息下拉菜单)
│ ├─alertDropDown
│ ├─error
│ ├─hooks
│ ├─notice
│ └─success
├─assets 存放技能进行完整性测试后的chat界面的对话头像以及全字体文件
├─components (前端组件的构建)
│ ├─bs-comp
│ │ ├─apiComponent
│ │ ├─cardComponent
│ │ ├─chatComponent
│ │ ├─filterTableDataComponent
│ │ ├─knowledgeUploadComponent
│ │ ├─loadMore
│ │ ├─selectComponent
│ │ ├─sheets
│ │ └─tableComponent
│ ├─bs-icons 存放各种模块的图标以及构建该图标组件的代码,该路径下的文件夹省略
│ ├─bs-ui (实现毕昇前端用到的各种组件,构建结构并填充样式,等待实际调用)
│ │ ├─accordion 实现了一个高性能、可访问的手风琴(Accordion)组件
│ │ ├─alertDialog 实现了一个警报对话框弹窗组件
│ │ ├─badge 实现了一个高度可配置的Badge组件,使用CVA管理多种样式变体,减少重复
│ │ ├─button 实现了一个高度可配置的button按钮组件,类型不同的按钮使用不同样式
│ │ ├─calendar 实现了一个日历组件
│ │ ├─card "构建-应用"页面承载技能/工作流信息的卡片组件
│ │ ├─checkBox 复选框
│ │ ├─dialog 对话框
│ │ ├─editLabel 技能/工作流卡片上的可编辑标签
│ │ ├─input 各种输入框
│ │ ├─label 可复用的标签组件
│ │ ├─pagination 自动分页组件
│ │ ├─popover 弹出框组件
│ │ ├─radio 单选按钮组组件
│ │ ├─select 选择按钮组件(例:工作流/技能的大模型输出之后的赞/踩类评价选择按钮)
│ │ ├─sheet 从右侧滑出的表单类组件(例:"构建-工具-API工具"的创建API工具)
│ │ ├─skeleton用于在数据加载期间显示占位内容,实现周期性明暗变化的动画,表示“加载中”状态
│ │ ├─slider 滑块组件(例:工作流中大模型的温度配置项)
│ │ ├─step 在页面中的步骤指示组件(例:知识库上传文件的界面上方上传步骤)
│ │ ├─switch 页面的滑块组件(例:"系统-角色管理"中修改使用权限的滑块开关)
│ │ ├─table
│ │ ├─tabs
│ │ ├─toast
│ │ ├─tooltip
│ │ └─upload
│ ├─chatComponent
│ │ ├─buildTrigger
│ │ └─chatTrigger
│ ├─codeAreaComponent
│ ├─CrashErrorComponent
│ ├─dictComponent
│ ├─dropdownComponent
│ ├─EditFlowSettingsComponent
│ ├─floatComponent
│ ├─inputComponent
│ ├─inputFileComponent
│ ├─inputListComponent
│ ├─intComponent
│ ├─keypairListComponent
│ ├─Pro
│ │ └─security
│ ├─promptComponent
│ ├─RadialProgress
│ ├─SanitizedHTMLWrapper
│ ├─ShadTooltipComponent
│ ├─textAreaComponent
│ ├─toggleComponent
│ ├─toggleShadComponent
│ ├─ui
│ └─VariablesComponent
├─contexts
├─controllers (前端调用后端API接口的方法)
│ ├─API
│ └─hooks
├─CustomNodes (自定义节点)
│ └─GenericNode
│ └─components
│ └─parameterComponent
├─icons 存放各种模块的图标以及构建该图标组件的代码,该路径下的文件夹省略
├─layout
├─modals
│ ├─baseModal
│ ├─codeAreaModal
│ ├─dictAreaModal
│ ├─EditNodeModal
│ ├─exportModal
│ ├─formModal
│ │ ├─chatInput
│ │ ├─chatMessage
│ │ │ └─codeBlock
│ │ └─fileComponent
│ ├─genericModal
│ ├─L2ParamsModal
│ └─UploadModal
├─pages (通过调用各种组件构建页面)
│ ├─BuildPage
│ │ ├─assistant
│ │ │ └─editAssistant
│ │ ├─bench
│ │ ├─flow
│ │ │ ├─FlowChat
│ │ │ └─FlowNode
│ │ │ └─component
│ │ ├─skills
│ │ │ └─editSkill
│ │ │ ├─CollectionNameComponent
│ │ │ ├─ConnectionLineComponent
│ │ │ ├─DisclosureComponent
│ │ │ ├─extraSidebarComponent
│ │ │ ├─nodeToolbarComponent
│ │ │ ├─PageComponent
│ │ │ └─SelectionMenuComponent
│ │ └─tools
│ │ └─builtInTool
│ ├─ChatAppPage
│ │ └─components
│ ├─DataSetPage
│ ├─DiffFlowPage
│ │ └─components
│ ├─EvaluationPage
│ ├─KnowledgePage
│ │ └─components
│ ├─LabelPage
│ ├─LoginPage
│ │ └─icons
│ ├─LogPage
│ │ ├─systemLog
│ │ ├─useAppLog
│ │ └─utils
│ ├─ModelPage
│ │ ├─components
│ │ └─manage
│ │ └─tabs
│ ├─Report
│ │ └─components
│ └─SystemPage
│ ├─components
│ └─theme
├─store
├─style 存放CSS样式文件
├─types
│ ├─alerts
│ ├─api
│ ├─assistant
│ ├─chat
│ ├─components
│ ├─entities
│ ├─flow
│ ├─tabs
│ ├─templatesContext
│ ├─typesContext
│ └─utils
└─util 通用工具函数