Showing preview only (740K chars total). Download the full file or copy to clipboard to get everything.
Repository: AIDotNet/GraphRag.Net
Branch: main
Commit: ca82ac4dbf6b
Files: 126
Total size: 681.4 KB
Directory structure:
gitextract_nfiuwx4k/
├── .github/
│ └── workflows/
│ └── nuget-publish.yml
├── .gitignore
├── Directory.Build.props
├── GraphRag.Net.sln
├── LICENSE
├── README.en.md
├── README.md
└── src/
├── GraphRag.Net/
│ ├── Common/
│ │ ├── Options/
│ │ │ ├── GraphDBConnectionOption.cs
│ │ │ ├── GraphOpenAIOption.cs
│ │ │ ├── GraphSearchOption.cs
│ │ │ ├── GraphSysOption.cs
│ │ │ └── TextChunkerOption.cs
│ │ └── ServiceDescriptionAttribute.cs
│ ├── Domain/
│ │ ├── Interface/
│ │ │ ├── ICommunityDetectionService.cs
│ │ │ ├── IGraphService.cs
│ │ │ └── ISemanticService.cs
│ │ ├── Model/
│ │ │ ├── Graph/
│ │ │ │ ├── Graph.cs
│ │ │ │ ├── GraphModel.cs
│ │ │ │ ├── GraphViewModel.cs
│ │ │ │ ├── RelationShipModel.cs
│ │ │ │ └── TextMemModel.cs
│ │ │ └── PageList.cs
│ │ └── Service/
│ │ ├── CommunityDetectionService.cs
│ │ ├── GraphService.cs
│ │ └── SemanticService.cs
│ ├── Extensions/
│ │ └── ServiceCollectionExtensions.cs
│ ├── GraphRag.Net.csproj
│ ├── Repositories/
│ │ ├── Base/
│ │ │ ├── IRepository.cs
│ │ │ ├── Repository.cs
│ │ │ └── SqlSugarHelper.cs
│ │ └── Graph/
│ │ ├── CommunitieNodes/
│ │ │ ├── CommunitieNodes.cs
│ │ │ ├── CommunitieNodes_Repositories.cs
│ │ │ └── ICommunitieNodes_Repositories.cs
│ │ ├── Communities/
│ │ │ ├── Communities.cs
│ │ │ ├── Communities_Repositories.cs
│ │ │ └── ICommunities_Repositories.cs
│ │ ├── Edges/
│ │ │ ├── Edges.cs
│ │ │ ├── Edges_Repositories.cs
│ │ │ └── IEdges_Repositories.cs
│ │ ├── Global/
│ │ │ ├── Globals.cs
│ │ │ ├── Globals_Repositories.cs
│ │ │ └── IGlobals_Repositories.cs
│ │ └── Nodes/
│ │ ├── INodes_Repositories.cs
│ │ ├── Nodes.cs
│ │ └── Nodes_Repositories.cs
│ └── Utils/
│ ├── ConvertUtils.cs
│ ├── OpenAIHttpClientHandler.cs
│ └── RepoUtils/
│ ├── AppException.cs
│ ├── ObjectExtensions.cs
│ └── RepoFiles.cs
└── GraphRag.Net.Web/
├── .config/
│ └── dotnet-tools.json
├── App.razor
├── Components/
│ └── GlobalHeader/
│ ├── RightContent.razor
│ └── RightContent.razor.cs
├── Controllers/
│ └── GraphController.cs
├── Extensions/
│ └── DateTimeExtension.cs
├── GraphRag.Net.Web.csproj
├── GraphRag.Net.Web.xml
├── Layouts/
│ ├── BasicLayout.razor
│ ├── UserLayout.razor
│ └── UserLayout.razor.css
├── Mock/
│ ├── MockChatCompletion.cs
│ ├── MockTextCompletion.cs
│ └── MockTextEmbeddingGeneratorService.cs
├── Models/
│ ├── ActivitiesType.cs
│ ├── ActivityGroup.cs
│ ├── ActivityProject.cs
│ ├── ActivityUser.cs
│ ├── AdvancedOperation.cs
│ ├── AdvancedProfileData.cs
│ ├── BasicGood.cs
│ ├── BasicProfileDataType.cs
│ ├── BasicProgress.cs
│ ├── ChartData.cs
│ ├── ChartDataItem.cs
│ ├── ChatMessage.cs
│ ├── CurrentUser.cs
│ ├── FormItemLayout.cs
│ ├── FormModel.cs
│ ├── LayoutModel.cs
│ ├── ListFormModel.cs
│ ├── ListItemDataType.cs
│ ├── LoginParamsType.cs
│ ├── NoticeItem.cs
│ ├── NoticeType.cs
│ ├── OfflineChartDataItem.cs
│ ├── OfflineDataItem.cs
│ ├── RadarDataItem.cs
│ └── SearchDataItem.cs
├── Pages/
│ ├── Graph/
│ │ ├── Chat.razor
│ │ ├── Chat.razor.cs
│ │ └── Graph.razor
│ ├── Index.razor
│ └── _Host.cshtml
├── Program.cs
├── Utils/
│ └── LongToDateTimeConverter.cs
├── _Imports.razor
├── appsettings.json
├── graphPlugins/
│ └── graph/
│ ├── community_search/
│ │ ├── config.json
│ │ └── skprompt.txt
│ ├── community_summaries/
│ │ ├── config.json
│ │ └── skprompt.txt
│ ├── create/
│ │ ├── config.json
│ │ └── skprompt.txt
│ ├── global_summaries/
│ │ ├── config.json
│ │ └── skprompt.txt
│ ├── mergedesc/
│ │ ├── config.json
│ │ └── skprompt.txt
│ ├── relationship/
│ │ ├── config.json
│ │ └── skprompt.txt
│ └── search/
│ ├── config.json
│ └── skprompt.txt
└── wwwroot/
├── appsettings.json
├── css/
│ └── site.css
├── data/
│ ├── activities.json
│ ├── advanced.json
│ ├── basic.json
│ ├── current_user.json
│ ├── fake_chart_data.json
│ ├── fake_list.json
│ ├── menu.json
│ ├── notice.json
│ └── notices.json
├── index.html
└── js/
├── relation-graph.umd.js
└── vue2.js
================================================
FILE CONTENTS
================================================
================================================
FILE: .github/workflows/nuget-publish.yml
================================================
name: main
on:
push:
branches:
- main
paths:
- 'Directory.Build.props'
jobs:
deploy-nuget:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Build
run: dotnet build --configuration Release
- name: Pack
run: dotnet pack --no-build --configuration Release
- name: Push NuGet package
run: |
dotnet nuget push **/*.nupkg --skip-duplicate --source https://api.nuget.org/v3/index.json --api-key ${{ vars.XUZEYU }}
================================================
FILE: .gitignore
================================================
## Ignore Visual Studio temporary files, build results, and
## files generated by popular Visual Studio add-ons.
##
## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore
# User-specific files
*.suo
*.user
*.userosscache
*.sln.docstates
# User-specific files (MonoDevelop/Xamarin Studio)
*.userprefs
# Build results
[Dd]ebug/
[Dd]ebugPublic/
[Rr]elease/
[Rr]eleases/
x64/
x86/
bld/
[Bb]in/
[Oo]bj/
[Ll]og/
# Visual Studio 2015/2017 cache/options directory
.vs/
# Uncomment if you have tasks that create the project's static files in wwwroot
#wwwroot/
# Visual Studio 2017 auto generated files
Generated\ Files/
# MSTest test Results
[Tt]est[Rr]esult*/
[Bb]uild[Ll]og.*
# NUNIT
*.VisualState.xml
TestResult.xml
# Build Results of an ATL Project
[Dd]ebugPS/
[Rr]eleasePS/
dlldata.c
# Benchmark Results
BenchmarkDotNet.Artifacts/
# .NET Core
project.lock.json
project.fragment.lock.json
artifacts/
**/Properties/launchSettings.json
# StyleCop
StyleCopReport.xml
# Files built by Visual Studio
*_i.c
*_p.c
*_i.h
*.ilk
*.meta
*.bin
*.Debug
*.obj
*.iobj
*.pch
*.pdb
*.ipdb
*.pgc
*.pgd
*.rsp
*.sbr
*.tlb
*.tli
*.tlh
*.tmp
*.tmp_proj
*.log
*.vspscc
*.vssscc
.builds
*.pidb
*.svclog
*.scc
# Chutzpah Test files
_Chutzpah*
# Visual C++ cache files
ipch/
*.aps
*.ncb
*.opendb
*.opensdf
*.sdf
*.cachefile
*.VC.db
*.VC.VC.opendb
# Visual Studio profiler
*.psess
*.vsp
*.vspx
*.sap
# Visual Studio Trace Files
*.e2e
# TFS 2012 Local Workspace
$tf/
# Guidance Automation Toolkit
*.gpState
# ReSharper is a .NET coding add-in
_ReSharper*/
*.[Rr]e[Ss]harper
*.DotSettings.user
# JustCode is a .NET coding add-in
.JustCode
# TeamCity is a build add-in
_TeamCity*
# DotCover is a Code Coverage Tool
*.dotCover
# AxoCover is a Code Coverage Tool
.axoCover/*
!.axoCover/settings.json
# Visual Studio code coverage results
*.coverage
*.coveragexml
# NCrunch
_NCrunch_*
.*crunch*.local.xml
nCrunchTemp_*
# MightyMoose
*.mm.*
AutoTest.Net/
# Web workbench (sass)
.sass-cache/
# Installshield output folder
[Ee]xpress/
# DocProject is a documentation generator add-in
DocProject/buildhelp/
DocProject/Help/*.HxT
DocProject/Help/*.HxC
DocProject/Help/*.hhc
DocProject/Help/*.hhk
DocProject/Help/*.hhp
DocProject/Help/Html2
DocProject/Help/html
# Click-Once directory
publish/
# Publish Web Output
*.[Pp]ublish.xml
*.azurePubxml
# Note: Comment the next line if you want to checkin your web deploy settings,
# but database connection strings (with potential passwords) will be unencrypted
*.pubxml
*.publishproj
# Microsoft Azure Web App publish settings. Comment the next line if you want to
# checkin your Azure Web App publish settings, but sensitive information contained
# in these scripts will be unencrypted
PublishScripts/
# NuGet Packages
*.nupkg
# The packages folder can be ignored because of Package Restore
**/[Pp]ackages/*
# except build/, which is used as an MSBuild target.
!**/[Pp]ackages/build/
# Uncomment if necessary however generally it will be regenerated when needed
#!**/[Pp]ackages/repositories.config
# NuGet v3's project.json files produces more ignorable files
*.nuget.props
*.nuget.targets
# Microsoft Azure Build Output
csx/
*.build.csdef
# Microsoft Azure Emulator
ecf/
rcf/
# Windows Store app package directories and files
AppPackages/
BundleArtifacts/
Package.StoreAssociation.xml
_pkginfo.txt
*.appx
# Visual Studio cache files
# files ending in .cache can be ignored
*.[Cc]ache
# but keep track of directories ending in .cache
!*.[Cc]ache/
# Others
ClientBin/
~$*
*~
*.dbmdl
*.dbproj.schemaview
*.jfm
*.pfx
*.publishsettings
orleans.codegen.cs
# Including strong name files can present a security risk
# (https://github.com/github/gitignore/pull/2483#issue-259490424)
#*.snk
# Since there are multiple workflows, uncomment next line to ignore bower_components
# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
#bower_components/
# RIA/Silverlight projects
Generated_Code/
# Backup & report files from converting an old project file
# to a newer Visual Studio version. Backup files are not needed,
# because we have git ;-)
_UpgradeReport_Files/
Backup*/
UpgradeLog*.XML
UpgradeLog*.htm
ServiceFabricBackup/
# SQL Server files
*.mdf
*.ldf
*.ndf
# Business Intelligence projects
*.rdl.data
*.bim.layout
*.bim_*.settings
*.rptproj.rsuser
# Microsoft Fakes
FakesAssemblies/
# GhostDoc plugin setting file
*.GhostDoc.xml
# Node.js Tools for Visual Studio
.ntvs_analysis.dat
node_modules/
# Visual Studio 6 build log
*.plg
# Visual Studio 6 workspace options file
*.opt
# Visual Studio 6 auto-generated workspace file (contains which files were open etc.)
*.vbw
# Visual Studio LightSwitch build output
**/*.HTMLClient/GeneratedArtifacts
**/*.DesktopClient/GeneratedArtifacts
**/*.DesktopClient/ModelManifest.xml
**/*.Server/GeneratedArtifacts
**/*.Server/ModelManifest.xml
_Pvt_Extensions
# Paket dependency manager
.paket/paket.exe
paket-files/
# FAKE - F# Make
.fake/
# JetBrains Rider
.idea/
*.sln.iml
# CodeRush
.cr/
# Python Tools for Visual Studio (PTVS)
__pycache__/
*.pyc
# Cake - Uncomment if you are using it
# tools/**
# !tools/packages.config
# Tabs Studio
*.tss
# Telerik's JustMock configuration file
*.jmconfig
# BizTalk build output
*.btp.cs
*.btm.cs
*.odx.cs
*.xsd.cs
# OpenCover UI analysis results
OpenCover/
# Azure Stream Analytics local run output
ASALocalRun/
# MSBuild Binary and Structured Log
*.binlog
# MFractors (Xamarin productivity tool) working folder
.mfractor/
**/bin/
**/obj/
**/.vs/
/src/GraphRag.Net.Web/appsettings.Development.json
**/tmp-memory-files/
**/tmp-memory-vectors/
/src/GraphRag.Net.Web/graph.db
/src/GraphRag.Net.Web/graphmem.db
/db
/src/GraphRag.Net/GraphRag.Net.xml
================================================
FILE: Directory.Build.props
================================================
<Project>
<!-- See https://aka.ms/dotnet/msbuild/customize for more details on customizing your build -->
<PropertyGroup>
<Version>0.2.0</Version>
<SKVersion>1.17.1</SKVersion>
</PropertyGroup>
</Project>
================================================
FILE: GraphRag.Net.sln
================================================
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.10.35027.167
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "GraphRag.Net.Web", "src\GraphRag.Net.Web\GraphRag.Net.Web.csproj", "{8C4B0AA1-7083-4BEA-9F12-2C20CDDB8426}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "GraphRag.Net", "src\GraphRag.Net\GraphRag.Net.csproj", "{214FF6B8-E291-4CC8-94BC-16C1CD9DB3B8}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "解决方案项", "解决方案项", "{A35F9835-DFCF-478A-9F24-E0B350161746}"
ProjectSection(SolutionItems) = preProject
Directory.Build.props = Directory.Build.props
.github\workflows\nuget-publish.yml = .github\workflows\nuget-publish.yml
README.md = README.md
EndProjectSection
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{8C4B0AA1-7083-4BEA-9F12-2C20CDDB8426}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{8C4B0AA1-7083-4BEA-9F12-2C20CDDB8426}.Debug|Any CPU.Build.0 = Debug|Any CPU
{8C4B0AA1-7083-4BEA-9F12-2C20CDDB8426}.Release|Any CPU.ActiveCfg = Release|Any CPU
{8C4B0AA1-7083-4BEA-9F12-2C20CDDB8426}.Release|Any CPU.Build.0 = Release|Any CPU
{214FF6B8-E291-4CC8-94BC-16C1CD9DB3B8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{214FF6B8-E291-4CC8-94BC-16C1CD9DB3B8}.Debug|Any CPU.Build.0 = Debug|Any CPU
{214FF6B8-E291-4CC8-94BC-16C1CD9DB3B8}.Release|Any CPU.ActiveCfg = Release|Any CPU
{214FF6B8-E291-4CC8-94BC-16C1CD9DB3B8}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {7892D425-42B4-4F17-B17A-38825D88FA7B}
EndGlobalSection
EndGlobal
================================================
FILE: LICENSE
================================================
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright [2024] [许泽宇]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
================================================
FILE: README.en.md
================================================
[简体中文](./README.md) | English
## This is a simple implementation of dotnet referring to GraphRag
Based on the implementation idea mentioned by Microsoft in the paper, GraphRAG mainly implements the following functions in the execution process:
- Source Documents → Text Chunks: divide the source document into text blocks.
- Text Chunks → Element Instances: Extract instances of graph nodes and edges from each text block.
- Element Instances → Element Summaries: generate summaries for each diagram element.
- Element Summaries → Graph Communities: use the community detection algorithm to divide the graph into communities.
- Graph Communities → Community Summaries: generate summaries for each community.
- Community Summaries → Community Answers → Global Answer: use community summaries to generate local answers, and then summarize these local answers to generate global answers.
This project is a demo example, which is only used to learn GraphRAG ideas.
## Core Business Process
### 1. Overall Architecture Flow
```mermaid
graph LR
A["Document Import"] --> B["Graph Construction"]
B --> C["Community Detection"]
C --> D["Summary Generation"]
D --> E["Query Retrieval"]
subgraph "Data Flow"
F["Raw Documents"] --> G["Text Chunks"]
G --> H["Graph Data<br/>Nodes+Edges"]
H --> I["Community Structure"]
I --> J["Multi-level Summaries"]
J --> K["Intelligent Q&A"]
end
subgraph "Storage Layer"
L["Vector Database<br/>TextMemory"]
M["Relational Database<br/>Nodes/Edges/Communities/Globals"]
end
B -.-> L
B -.-> M
C -.-> M
D -.-> M
E -.-> L
E -.-> M
style A fill:#e1f5fe
style E fill:#c8e6c9
style L fill:#fce4ec
style M fill:#fff9c4
```
### 2. Document Import and Graph Construction Flow
```mermaid
graph TD
A["Document Input<br/>Raw Documents/Text"] --> B["Text Chunking<br/>TextChunker.SplitPlainTextLines<br/>TextChunker.SplitPlainTextParagraphs"]
B --> C["Overlapping Text Chunks<br/>CreateOverlappingChunks<br/>3 paragraphs/chunk, 1 paragraph overlap"]
C --> D["LLM Extract Graph Data<br/>SemanticService.CreateGraphAsync"]
D --> E["Node Extraction<br/>Entity Recognition+Type Classification"]
D --> F["Relationship Extraction<br/>Edges and Relationship Description"]
E --> G["Node Deduplication<br/>Vector Similarity Detection"]
F --> H["Relationship Deduplication<br/>Duplicate Edge Processing"]
G --> I["Store to Database<br/>Nodes Table"]
H --> J["Store to Database<br/>Edges Table"]
I --> K["Vector Storage<br/>TextMemory.SaveInformationAsync"]
J --> L["Orphan Node Detection<br/>ProcessOrphanNodesAsync"]
L --> M["Graph Construction Complete"]
style A fill:#e1f5fe
style M fill:#c8e6c9
style D fill:#fff3e0
style K fill:#fce4ec
```
### 3. Community Detection and Summary Generation Flow
```mermaid
graph TD
A["Graph Data<br/>Nodes + Edges"] --> B["Build Graph Structure<br/>Graph.AddEdge"]
B --> C["Label Propagation Algorithm<br/>FastLabelPropagationAlgorithm<br/>10 iterations"]
C --> D["Community Detection Results<br/>Node→Community ID Mapping"]
D --> E["Store Community Node Relations<br/>CommunitieNodes Table"]
E --> F["Group Nodes by Community<br/>Extract Node Description"]
F --> G["LLM Generate Community Summary<br/>SemanticService.CommunitySummaries"]
G --> H["Store Community Summary<br/>Communities Table"]
H --> I["Collect All Community Summaries"]
I --> J["LLM Generate Global Summary<br/>SemanticService.GlobalSummaries"]
J --> K["Store Global Summary<br/>Globals Table"]
style A fill:#e1f5fe
style C fill:#fff3e0
style G fill:#fff3e0
style J fill:#fff3e0
style K fill:#c8e6c9
```
### 4. Direct Graph Query Flow
```mermaid
graph TD
A["User Query<br/>Question Input"] --> B["Vector Search<br/>TextMemory.SearchAsync<br/>Relevance Threshold 0.5"]
B --> C{"Nodes Matched?"}
C -->|Yes| D["Get Related Nodes<br/>RetrieveTextMemModelList"]
C -->|No| E["Retry with Lower Threshold<br/>Threshold 0.3, Expand Search"]
E --> D
D --> F["Recursive Graph Expansion<br/>GetGraphAllRecursion<br/>Depth Limit+Node Count Limit"]
F --> G["Token Count Estimation<br/>EstimateTokenCount"]
G --> H{"Exceed Token Limit?"}
H -->|Yes| I["Trim Nodes by Weight<br/>LimitGraphByTokenCount"]
H -->|No| J["Build Query Graph<br/>GraphModel"]
I --> J
J --> K["LLM Generate Answer<br/>SemanticService.GetGraphAnswerAsync"]
K --> L["Return Result"]
style A fill:#e1f5fe
style B fill:#fce4ec
style F fill:#fff3e0
style K fill:#fff3e0
style L fill:#c8e6c9
```
### 5. Community Algorithm Query Flow
```mermaid
graph TD
A["User Query<br/>Question Input"] --> B["Vector Search<br/>Find Related Nodes"]
B --> C{"Nodes Matched?"}
C -->|Yes| D["Find Node Communities<br/>GetGraphAllCommunitiesRecursion"]
C -->|No| E["Use Global Summary<br/>Globals Table"]
D --> F["Get All Nodes in Community"]
F --> G["Build Community Subgraph<br/>Nodes+Edges"]
G --> H["Get Related Community Summary<br/>Communities Table"]
H --> I["Get Global Summary<br/>Globals Table"]
I --> J["LLM Comprehensive Analysis<br/>Graph+Community Summary+Global Summary"]
E --> K["Answer Based on Global Summary Only"]
J --> L["Return Answer"]
K --> L
style A fill:#e1f5fe
style B fill:#fce4ec
style D fill:#fff3e0
style J fill:#fff3e0
style K fill:#fff3e0
style L fill:#c8e6c9
```
### Core Algorithm Description
1. **Text Chunking Algorithm**: Uses overlapping window technique, each text chunk contains 3 paragraphs, adjacent chunks overlap by 1 paragraph to ensure continuity of relationship information.
2. **Community Detection Algorithm**: Adopts Fast Label Propagation Algorithm with 10 iterations to discover community structure in the graph.
3. **Vector Search Strategy**: First uses 0.5 relevance threshold for search, if results are insufficient, lowers to 0.3 for retry to ensure finding enough related nodes.
4. **Token Optimization Mechanism**: Real-time estimation of token usage, intelligently trims nodes by weight when exceeding limits to ensure LLM input effectiveness.
5. **Orphan Node Processing**: Automatically detects orphan nodes without relationship connections, attempts to establish relationships with other nodes through semantic search.
## You can directly reference the NuGet package in the project, or directly use the project to provide API services
For convenience, the LLM interface is currently only compatible with the openai specification, and other large models can consider using one api class integration products
Configure in appsettings.json
```
"GraphOpenAI": {
"Key": "sk-xxx",
"EndPoint": "https://api.antsk.cn/",
"ChatModel": "gpt-4o-mini",
"EmbeddingModel": "text-embedding-ada-002"
},
"TextChunker": {
"LinesToken": 100,
"ParagraphsToken": 1000
},
"GraphDBConnection": {
"DbType": "Sqlite", //PostgreSQL
"DBConnection": "Data Source=graph.db",
"VectorConnection": "graphmem.db", //If PostgreSQL is used, it can be consistent with DBConnection
"VectorSize": 1536 //DbType=PostgreSQL needs to be set, sqlite can not be set
},
"GraphSearch": {
"SearchMinRelevance": 0.5, //Search for minimum relevance
"SearchLimit": 3, //Limit the number of vector search nodes
"NodeDepth": 3 ,//Retrieve node depth
"MaxNodes": 100 //Retrieve the maximum number of nodes
},
"GraphSys": {
"RetryCounnt": 2 //Number of retries. Using the domestic model may cause json extraction failure. Increasing the number of retries can improve availability
}
```
## Startup project
```
dotnet run --project GraphRag.Net.Web.csproj
```
## After starting the project, you can use the
```
http://localhost:5000/swagger
```
## Open the swagger view interface

### You can also use the interface
```
http://localhost:5000/
```
Open the UI interface of blazer. The page provides functions such as text import, file import, question and answer dialogue, and view knowledge map

## Nuget Package Usage
```
dotnet add package GraphRag.Net
```
## In order to facilitate the adjustment and modification of prompt words, SK Plugin has separated the project. You need to put GraphRag Copy the graphPlugins directory in the Net. Web project to your project, and set
[graphPlugins](https://github.com/AIDotNet/GraphRag.Net/tree/main/src/GraphRag.Net.Web/graphPlugins)
```
<ItemGroup>
<None Include="graphPlugins\**">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>
```
### The default configuration uses the OpenAI standard interface. After configuring the OpenAI app settings, you can use the following code to inject
After adding a package, you need to set the configuration file and dependency injection
```
//OpenAI configuration
builder.Configuration.GetSection("GraphOpenAI").Get<GraphOpenAIOption>();
//Document Slicing Configuration
builder.Configuration.GetSection("TextChunker").Get<TextChunkerOption>();
//Configure Database Links
builder.Configuration.GetSection("GraphDBConnection").Get<GraphDBConnectionOption>();
//System settings
builder.Configuration.GetSection("GraphSys").Get<GraphSysOption>();
//Inject AddGraphRagNet. Note that you need to inject the configuration file first, and then inject GraphRagNet
builder.Services.AddGraphRagNet();
```
### If you want to access other models, you can refer to the following code, which abstracts the implementation of Kernel. You can customize the implementation
```
var kernelBuild = Kernel.CreateBuilder();
kernelBuild.Services.AddKeyedSingleton<ITextGenerationService>("mock-text", new MockTextCompletion());
kernelBuild.Services.AddKeyedSingleton<IChatCompletionService>("mock-chat", new MockChatCompletion());
kernelBuild.Services.AddSingleton((ITextEmbeddingGenerationService)new MockTextEmbeddingGeneratorService());
kernelBuild.Services.AddKeyedSingleton("mock-embedding", new MockTextEmbeddingGeneratorService());
builder.Services.AddGraphRagNet(kernelBuild.Build());
```
#### It should be noted here that since the import may be carried out several times, the generated community and global information is not automatically called during import, so you need to call the generated community and global information according to the actual situation
```
await _graphService.GraphCommunitiesAsync(index);
await _graphService.GraphGlobalAsync(index);
```
Inject IGraphService service when using. The following is the reference sample code
```
namespace GraphRag.Net.Api.Controllers
{
[Route("api/[controller]/[action]")]
[ApiController]
public class GraphDemoController(IGraphService _graphService) : ControllerBase
{
/// <summary>
/// 获取所有的索引数据
/// </summary>
/// <returns></returns>
[HttpGet]
public async Task<IActionResult> GetAllIndex()
{
var graphModel = _graphService.GetAllIndex();
return Ok(graphModel);
}
/// <summary>
/// 获取所有的图谱数据
/// </summary>
/// <param name="index"></param>
/// <returns></returns>
[HttpGet]
public async Task<IActionResult> GetAllGraphs(string index)
{
if (string.IsNullOrEmpty(index))
{
return Ok(new GraphViewModel());
}
var graphModel = _graphService.GetAllGraphs(index);
return Ok(graphModel);
}
/// <summary>
/// 插入文本数据
/// </summary>
/// <param name="model"></param>
/// <returns></returns>
[HttpPost]
public async Task<IActionResult> InsertGraphData(InputModel model)
{
await _graphService.InsertGraphDataAsync(model.Index, model.Input);
return Ok();
}
/// <summary>
/// 搜索递归获取节点相关的所有边和节点进行图谱对话
/// </summary>
/// <param name="model"></param>
/// <returns></returns>
[HttpPost]
public async Task<IActionResult> SearchGraph(InputModel model)
{
var result = await _graphService.SearchGraphAsync(model.Index, model.Input);
return Ok(result);
}
/// <summary>
/// 通过社区算法检索社区节点进行对话
/// </summary>
/// <param name="model"></param>
/// <returns></returns>
[HttpPost]
public async Task<IActionResult> SearchGraphCommunity(InputModel model)
{
var result = await _graphService.SearchGraphCommunityAsync(model.Index, model.Input);
return Ok(result);
}
/// <summary>
/// 导入txt文档
/// </summary>
/// <param name="index"></param>
/// <param name="file"></param>
/// <returns></returns>
[HttpPost]
public async Task<IActionResult> ImportTxt(string index,IFormFile file)
{
var forms = await Request.ReadFormAsync();
using (var stream = new StreamReader(file.OpenReadStream()))
{
var txt = await stream.ReadToEndAsync();
await _graphService.InsertTextChunkAsync(index,txt);
return Ok();
}
}
/// <summary>
/// 通过社区检测生成社区和摘要
/// </summary>
/// <param name="index"></param>
/// <returns></returns>
[HttpGet]
public async Task<IActionResult> GraphCommunities(string index)
{
await _graphService.GraphCommunitiesAsync(index);
return Ok();
}
/// <summary>
/// 通过社区摘要生成全局摘要
/// </summary>
/// <param name="index"></param>
/// <returns></returns>
[HttpGet]
public async Task<IActionResult> GraphGlobal(string index)
{
await _graphService.GraphGlobalAsync(index);
return Ok();
}
/// <summary>
/// 删除图谱数据
/// </summary>
/// <param name="index"></param>
/// <returns></returns>
[HttpGet]
public async Task<IActionResult> DeleteGraph(string index)
{
await _graphService.DeleteGraph(index);
return Ok();
}
}
public class InputModel
{
public string Index { get; set; }
public string Input { get; set; }
}
}
```
## Test DB. Some community friends pre trained some data in advance. The link is as follows. After downloading, it can be directly put into the project directory for replacement to test the experience
```
https://pan.quark.cn/s/bf2d21f29f85
```
## See AntSK for more Rag scenarios
Project address:[AntSK](https://github.com/AIDotNet/AntSK)
Experience environment:
[Demo地址](https://demo.antsk.cn)
User:test
Pwd:test
You are also welcome to join our WeChat communication group. You can add my WeChat: **xuzeyu91** and send it to the group
================================================
FILE: README.md
================================================
简体中文 | [English](./README.en.md)
## 这是一个参考GraphRag的dotnet简易实现
基于微软在论文中提到的实现思路,执行过程GraphRAG主要实现了如下功能:
- Source Documents → Text Chunks:将源文档分割成文本块。
- Text Chunks → Element Instances:从每个文本块中提取图节点和边的实例。
- Element Instances → Element Summaries:为每个图元素生成摘要。
- Element Summaries → Graph Communities:使用社区检测算法将图划分为社区。
- Graph Communities → Community Summaries:为每个社区生成摘要。
- Community Summaries → Community Answers → Global Answer:使用社区摘要生成局部答案,然后汇总这些局部答案以生成全局答案。
本项目为demo示例,仅用于学习GraphRAG思路。
## 核心业务流程
### 1. 整体架构流程
```mermaid
graph LR
A["文档导入"] --> B["图谱构建"]
B --> C["社区检测"]
C --> D["摘要生成"]
D --> E["查询检索"]
subgraph "数据流转"
F["原始文档"] --> G["文本块"]
G --> H["图谱数据<br/>节点+边"]
H --> I["社区结构"]
I --> J["多层摘要"]
J --> K["智能问答"]
end
subgraph "存储层"
L["向量数据库<br/>TextMemory"]
M["关系数据库<br/>Nodes/Edges/Communities/Globals"]
end
B -.-> L
B -.-> M
C -.-> M
D -.-> M
E -.-> L
E -.-> M
style A fill:#e1f5fe
style E fill:#c8e6c9
style L fill:#fce4ec
style M fill:#fff9c4
```
### 2. 文档导入与图谱构建流程
```mermaid
graph TD
A["文档输入<br/>原始文档/文本"] --> B["文本切片<br/>TextChunker.SplitPlainTextLines<br/>TextChunker.SplitPlainTextParagraphs"]
B --> C["重叠文本块<br/>CreateOverlappingChunks<br/>3段落/块,1段落重叠"]
C --> D["LLM提取图数据<br/>SemanticService.CreateGraphAsync"]
D --> E["节点提取<br/>实体识别+类型分类"]
D --> F["关系提取<br/>边和关系描述"]
E --> G["节点去重合并<br/>向量相似度检测"]
F --> H["关系去重合并<br/>重复边处理"]
G --> I["存储到数据库<br/>Nodes表"]
H --> J["存储到数据库<br/>Edges表"]
I --> K["向量化存储<br/>TextMemory.SaveInformationAsync"]
J --> L["孤立节点检测<br/>ProcessOrphanNodesAsync"]
L --> M["图谱构建完成"]
style A fill:#e1f5fe
style M fill:#c8e6c9
style D fill:#fff3e0
style K fill:#fce4ec
```
### 3. 社区检测与摘要生成流程
```mermaid
graph TD
A["图谱数据<br/>Nodes + Edges"] --> B["构建图结构<br/>Graph.AddEdge"]
B --> C["标签传播算法<br/>FastLabelPropagationAlgorithm<br/>10次迭代"]
C --> D["社区检测结果<br/>节点→社区ID映射"]
D --> E["存储社区节点关系<br/>CommunitieNodes表"]
E --> F["按社区分组节点<br/>提取节点描述信息"]
F --> G["LLM生成社区摘要<br/>SemanticService.CommunitySummaries"]
G --> H["存储社区摘要<br/>Communities表"]
H --> I["收集所有社区摘要"]
I --> J["LLM生成全局摘要<br/>SemanticService.GlobalSummaries"]
J --> K["存储全局摘要<br/>Globals表"]
style A fill:#e1f5fe
style C fill:#fff3e0
style G fill:#fff3e0
style J fill:#fff3e0
style K fill:#c8e6c9
```
### 4. 直接图谱查询流程
```mermaid
graph TD
A["用户查询<br/>问题输入"] --> B["向量搜索<br/>TextMemory.SearchAsync<br/>相关度阈值0.5"]
B --> C{"匹配到节点?"}
C -->|是| D["获取相关节点<br/>RetrieveTextMemModelList"]
C -->|否| E["降低阈值重试<br/>阈值0.3,扩大搜索"]
E --> D
D --> F["递归扩展图谱<br/>GetGraphAllRecursion<br/>深度限制+节点数限制"]
F --> G["Token数量估算<br/>EstimateTokenCount"]
G --> H{"超过Token限制?"}
H -->|是| I["按权重裁剪节点<br/>LimitGraphByTokenCount"]
H -->|否| J["构建查询图谱<br/>GraphModel"]
I --> J
J --> K["LLM生成答案<br/>SemanticService.GetGraphAnswerAsync"]
K --> L["返回结果"]
style A fill:#e1f5fe
style B fill:#fce4ec
style F fill:#fff3e0
style K fill:#fff3e0
style L fill:#c8e6c9
```
### 5. 社区算法查询流程
```mermaid
graph TD
A["用户查询<br/>问题输入"] --> B["向量搜索<br/>找到相关节点"]
B --> C{"匹配到节点?"}
C -->|是| D["查找节点所属社区<br/>GetGraphAllCommunitiesRecursion"]
C -->|否| E["使用全局摘要<br/>Globals表"]
D --> F["获取社区内所有节点"]
F --> G["构建社区子图<br/>节点+边"]
G --> H["获取相关社区摘要<br/>Communities表"]
H --> I["获取全局摘要<br/>Globals表"]
I --> J["LLM综合分析<br/>图谱+社区摘要+全局摘要"]
E --> K["仅基于全局摘要回答"]
J --> L["返回答案"]
K --> L
style A fill:#e1f5fe
style B fill:#fce4ec
style D fill:#fff3e0
style J fill:#fff3e0
style K fill:#fff3e0
style L fill:#c8e6c9
```
### 核心算法说明
1. **文本切片算法**:使用重叠窗口技术,每个文本块包含3个段落,相邻块之间重叠1个段落,确保关系信息的连续性。
2. **社区检测算法**:采用快速标签传播算法(Fast Label Propagation Algorithm),通过10次迭代来发现图中的社区结构。
3. **向量搜索策略**:首先使用0.5的相关度阈值进行搜索,如果结果不足则降低至0.3重试,确保找到足够的相关节点。
4. **Token优化机制**:实时估算token使用量,当超过限制时按节点权重进行智能裁剪,保证LLM输入的有效性。
5. **孤立节点处理**:自动检测没有关系连接的孤立节点,通过语义搜索尝试为其建立与其他节点的关系。
## 您可以直接在项目中引用NuGet包,或者直接使用本项目提供API服务
出于方便,LLM接口目前只兼容了openai的规范,其他大模型可以考虑使用one-api类的集成产品
在appsettings.json配置
```
"GraphOpenAI": {
"Key": "sk-xxx",
"EndPoint": "https://api.antsk.cn/",
"ChatModel": "gpt-4o-mini",
"EmbeddingModel": "text-embedding-ada-002"
},
"TextChunker": {
"LinesToken": 100,
"ParagraphsToken": 1000
},
"GraphDBConnection": {
"DbType": "Sqlite", //PostgreSQL
"DBConnection": "Data Source=graph.db",
"VectorConnection": "graphmem.db", //如果用PostgreSQL,可以和DBConnection一致
"VectorSize": 1536 //DbType=PostgreSQL时需要设置,sqlite可以不设置
},
"GraphSearch": {
"SearchMinRelevance": 0.5, //搜索最小相关性
"SearchLimit": 3, //向量搜索节点限制个数
"NodeDepth": 3 ,//检索节点深度
"MaxNodes": 100 //检索最大节点数
},
"GraphSys": {
"RetryCounnt": 2 //重试次数,使用国产模型可能会出现json提取失败,增加重试次数可提高可用性
}
```
## 启动项目
```
dotnet run --project GraphRag.Net.Web.csproj
```
## 启动项目后可以通过
```
http://localhost:5000/swagger
```
## 打开swagger查看接口

### 也可以使用界面
```
http://localhost:5000/
```
打开blazor的UI界面,页面提供了文本导入、文件导入,和问答对话,查看知识图谱等功能

## Nuget包使用
```
dotnet add package GraphRag.Net
```
## 为了方便进行提示词调整与修改,SK Plugin我们剥离出了项目,您需要把GraphRag.Net.Web项目中的 graphPlugins目录拷贝到你的项目中,并设置:
[graphPlugins](https://github.com/AIDotNet/GraphRag.Net/tree/main/src/GraphRag.Net.Web/graphPlugins)
```
<ItemGroup>
<None Include="graphPlugins\**">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>
```
### 默认配置,使用OpenAI标准接口,在配置了OpenAI的appsettings后可以使用下面代码进行注入
添加包以后,需要进行配置文件的设置以及依赖注入
```
//OpenAI配置
builder.Configuration.GetSection("GraphOpenAI").Get<GraphOpenAIOption>();
//文档切片配置
builder.Configuration.GetSection("TextChunker").Get<TextChunkerOption>();
//配置数据库链接
builder.Configuration.GetSection("GraphDBConnection").Get<GraphDBConnectionOption>();
//系统设置
builder.Configuration.GetSection("GraphSys").Get<GraphSysOption>();
//注入AddGraphRagNet,注意,需要先注入配置文件,然后再注入GraphRagNet
builder.Services.AddGraphRagNet();
```
### 如果你想接入其他模型,可以参考以下代码,这里抽象了Kernel的实现,你可以自定义实现
```
var kernelBuild = Kernel.CreateBuilder();
kernelBuild.Services.AddKeyedSingleton<ITextGenerationService>("mock-text", new MockTextCompletion());
kernelBuild.Services.AddKeyedSingleton<IChatCompletionService>("mock-chat", new MockChatCompletion());
kernelBuild.Services.AddSingleton((ITextEmbeddingGenerationService)new MockTextEmbeddingGeneratorService());
kernelBuild.Services.AddKeyedSingleton("mock-embedding", new MockTextEmbeddingGeneratorService());
builder.Services.AddGraphRagNet(kernelBuild.Build());
```
#### 此处需要注意,由于导入可能分多次导入,没有在导入时自动调用生成社区和全局信息,需要自己根据实际情况调用生成社区和全局信息
```
await _graphService.GraphCommunitiesAsync(index);
await _graphService.GraphGlobalAsync(index);
```
使用时注入 IGraphService 服务,以下为参考示例代码
```
namespace GraphRag.Net.Api.Controllers
{
[Route("api/[controller]/[action]")]
[ApiController]
public class GraphController(IGraphService _graphService) : ControllerBase
{
/// <summary>
/// 获取所有的索引数据
/// </summary>
/// <returns></returns>
[HttpGet]
public async Task<IActionResult> GetAllIndex()
{
var graphModel = _graphService.GetAllIndex();
return Ok(graphModel);
}
/// <summary>
/// 获取所有的图谱数据
/// </summary>
/// <param name="index"></param>
/// <returns></returns>
[HttpGet]
public async Task<IActionResult> GetAllGraphs(string index)
{
if (string.IsNullOrEmpty(index))
{
return Ok(new GraphViewModel());
}
var graphModel = _graphService.GetAllGraphs(index);
return Ok(graphModel);
}
/// <summary>
/// 插入文本数据
/// </summary>
/// <param name="model"></param>
/// <returns></returns>
[HttpPost]
public async Task<IActionResult> InsertGraphData(InputModel model)
{
await _graphService.InsertGraphDataAsync(model.Index, model.Input);
return Ok();
}
/// <summary>
/// 搜索递归获取节点相关的所有边和节点进行图谱对话
/// </summary>
/// <param name="model"></param>
/// <returns></returns>
[HttpPost]
public async Task<IActionResult> SearchGraph(InputModel model)
{
var result = await _graphService.SearchGraphAsync(model.Index, model.Input);
return Ok(result);
}
/// <summary>
/// 通过社区算法检索社区节点进行对话
/// </summary>
/// <param name="model"></param>
/// <returns></returns>
[HttpPost]
public async Task<IActionResult> SearchGraphCommunity(InputModel model)
{
var result = await _graphService.SearchGraphCommunityAsync(model.Index, model.Input);
return Ok(result);
}
/// <summary>
/// 导入txt文档
/// </summary>
/// <param name="index"></param>
/// <param name="file"></param>
/// <returns></returns>
[HttpPost]
public async Task<IActionResult> ImportTxt(string index,IFormFile file)
{
var forms = await Request.ReadFormAsync();
using (var stream = new StreamReader(file.OpenReadStream()))
{
var txt = await stream.ReadToEndAsync();
await _graphService.InsertTextChunkAsync(index,txt);
return Ok();
}
}
/// <summary>
/// 通过社区检测生成社区和摘要
/// </summary>
/// <param name="index"></param>
/// <returns></returns>
[HttpGet]
public async Task<IActionResult> GraphCommunities(string index)
{
await _graphService.GraphCommunitiesAsync(index);
return Ok();
}
/// <summary>
/// 通过社区摘要生成全局摘要
/// </summary>
/// <param name="index"></param>
/// <returns></returns>
[HttpGet]
public async Task<IActionResult> GraphGlobal(string index)
{
await _graphService.GraphGlobalAsync(index);
return Ok();
}
/// <summary>
/// 删除图谱数据
/// </summary>
/// <param name="index"></param>
/// <returns></returns>
[HttpGet]
public async Task<IActionResult> DeleteGraph(string index)
{
await _graphService.DeleteGraph(index);
return Ok();
}
}
public class InputModel
{
public string Index { get; set; }
public string Input { get; set; }
}
}
```
## 测试DB,有社区朋友提前预训练了一些数据,链接如下,下载后直接放进项目目录替换即可测试体验
```
https://pan.quark.cn/s/bf2d21f29f85
```
## 更多Rag场景可查看 AntSK
项目地址:[AntSK](https://github.com/AIDotNet/AntSK)
体验环境:
[Demo地址](https://demo.antsk.cn)
账号:test
密码:test
================================================
FILE: src/GraphRag.Net/Common/Options/GraphDBConnectionOption.cs
================================================
namespace GraphRag.Net.Options
{
public class GraphDBConnectionOption
{
/// <summary>
/// sqlite连接字符串
/// </summary>
public static string DbType { get; set; } = "Sqlite";
/// <summary>
/// 业务数据链接字符串
/// </summary>
public static string DBConnection { get; set; } = $"Data Source=graph.db";
/// <summary>
/// 向量数据连接字符串
/// </summary>
public static string VectorConnection { get; set; } = "graphmem.db";
/// <summary>
/// 向量数据维度,PG需要设置
/// </summary>
public static int VectorSize { get; set; } = 1536;
}
}
================================================
FILE: src/GraphRag.Net/Common/Options/GraphOpenAIOption.cs
================================================
namespace GraphRag.Net.Options
{
public class GraphOpenAIOption
{
public static string EndPoint { get; set; }
public static string Key { get; set; }
public static string ChatModel { get; set; }
public static string EmbeddingModel { get; set; }
}
}
================================================
FILE: src/GraphRag.Net/Common/Options/GraphSearchOption.cs
================================================
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace GraphRag.Net.Options
{
public class GraphSearchOption
{
/// <summary>
/// 社区检索搜索最小向量相似度
/// </summary>
public static double SearchMinRelevance { get; set; } = 0.5;
/// <summary>
/// 社区检索搜索向量节点数量
/// </summary>
public static int SearchLimit { get; set; } = 3;
/// <summary>
/// 节点关系检索深度
/// </summary>
public static int NodeDepth { get; set; } = 3;
/// <summary>
/// 节点检索最多节点数量
/// </summary>
public static int MaxNodes { get; set; } = 300;
/// <summary>
/// 最大Token数量限制(32K)
/// </summary>
public static int MaxTokens { get; set; } = 32000;
}
}
================================================
FILE: src/GraphRag.Net/Common/Options/GraphSysOption.cs
================================================
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace GraphRag.Net.Common.Options
{
public class GraphSysOption
{
/// <summary>
/// 重试次数
/// </summary>
public static int RetryCounnt { get; set; } = 2;
}
}
================================================
FILE: src/GraphRag.Net/Common/Options/TextChunkerOption.cs
================================================
namespace GraphRag.Net.Options
{
public class TextChunkerOption
{
/// <summary>
/// 行切片token
/// </summary>
public static int LinesToken { get; set; } = 100;
/// <summary>
/// 段落切片token
/// </summary>
public static int ParagraphsToken { get; set; } = 1000;
}
}
================================================
FILE: src/GraphRag.Net/Common/ServiceDescriptionAttribute.cs
================================================
using Microsoft.Extensions.DependencyInjection;
namespace GraphRag.Net
{
public class ServiceDescriptionAttribute : Attribute
{
public ServiceDescriptionAttribute(Type serviceType, ServiceLifetime lifetime)
{
ServiceType = serviceType;
Lifetime = lifetime;
}
public Type ServiceType { get; set; }
public ServiceLifetime Lifetime { get; set; }
}
}
================================================
FILE: src/GraphRag.Net/Domain/Interface/ICommunityDetectionService.cs
================================================
using GraphRag.Net.Domain.Model.Graph;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace GraphRag.Net.Domain.Interface
{
public interface ICommunityDetectionService
{
Dictionary<string, string> FastLabelPropagationAlgorithm(Graph graph, int iterations = 10);
}
}
================================================
FILE: src/GraphRag.Net/Domain/Interface/IGraphService.cs
================================================
using GraphRag.Net.Domain.Model.Graph;
using Microsoft.SemanticKernel;
namespace GraphRag.Net.Domain.Interface
{
public interface IGraphService
{
/// <summary>
/// 获取所有索引信息
/// </summary>
/// <returns></returns>
List<string> GetAllIndex();
/// <summary>
/// 获取Graph数据
/// </summary>
/// <param name="index"></param>
/// <returns></returns>
GraphViewModel GetAllGraphs(string index);
/// <summary>
/// 切片导入文本数据
/// </summary>
/// <param name="index"></param>
/// <param name="input"></param>
/// <returns></returns>
Task InsertTextChunkAsync(string index, string input);
/// <summary>
/// 生成图谱数据
/// </summary>
/// <param name="index"></param>
/// <param name="input"></param>
/// <returns></returns>
Task InsertGraphDataAsync(string index, string input);
/// <summary>
/// 搜索递归获取节点相关的所有边和节点
/// </summary>
/// <param name="index"></param>
/// <param name="input"></param>
/// <returns></returns>
Task<GraphModel> SearchGraphModel(string index, string input);
/// <summary>
/// 搜索递归获取节点相关的所有边和节点进行图谱对话
/// </summary>
/// <param name="index"></param>
/// <param name="input"></param>
/// <returns></returns>
Task<string> SearchGraphAsync(string index, string input);
/// <summary>
/// 通过社区算法匹配相关节点信息
/// </summary>
/// <param name="index"></param>
/// <param name="input"></param>
/// <returns></returns>
Task<GraphModel> SearchGraphCommunityModel(string index, string input);
/// <summary>
/// 搜索递归获取节点相关的所有边和节点进行图谱对话,流式返回
/// </summary>
/// <param name="index"></param>
/// <param name="input"></param>
/// <returns></returns>
IAsyncEnumerable<StreamingKernelContent> SearchGraphStreamAsync(string index, string input);
/// <summary>
/// 通过社区算法检索社区节点进行对话
/// </summary>
/// <param name="index"></param>
/// <param name="input"></param>
/// <returns></returns>
Task<string> SearchGraphCommunityAsync(string index, string input);
/// <summary>
/// 通过社区算法检索社区节点进行对话,流式返回
/// </summary>
/// <param name="index"></param>
/// <param name="input"></param>
/// <returns></returns>
IAsyncEnumerable<StreamingKernelContent> SearchGraphCommunityStreamAsync(string index, string input);
/// <summary>
/// 社区摘要
/// </summary>
/// <param name="index"></param>
/// <returns></returns>
Task GraphCommunitiesAsync(string index);
/// <summary>
/// 全局摘要
/// </summary>
/// <param name="index"></param>
/// <returns></returns>
Task GraphGlobalAsync(string index);
/// <summary>
/// 删除图谱数据
/// </summary>
/// <param name="index"></param>
/// <returns></returns>
Task DeleteGraph(string index);
}
}
================================================
FILE: src/GraphRag.Net/Domain/Interface/ISemanticService.cs
================================================
using GraphRag.Net.Domain.Model.Graph;
using Microsoft.SemanticKernel;
using Microsoft.SemanticKernel.Memory;
namespace GraphRag.Net.Domain.Interface
{
public interface ISemanticService
{
Task<GraphModel> CreateGraphAsync(string input);
Task<string> GetGraphAnswerAsync(string graph, string input);
IAsyncEnumerable<StreamingKernelContent> GetGraphAnswerStreamAsync(string graph, string input);
Task<string> GetGraphCommunityAnswerAsync(string graph, string community, string global, string input);
IAsyncEnumerable<StreamingKernelContent> GetGraphCommunityAnswerStreamAsync(string graph, string community, string global, string input);
Task<RelationShipModel> GetRelationship(string node1, string node2);
Task<string> MergeDesc(string desc1, string desc2);
Task<string> CommunitySummaries(string nodes);
Task<string> GlobalSummaries(string community);
Task<SemanticTextMemory> GetTextMemory();
}
}
================================================
FILE: src/GraphRag.Net/Domain/Model/Graph/Graph.cs
================================================
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace GraphRag.Net.Domain.Model.Graph
{
public class Graph
{
public Dictionary<string, List<string>> AdjacencyList { get; }
public Graph()
{
AdjacencyList = new Dictionary<string, List<string>>();
}
public void AddEdge(string node1, string node2)
{
if (!AdjacencyList.ContainsKey(node1))
{
AdjacencyList[node1] = new List<string>();
}
if (!AdjacencyList.ContainsKey(node2))
{
AdjacencyList[node2] = new List<string>();
}
AdjacencyList[node1].Add(node2);
AdjacencyList[node2].Add(node1);
}
}
}
================================================
FILE: src/GraphRag.Net/Domain/Model/Graph/GraphModel.cs
================================================
using GraphRag.Net.Repositories;
namespace GraphRag.Net.Domain.Model.Graph
{
public class GraphModel
{
public List<Nodes> Nodes { get; set; }
public List<Edges> Edges { get; set; }
}
}
================================================
FILE: src/GraphRag.Net/Domain/Model/Graph/GraphViewModel.cs
================================================
namespace GraphRag.Net.Domain.Model.Graph
{
public class GraphViewModel
{
public string rootId { get; set; }
public List<NodesViewModel> nodes { get; set; } = new List<NodesViewModel>();
public List<LinesViewModel> lines { get; set; } = new List<LinesViewModel>();
}
public class NodesViewModel
{
public string id { get; set; }
public string text { get; set; }
public string color { get; set; } = "#43a2f1";
public NodesDataModel data { get; set; }=new NodesDataModel();
}
public class NodesDataModel
{
public string desc { get; set; }
}
public class LinesViewModel
{
public string from { get; set; }
public string to { get; set; }
public string text { get; set; }
public string color { get; set; } = "#000";
}
}
================================================
FILE: src/GraphRag.Net/Domain/Model/Graph/RelationShipModel.cs
================================================
using GraphRag.Net.Repositories;
namespace GraphRag.Net.Domain.Model.Graph
{
public class RelationShipModel
{
public bool IsRelationship { get; set; }
public Edges Edge { get; set; }
}
}
================================================
FILE: src/GraphRag.Net/Domain/Model/Graph/TextMemModel.cs
================================================
namespace GraphRag.Net.Domain.Model.Graph
{
public class TextMemModel
{
public string Id { get; set; }
public string Text { get; set; }
public double Relevance { get; set; }
}
}
================================================
FILE: src/GraphRag.Net/Domain/Model/PageList.cs
================================================
namespace GraphRag.Net.Model
{
public class PageList<T>
{
//查询结果
public List<T> List { get; set; }
/// <summary>
/// 当前页,从1开始
/// </summary>
public int PageIndex { get; set; }
/// <summary>
/// 每页数量
/// </summary>
public int PageSize { get; set; }
/// <summary>
/// 总数
/// </summary>
public int TotalCount { get; set; }
}
}
================================================
FILE: src/GraphRag.Net/Domain/Service/CommunityDetectionService.cs
================================================
using GraphRag.Net.Domain.Interface;
using GraphRag.Net.Domain.Model.Graph;
using Microsoft.Extensions.DependencyInjection;
namespace GraphRag.Net.Domain.Service
{
[ServiceDescription(typeof(ICommunityDetectionService), ServiceLifetime.Scoped)]
public class CommunityDetectionService : ICommunityDetectionService
{
/// <summary>
/// 标签传播算法
/// </summary>
/// <param name="graph"></param>
/// <param name="iterations"></param>
/// <returns></returns>
public Dictionary<string, string> FastLabelPropagationAlgorithm(Graph graph, int iterations = 10)
{
// Initialize labels
var labels = graph.AdjacencyList.Keys.ToDictionary(node => node, node => node);
for (int iter = 0; iter < iterations; iter++)
{
// Shuffle nodes
var nodes = graph.AdjacencyList.Keys.OrderBy(a => Guid.NewGuid()).ToList();
foreach (var node in nodes)
{
// Count neighbor labels
var labelCounts = new Dictionary<string, int>();
foreach (var neighbor in graph.AdjacencyList[node])
{
if (!labelCounts.ContainsKey(labels[neighbor]))
{
labelCounts[labels[neighbor]] = 0;
}
labelCounts[labels[neighbor]]++;
}
// Find the label of highest frequency
var maxCount = labelCounts.Values.Max();
var bestLabels = labelCounts.Where(x => x.Value == maxCount).Select(x => x.Key).ToList();
// Pick a random label among the smallest lexicographically in case of tie
var newLabel = bestLabels.OrderBy(x => x).First();
if (labels[node] != newLabel)
{
labels[node] = newLabel;
}
}
}
return labels;
}
}
}
================================================
FILE: src/GraphRag.Net/Domain/Service/GraphService.cs
================================================
using GraphRag.Net.Domain.Interface;
using GraphRag.Net.Domain.Model.Graph;
using GraphRag.Net.Options;
using GraphRag.Net.Repositories;
using GraphRag.Net.Utils;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.SemanticKernel;
using Microsoft.SemanticKernel.Memory;
using Microsoft.SemanticKernel.Text;
using Newtonsoft.Json;
using SqlSugar;
namespace GraphRag.Net.Domain.Service
{
[ServiceDescription(typeof(IGraphService), ServiceLifetime.Scoped)]
public class GraphService(
INodes_Repositories _nodes_Repositories,
IEdges_Repositories _edges_Repositories,
ISemanticService _semanticService,
ICommunities_Repositories _communities_Repositories,
ICommunitieNodes_Repositories _communitieNodes_Repositories,
IGlobals_Repositories _globals_Repositories,
ICommunityDetectionService _communityDetectionService
) : IGraphService
{
/// <summary>
/// 获取所有索引信息
/// </summary>
/// <returns></returns>
public List<string> GetAllIndex()
{
var indexs = _nodes_Repositories.GetDB().Queryable<Nodes>().GroupBy(p => p.Index).Select(p => p.Index).ToList();
return indexs;
}
/// <summary>
/// 获取Graph数据
/// </summary>
/// <returns></returns>
public GraphViewModel GetAllGraphs(string index)
{
if (string.IsNullOrWhiteSpace(index))
{
throw new ArgumentException("Index required value cannot be null.");
}
GraphViewModel graphViewModel = new GraphViewModel();
var nodes = _nodes_Repositories.GetList(p => p.Index == index);
var edges = _edges_Repositories.GetList(p => p.Index == index);
Dictionary<string, string> TypeColor = new Dictionary<string, string>();
Random random = new Random();
foreach (var n in nodes)
{
NodesViewModel nodesViewModel = new NodesViewModel()
{
id = n.Id,
text = n.Name,
data = new NodesDataModel()
{
desc = n.Desc.ConvertToString()
}
};
//处理相同的Type用相同的颜色
if (TypeColor.ContainsKey(n.Type))
{
nodesViewModel.color = TypeColor[n.Type];
}
else
{
nodesViewModel.color = $"#{random.Next(0x1000000):X6}";
TypeColor.Add(n.Type, nodesViewModel.color);
}
graphViewModel.nodes.Add(nodesViewModel);
}
foreach (var e in edges)
{
LinesViewModel linesViewModel = new LinesViewModel()
{
from = e.Source,
to = e.Target,
text = e.Relationship
};
graphViewModel.lines.Add(linesViewModel);
}
return graphViewModel;
}
/// <summary>
/// 切片导入文本数据
/// </summary>
/// <param name="index"></param>
/// <param name="input"></param>
/// <returns></returns>
public async Task InsertTextChunkAsync(string index, string input)
{
if (string.IsNullOrWhiteSpace(index) || string.IsNullOrWhiteSpace(input))
{
throw new ArgumentException("Values required for index and input cannot be null.");
}
var lines = TextChunker.SplitPlainTextLines(input, TextChunkerOption.LinesToken);
var paragraphs = TextChunker.SplitPlainTextParagraphs(lines, TextChunkerOption.ParagraphsToken);
// 优化文本分块:使用重叠窗口来保持关系信息
var optimizedChunks = CreateOverlappingChunks(paragraphs);
foreach (var chunk in optimizedChunks)
{
await InsertGraphDataAsync(index, chunk);
}
}
/// <summary>
/// 创建重叠文本块以保持关系信息
/// </summary>
/// <param name="paragraphs"></param>
/// <returns></returns>
private List<string> CreateOverlappingChunks(List<string> paragraphs)
{
var chunks = new List<string>();
const int maxChunkSize = 3; // 每个块最多包含3个段落
const int overlapSize = 1; // 重叠1个段落
if (paragraphs.Count <= maxChunkSize)
{
// 如果段落数量不多,直接作为一个块
chunks.Add(string.Join("\n\n", paragraphs));
}
else
{
// 创建重叠的文本块
for (int i = 0; i < paragraphs.Count; i += (maxChunkSize - overlapSize))
{
var chunkParagraphs = paragraphs
.Skip(i)
.Take(maxChunkSize)
.ToList();
if (chunkParagraphs.Count > 0)
{
var chunk = string.Join("\n\n", chunkParagraphs);
// 避免重复的块
if (!chunks.Contains(chunk))
{
chunks.Add(chunk);
}
}
// 如果剩余段落不足一个完整块,退出循环
if (i + maxChunkSize >= paragraphs.Count)
{
break;
}
}
}
Console.WriteLine($"原始段落数: {paragraphs.Count}, 优化后块数: {chunks.Count}");
return chunks;
}
/// <summary>
/// 生成图谱数据
/// </summary>
/// <param name="index"></param>
/// <param name="input"></param>
/// <returns></returns>
public async Task InsertGraphDataAsync(string index, string input)
{
if (string.IsNullOrWhiteSpace(index) || string.IsNullOrWhiteSpace(input))
{
throw new ArgumentException("Values required for index and input cannot be null.");
}
try
{
SemanticTextMemory textMemory = await _semanticService.GetTextMemory();
var graph = await _semanticService.CreateGraphAsync(input);
Dictionary<string, string> nodeDic = new Dictionary<string, string>();
List<Nodes> newNodes = new List<Nodes>(); // 收集新插入的节点
foreach (var n in graph.Nodes)
{
string Id = Guid.NewGuid().ToString();
string text2 = $"Name:{n.Name};Type:{n.Type};Desc:{n.Desc}";
bool isContinue = false;
//判断是否存在相同节点
var oldNode = _nodes_Repositories.GetFirst(p => p.Index == index && p.Name == n.Name);
if (oldNode.IsNotNull() && !string.IsNullOrWhiteSpace(n.Desc))
{
//相同节点关联edge关系
var newDesc = await _semanticService.MergeDesc(oldNode.Desc.ConvertToString(), n.Desc.ConvertToString());
if (string.IsNullOrEmpty(newDesc))
{
//可能触发了LLM规则限制,简单粗暴来拼接吧
oldNode.Desc = oldNode.Desc.ConvertToString() + "; " + n.Desc.ConvertToString();
}
else
{
oldNode.Desc = newDesc;
}
//更新描述
_nodes_Repositories.Update(oldNode);
text2 = $"Name:{oldNode.Name};Type:{oldNode.Type};Desc:{oldNode.Desc}";
nodeDic.Add(n.Id, oldNode.Id);
await textMemory.SaveInformationAsync(index, id: oldNode.Id, text: text2, cancellationToken: default);
continue;
}
//优化相关节点发现:增加搜索数量和降低阈值
List<string> potentialRelatedNodes = new List<string>();
await foreach (MemoryQueryResult memory in textMemory.SearchAsync(index, text2, limit: 5, minRelevanceScore: 0.7))
{
if (memory.Relevance == 1)
{
//相同节点进行合并
Console.WriteLine("节点合并");
nodeDic.Add(n.Id, memory.Metadata.Id);
isContinue = true;
break;
}
if (graph.Nodes.Select(p => p.Id).Contains(memory.Metadata.Id))
{
//如果本次包含了向量近似的数据,则跳过
continue;
}
potentialRelatedNodes.Add(memory.Metadata.Id);
}
if (isContinue)
{
//节点合并,跳出循环
continue;
}
// 创建新节点
Nodes node = new Nodes()
{
Id = Id,
Index = index,
Name = n.Name,
Type = n.Type,
Desc = n.Desc.ConvertToString()
};
if (!nodeDic.ContainsKey(n.Id))
{
nodeDic.Add(n.Id, node.Id);
}
_nodes_Repositories.Insert(node);
newNodes.Add(node);
// 检查与潜在相关节点的关系
foreach (var relatedNodeId in potentialRelatedNodes)
{
var node1 = _nodes_Repositories.GetFirst(p => p.Id == relatedNodeId);
if (node1 != null)
{
string text1 = $"Name:{node1.Name};Type:{node1.Type};Desc:{node1.Desc}";
var relationShip = await _semanticService.GetRelationship(text1, text2);
if (relationShip.IsRelationship)
{
if (relationShip.Edge.Source == "node1")
{
relationShip.Edge.Source = node1.Id;
relationShip.Edge.Target = Id;
}
else
{
relationShip.Edge.Source = Id;
relationShip.Edge.Target = node1.Id;
}
if (!_edges_Repositories.IsAny(p => p.Target == relationShip.Edge.Target && p.Source == relationShip.Edge.Source))
{
relationShip.Edge.Id = Guid.NewGuid().ToString();
relationShip.Edge.Index = index;
_edges_Repositories.Insert(relationShip.Edge);
}
}
}
}
//向量处理节点信息
await textMemory.SaveInformationAsync(index, id: node.Id, text: text2, cancellationToken: default);
}
foreach (var e in graph.Edges)
{
Edges edge = new Edges()
{
Id = Guid.NewGuid().ToString(),
Index = index,
Source = nodeDic[e.Source],
Target = nodeDic[e.Target],
Relationship = e.Relationship
};
_edges_Repositories.Insert(edge);
}
// 检测和处理孤立节点
await ProcessOrphanNodesAsync(index, newNodes, textMemory);
//查询Edges 的Source和Target 重复数据
var repeatEdges = _edges_Repositories.GetDB().Queryable<Edges>()
.GroupBy(p => new { p.Source, p.Target })
.Select(p => new { p.Source, p.Target, Count = SqlFunc.AggregateCount(p.Source) })
.ToList().Where(p => p.Count > 1).ToList();
//合并查询Edges 的Source和Target 重复数据
foreach (var edge in repeatEdges)
{
var edges = _edges_Repositories.GetList(p => p.Source == edge.Source && p.Target == edge.Target);
var firstEdge = edges.First();
for (int i = 1; i < edges.Count(); i++)
{
if (firstEdge.Relationship == edges[i].Relationship)
{
//相同的边进行合并
_edges_Repositories.Delete(edges[i]);
continue;
}
var newDesc = await _semanticService.MergeDesc(firstEdge.Relationship, edges[i].Relationship);
firstEdge.Relationship = newDesc;
_edges_Repositories.Update(firstEdge);
_edges_Repositories.Delete(edges[i]);
}
}
}
catch (Exception ex)
{
Console.WriteLine($"插入数据失败:{ex.ToString()}");
}
}
/// <summary>
/// 检索相关节点
/// </summary>
/// <param name="index"></param>
/// <param name="input"></param>
/// <returns></returns>
/// <exception cref="ArgumentException"></exception>
public async Task<GraphModel> SearchGraphModel(string index, string input)
{
if (string.IsNullOrWhiteSpace(index) || string.IsNullOrWhiteSpace(input))
{
throw new ArgumentException("Values required for index and input cannot be null.");
}
var textMemModelList = await RetrieveTextMemModelList(index, input);
if (textMemModelList.Any())
{
var nodes = _nodes_Repositories.GetList(p => p.Index == index && textMemModelList.Select(c => c.Id).Contains(p.Id));
// 创建节点权重字典
Dictionary<string, double> nodeWeights = textMemModelList.ToDictionary(
t => t.Id,
t => t.Relevance
);
var graphModel = GetGraphAllRecursion(index, nodes, nodeWeights);
// 计算预估的token数量,并在必要时限制节点数量
int estimatedTokens = EstimateTokenCount(graphModel);
if (estimatedTokens > GraphSearchOption.MaxTokens)
{
Console.WriteLine($"预估Token数量 {estimatedTokens} 超过限制 {GraphSearchOption.MaxTokens},正在调整节点数量...");
graphModel = LimitGraphByTokenCount(graphModel, nodeWeights);
}
return graphModel;
}
else
{
return new GraphModel();
}
}
/// <summary>
/// 估算图模型的token数量
/// </summary>
/// <param name="model">图模型</param>
/// <returns>估算的token数量</returns>
private int EstimateTokenCount(GraphModel model)
{
int tokenCount = 0;
// 估算节点的token(每个单词约1.3个token,每个节点信息加上额外开销)
foreach (var node in model.Nodes)
{
// 节点ID和名称估算
tokenCount += (node.Id?.Length ?? 0) / 3 + 2;
tokenCount += (node.Name?.Length ?? 0) / 3 + 2;
// 节点描述估算(一个汉字约等于1个token,英文单词约等于0.75个token)
string desc = node.Desc ?? "";
int chineseCount = desc.Count(c => c >= 0x4E00 && c <= 0x9FFF);
int otherCount = desc.Length - chineseCount;
tokenCount += chineseCount + (int)(otherCount * 0.75);
// 节点额外属性估算
tokenCount += 10; // 额外结构开销
}
// 估算边的token
tokenCount += model.Edges.Count * 10; // 每个边的结构信息约10个token
// JSON结构开销
tokenCount += 200;
return tokenCount;
}
/// <summary>
/// 根据token数量限制图大小
/// </summary>
/// <param name="model">原始图模型</param>
/// <param name="nodeWeights">节点权重</param>
/// <returns>裁剪后的图模型</returns>
private GraphModel LimitGraphByTokenCount(GraphModel model, Dictionary<string, double> nodeWeights)
{
var result = new GraphModel();
// 将节点按权重排序
var sortedNodes = model.Nodes
.OrderByDescending(n => nodeWeights.GetValueOrDefault(n.Id, 0))
.ToList();
// 从高权重节点开始添加,直到接近token限制
var selectedNodes = new List<Nodes>();
int currentTokens = 200; // 基础结构开销
foreach (var node in sortedNodes)
{
// 计算添加此节点后的token数
string desc = node.Desc ?? "";
int chineseCount = desc.Count(c => c >= 0x4E00 && c <= 0x9FFF);
int otherCount = desc.Length - chineseCount;
int nodeTokens = chineseCount + (int)(otherCount * 0.75) +
(node.Id?.Length ?? 0) / 3 +
(node.Name?.Length ?? 0) / 3 + 15;
// 如果添加此节点会超过限制,跳过
if (currentTokens + nodeTokens > GraphSearchOption.MaxTokens * 0.9)
{
continue;
}
selectedNodes.Add(node);
currentTokens += nodeTokens;
}
// 只保留连接选中节点的边
var selectedEdges = model.Edges.Where(e =>
selectedNodes.Any(n => n.Id == e.Source) &&
selectedNodes.Any(n => n.Id == e.Target)
).ToList();
result.Nodes = selectedNodes;
result.Edges = selectedEdges;
Console.WriteLine($"节点限制调整:从 {model.Nodes.Count} 个节点减少到 {result.Nodes.Count} 个节点");
Console.WriteLine($"预估调整后Token数:约 {currentTokens}");
return result;
}
/// <summary>
/// 通过社区算法匹配相关节点信息
/// </summary>
/// <param name="index"></param>
/// <param name="input"></param>
/// <returns></returns>
/// <exception cref="ArgumentException"></exception>
public async Task<GraphModel> SearchGraphCommunityModel(string index, string input)
{
if (string.IsNullOrWhiteSpace(index) || string.IsNullOrWhiteSpace(input))
{
throw new ArgumentException("Values required for index and input cannot be null.");
}
var textMemModelList = await RetrieveTextMemModelList(index, input);
if (!textMemModelList.Any())
{
// 尝试降低阈值重新检索
textMemModelList = await RetrieveTextMemModelList(index, input, 0.3, 5);
}
if (textMemModelList.Any())
{
var nodes = _nodes_Repositories.GetList(p => p.Index == index && textMemModelList.Select(c => c.Id).Contains(p.Id));
var graphModel = GetGraphAllCommunitiesRecursion(index, nodes);
// 计算预估的token数量,并在必要时限制节点数量
int estimatedTokens = EstimateTokenCount(graphModel);
if (estimatedTokens > GraphSearchOption.MaxTokens)
{
Console.WriteLine($"社区检索:预估Token数量 {estimatedTokens} 超过限制 {GraphSearchOption.MaxTokens},正在调整节点数量...");
// 为社区节点创建权重字典(默认权重相同)
Dictionary<string, double> nodeWeights = graphModel.Nodes.ToDictionary(
n => n.Id,
n => 1.0
);
// 为初始检索到的节点赋予更高权重
foreach (var node in nodes)
{
if (nodeWeights.ContainsKey(node.Id))
{
nodeWeights[node.Id] = 2.0; // 给初始节点更高权重
}
}
graphModel = LimitGraphByTokenCount(graphModel, nodeWeights);
}
return graphModel;
}
else
{
return new GraphModel();
}
}
/// <summary>
/// 搜索递归获取节点相关的所有边和节点进行图谱对话
/// </summary>
/// <param name="index"></param>
/// <param name="input"></param>
/// <returns></returns>
public async Task<string> SearchGraphAsync(string index, string input)
{
var graphModel = await SearchGraphModel(index, input);
string answer = await _semanticService.GetGraphAnswerAsync(JsonConvert.SerializeObject(graphModel), input);
return answer;
}
/// <summary>
/// 搜索递归获取节点相关的所有边和节点进行图谱对话,流式返回
/// </summary>
/// <param name="index"></param>
/// <param name="input"></param>
/// <returns></returns>
public async IAsyncEnumerable<StreamingKernelContent> SearchGraphStreamAsync(string index, string input)
{
var graphModel = await SearchGraphModel(index, input);
if (graphModel.Nodes.Count() > 0)
{
var answerStream = _semanticService.GetGraphAnswerStreamAsync(JsonConvert.SerializeObject(graphModel), input);
await foreach (var content in answerStream)
{
yield return content;
}
}
}
/// <summary>
/// 通过社区算法检索社区节点进行对话
/// </summary>
/// <param name="index"></param>
/// <param name="input"></param>
/// <returns></returns>
public async Task<string> SearchGraphCommunityAsync(string index, string input)
{
string answer = "";
var graphModel = await SearchGraphCommunityModel(index, input);
var global = _globals_Repositories.GetFirst(p => p.Index == index)?.Summaries;
if (graphModel.Nodes.Count() > 0)
{
var community = string.Join(Environment.NewLine, _communities_Repositories.GetDB().Queryable<Communities>().Where(p => p.Index == index).Select(p => p.Summaries).ToList());
//这里数据有点多,要通过语义进行一次过滤
answer = await _semanticService.GetGraphCommunityAnswerAsync(JsonConvert.SerializeObject(graphModel), community, global, input);
}
else
{
//如果没有匹配到节点信息,使用全局信息
answer = await _semanticService.GetGraphCommunityAnswerAsync("NoSearch", "NoSearch", global, input);
}
return answer;
}
/// <summary>
/// 通过社区算法检索社区节点进行对话,流式返回
/// </summary>
/// <param name="index"></param>
/// <param name="input"></param>
/// <returns></returns>
public async IAsyncEnumerable<StreamingKernelContent> SearchGraphCommunityStreamAsync(string index, string input)
{
var textMemModelList = await RetrieveTextMemModelList(index, input);
var global = _globals_Repositories.GetFirst(p => p.Index == index)?.Summaries;
IAsyncEnumerable<StreamingKernelContent> answer;
//匹配到节点信息
var graphModel = await SearchGraphCommunityModel(index, input);
if (graphModel.Nodes.Count() > 0)
{
var community = string.Join(Environment.NewLine, _communities_Repositories.GetDB().Queryable<Communities>().Where(p => p.Index == index).Select(p => p.Summaries).ToList());
//这里数据有点多,要通过语义进行一次过滤
answer = _semanticService.GetGraphCommunityAnswerStreamAsync(JsonConvert.SerializeObject(graphModel), community, global, input);
}
else
{
//如果没有匹配到节点信息,使用全局信息
answer = _semanticService.GetGraphCommunityAnswerStreamAsync("NoSearch", "NoSearch", global, input);
}
await foreach (var content in answer)
{
yield return content;
}
}
/// <summary>
/// 社区摘要
/// </summary>
/// <param name="index"></param>
/// <returns></returns>
public async Task GraphCommunitiesAsync(string index)
{
var nodes = _nodes_Repositories.GetList(p => p.Index == index);
var edges = _edges_Repositories.GetList(p => p.Index == index);
//删除社区数据
_communitieNodes_Repositories.Delete(p => p.Index == index);
_communities_Repositories.Delete(p => p.Index == index);
var graph = new Graph();
foreach (var edge in edges)
{
graph.AddEdge(edge.Source, edge.Target);
}
//重新计算社区
var result = _communityDetectionService.FastLabelPropagationAlgorithm(graph);
Console.WriteLine("开始社区总结");
foreach (var kvp in result)
{
//插入社区节点数据
CommunitieNodes communitieNodes = new CommunitieNodes();
communitieNodes.Index = index;
communitieNodes.CommunitieId = kvp.Value;
communitieNodes.NodeId = kvp.Key;
_communitieNodes_Repositories.Insert(communitieNodes);
}
//获取所有社区ID
var communitieIds = _communitieNodes_Repositories.GetDB().Queryable<CommunitieNodes>().Where(p => p.Index == index).GroupBy(p => p.CommunitieId).Select(p => p.CommunitieId).ToList();
foreach (var communitieId in communitieIds)
{
var nodeList = _communitieNodes_Repositories.GetDB().Queryable<CommunitieNodes>()
.LeftJoin<Nodes>((c, n) => c.NodeId == n.Id)
.Where(c => c.CommunitieId == communitieId)
.Select((c, n) => $"Name:{n.Name}; Type:{n.Type}; Desc:{n.Desc}")
.ToList();
var nodeDescs = string.Join(Environment.NewLine, nodeList);
var summaries = await _semanticService.CommunitySummaries(nodeDescs);
Communities communities = new Communities()
{
CommunitieId = communitieId,
Index = index,
Summaries = summaries
};
//插入社区总结数据
_communities_Repositories.Insert(communities);
}
}
/// <summary>
/// 全局摘要
/// </summary>
/// <param name="index"></param>
/// <returns></returns>
public async Task GraphGlobalAsync(string index)
{
_globals_Repositories.Delete(p => p.Index == index);
var communitieSummariesList = _communities_Repositories.GetDB().Queryable<Communities>().Where(p => p.Index == index).Select(p => p.Summaries).ToList();
var communitieSummaries = string.Join(Environment.NewLine, communitieSummariesList);
var globalSummaries = await _semanticService.GlobalSummaries(communitieSummaries);
Globals globals = new Globals()
{
Index = index,
Summaries = globalSummaries
};
_globals_Repositories.Insert(globals);
}
/// <summary>
/// 增强图谱关系:为现有节点发现和建立新的关系
/// </summary>
/// <param name="index"></param>
/// <returns></returns>
public async Task EnhanceGraphRelationshipsAsync(string index)
{
if (string.IsNullOrWhiteSpace(index))
{
throw new ArgumentException("Index required value cannot be null.");
}
Console.WriteLine("开始增强图谱关系...");
SemanticTextMemory textMemory = await _semanticService.GetTextMemory();
// 获取所有孤立或连接较少的节点
var allNodes = _nodes_Repositories.GetList(p => p.Index == index);
var lowConnectedNodes = new List<Nodes>();
foreach (var node in allNodes)
{
var connectionCount = _edges_Repositories.GetDB().Queryable<Edges>()
.Where(e => (e.Source == node.Id || e.Target == node.Id) && e.Index == index)
.Count();
// 如果连接数少于2个,认为是需要增强的节点
if (connectionCount < 2)
{
lowConnectedNodes.Add(node);
}
}
Console.WriteLine($"发现 {lowConnectedNodes.Count} 个需要增强关系的节点");
// 为每个低连接节点尝试建立新关系
int enhancedCount = 0;
foreach (var node in lowConnectedNodes)
{
try
{
int newConnections = await AttemptConnectOrphanNodeAsync(index, node, textMemory);
if (newConnections > 0)
{
enhancedCount++;
}
}
catch (Exception ex)
{
Console.WriteLine($"增强节点 {node.Name} 关系时出错:{ex.Message}");
}
}
Console.WriteLine($"关系增强完成,共为 {enhancedCount} 个节点建立了新关系");
}
/// <summary>
/// 批量关系验证:检查并优化现有关系的质量
/// </summary>
/// <param name="index"></param>
/// <returns></returns>
public async Task ValidateAndOptimizeRelationshipsAsync(string index)
{
if (string.IsNullOrWhiteSpace(index))
{
throw new ArgumentException("Index required value cannot be null.");
}
Console.WriteLine("开始验证和优化现有关系...");
var allEdges = _edges_Repositories.GetList(p => p.Index == index);
var weakRelationships = new List<Edges>();
// 识别可能需要优化的关系
foreach (var edge in allEdges)
{
// 检查关系描述是否过于简单或模糊
if (string.IsNullOrWhiteSpace(edge.Relationship) ||
edge.Relationship.Length < 3 ||
edge.Relationship.ToLower().Contains("related") ||
edge.Relationship.ToLower().Contains("associated"))
{
weakRelationships.Add(edge);
}
}
Console.WriteLine($"发现 {weakRelationships.Count} 个需要优化的关系");
// 优化弱关系
int optimizedCount = 0;
foreach (var edge in weakRelationships.Take(20)) // 限制处理数量
{
try
{
var sourceNode = _nodes_Repositories.GetFirst(p => p.Id == edge.Source);
var targetNode = _nodes_Repositories.GetFirst(p => p.Id == edge.Target);
if (sourceNode != null && targetNode != null)
{
string sourceText = $"Name:{sourceNode.Name};Type:{sourceNode.Type};Desc:{sourceNode.Desc}";
string targetText = $"Name:{targetNode.Name};Type:{targetNode.Type};Desc:{targetNode.Desc}";
var newRelationship = await _semanticService.GetRelationship(sourceText, targetText);
if (newRelationship.IsRelationship &&
!string.IsNullOrWhiteSpace(newRelationship.Edge.Relationship) &&
newRelationship.Edge.Relationship != edge.Relationship)
{
edge.Relationship = newRelationship.Edge.Relationship;
_edges_Repositories.Update(edge);
optimizedCount++;
Console.WriteLine($"优化关系: {sourceNode.Name} -> {targetNode.Name}: {newRelationship.Edge.Relationship}");
}
}
}
catch (Exception ex)
{
Console.WriteLine($"优化关系时出错:{ex.Message}");
}
}
Console.WriteLine($"关系优化完成,共优化了 {optimizedCount} 个关系");
}
public async Task DeleteGraph(string index)
{
SemanticTextMemory textMemory = await _semanticService.GetTextMemory();
var nodes = await _nodes_Repositories.GetListAsync(p => p.Index == index);
foreach (var node in nodes)
{
//删除向量数据
await textMemory.RemoveAsync(index, node.Id);
}
//删除索引数据
await _nodes_Repositories.DeleteAsync(p => p.Index == index);
await _edges_Repositories.DeleteAsync(p => p.Index == index);
await _communities_Repositories.DeleteAsync(p => p.Index == index);
await _communitieNodes_Repositories.DeleteAsync(p => p.Index == index);
await _globals_Repositories.DeleteAsync(p => p.Index == index);
}
#region 内部方法
/// <summary>
/// 检测和处理孤立节点
/// </summary>
/// <param name="index"></param>
/// <param name="newNodes"></param>
/// <param name="textMemory"></param>
/// <returns></returns>
private async Task ProcessOrphanNodesAsync(string index, List<Nodes> newNodes, SemanticTextMemory textMemory)
{
Console.WriteLine($"开始检测孤立节点,新增节点数:{newNodes.Count}");
foreach (var node in newNodes)
{
// 检查节点是否为孤立节点(没有任何边连接)
bool hasConnections = _edges_Repositories.IsAny(p =>
(p.Source == node.Id || p.Target == node.Id) && p.Index == index);
if (!hasConnections)
{
Console.WriteLine($"发现孤立节点:{node.Name}");
var connectionsFound = await AttemptConnectOrphanNodeAsync(index, node, textMemory);
Console.WriteLine($"为节点 {node.Name} 建立了 {connectionsFound} 个新连接");
}
}
}
/// <summary>
/// 尝试为孤立节点建立连接
/// </summary>
/// <param name="index"></param>
/// <param name="orphanNode"></param>
/// <param name="textMemory"></param>
/// <returns>返回建立的新连接数量</returns>
private async Task<int> AttemptConnectOrphanNodeAsync(string index, Nodes orphanNode, SemanticTextMemory textMemory)
{
string nodeText = $"Name:{orphanNode.Name};Type:{orphanNode.Type};Desc:{orphanNode.Desc}";
// 使用更低的阈值和更多的搜索结果来寻找潜在关系
List<string> candidateNodes = new List<string>();
// 第一轮:基于节点描述搜索
await foreach (MemoryQueryResult memory in textMemory.SearchAsync(index, nodeText, limit: 10, minRelevanceScore: 0.5))
{
if (memory.Metadata.Id != orphanNode.Id)
{
candidateNodes.Add(memory.Metadata.Id);
}
}
// 第二轮:基于节点名称搜索(针对命名实体)
if (candidateNodes.Count < 3)
{
await foreach (MemoryQueryResult memory in textMemory.SearchAsync(index, orphanNode.Name, limit: 5, minRelevanceScore: 0.6))
{
if (memory.Metadata.Id != orphanNode.Id && !candidateNodes.Contains(memory.Metadata.Id))
{
candidateNodes.Add(memory.Metadata.Id);
}
}
}
// 第三轮:基于节点类型搜索相同类型的实体
if (candidateNodes.Count < 2)
{
var sameTypeNodes = _nodes_Repositories.GetList(p =>
p.Index == index && p.Type == orphanNode.Type && p.Id != orphanNode.Id)
.Take(5).Select(p => p.Id).ToList();
foreach (var nodeId in sameTypeNodes)
{
if (!candidateNodes.Contains(nodeId))
{
candidateNodes.Add(nodeId);
}
}
}
// 尝试建立关系
int connectionsFound = 0;
foreach (var candidateId in candidateNodes.Take(5)) // 限制检查数量以控制成本
{
var candidateNode = _nodes_Repositories.GetFirst(p => p.Id == candidateId);
if (candidateNode != null)
{
string candidateText = $"Name:{candidateNode.Name};Type:{candidateNode.Type};Desc:{candidateNode.Desc}";
try
{
var relationShip = await _semanticService.GetRelationship(candidateText, nodeText);
if (relationShip.IsRelationship)
{
// 确定关系方向
string sourceId, targetId;
if (relationShip.Edge.Source == "node1")
{
sourceId = candidateNode.Id;
targetId = orphanNode.Id;
}
else
{
sourceId = orphanNode.Id;
targetId = candidateNode.Id;
}
// 检查关系是否已存在
if (!_edges_Repositories.IsAny(p => p.Source == sourceId && p.Target == targetId && p.Index == index))
{
var edge = new Edges()
{
Id = Guid.NewGuid().ToString(),
Index = index,
Source = sourceId,
Target = targetId,
Relationship = relationShip.Edge.Relationship
};
_edges_Repositories.Insert(edge);
connectionsFound++;
Console.WriteLine($"为孤立节点 {orphanNode.Name} 建立关系:{relationShip.Edge.Relationship} -> {candidateNode.Name}");
// 如果已经找到足够的连接,停止搜索
if (connectionsFound >= 2)
{
break;
}
}
}
}
catch (Exception ex)
{
Console.WriteLine($"为孤立节点建立关系时出错:{ex.Message}");
}
}
}
if (connectionsFound == 0)
{
Console.WriteLine($"警告:未能为孤立节点 {orphanNode.Name} 建立任何关系");
}
return connectionsFound;
}
/// <summary>
/// 基于搜索条件检索TextMemModel的列表。
/// </summary>
/// <param name="index">索引</param>
/// <param name="input">输入文本</param>
/// <param name="minRelevance">最小相关性阈值</param>
/// <param name="limit">搜索结果限制</param>
/// <returns></returns>
private async Task<List<TextMemModel>> RetrieveTextMemModelList(string index, string input, double? minRelevance = null, int? limit = null)
{
SemanticTextMemory textMemory = await _semanticService.GetTextMemory();
List<TextMemModel> textMemModelList = new List<TextMemModel>();
// 使用提供的阈值或默认配置
double relevanceThreshold = minRelevance ?? GraphSearchOption.SearchMinRelevance;
int resultLimit = limit ?? GraphSearchOption.SearchLimit;
int matchCount = 0;
await foreach (MemoryQueryResult memory in textMemory.SearchAsync(index, input, limit: resultLimit, minRelevanceScore: relevanceThreshold))
{
matchCount++;
var textMemModel = new TextMemModel()
{
Id = memory.Metadata.Id,
Text = memory.Metadata.Text,
Relevance = memory.Relevance
};
textMemModelList.Add(textMemModel);
}
// 如果结果不足,尝试降低阈值
if (matchCount < 2 && relevanceThreshold > 0.3)
{
double lowerThreshold = Math.Max(0.3, relevanceThreshold - 0.2);
Console.WriteLine($"结果不足,降低阈值至:{lowerThreshold}重试");
await foreach (MemoryQueryResult memory in textMemory.SearchAsync(index, input, limit: resultLimit + 2, minRelevanceScore: lowerThreshold))
{
if (!textMemModelList.Any(t => t.Id == memory.Metadata.Id))
{
matchCount++;
var textMemModel = new TextMemModel()
{
Id = memory.Metadata.Id,
Text = memory.Metadata.Text,
Relevance = memory.Relevance
};
textMemModelList.Add(textMemModel);
}
}
}
// 按相关性排序
textMemModelList = textMemModelList.OrderByDescending(t => t.Relevance).ToList();
Console.WriteLine($"向量匹配数:{matchCount}, 最高相关度:{(textMemModelList.Any() ? textMemModelList.First().Relevance.ToString("F2") : "N/A")}");
return textMemModelList;
}
/// <summary>
/// 递归获取节点相关的所有边和节点
/// </summary>
/// <param name="index">索引</param>
/// <param name="initialNodes">初始节点列表</param>
/// <param name="nodeWeights">节点权重字典</param>
/// <returns></returns>
private GraphModel GetGraphAllRecursion(string index, List<Nodes> initialNodes, Dictionary<string, double> nodeWeights)
{
var allNodes = new List<Nodes>(initialNodes);
var allEdges = new List<Edges>();
var nodesToExplore = new List<Nodes>(initialNodes);
int depth = 0;
while (nodesToExplore.Count > 0)
{
if (depth >= GraphSearchOption.NodeDepth || allNodes.Count >= GraphSearchOption.MaxNodes)
{
break;
}
// 按权重排序待探索节点
nodesToExplore = nodesToExplore
.OrderByDescending(n => nodeWeights.ContainsKey(n.Id) ? nodeWeights[n.Id] : 0)
.ToList();
var currentNodes = nodesToExplore.Take(Math.Min(5, nodesToExplore.Count)).ToList();
nodesToExplore.RemoveRange(0, currentNodes.Count);
var newEdges = GetEdges(index, currentNodes);
if (!newEdges.Any())
{
continue;
}
// 添加新边,避免重复
foreach (var edge in newEdges)
{
if (!allEdges.Any(e => e.Source == edge.Source && e.Target == edge.Target))
{
allEdges.Add(edge);
// 为新发现的节点设置权重
double parentWeight = nodeWeights.GetValueOrDefault(edge.Source, 0);
double weightDecay = 0.8; // 权重衰减因子
if (!nodeWeights.ContainsKey(edge.Target))
{
nodeWeights[edge.Target] = parentWeight * weightDecay;
}
}
}
// 获取新节点
var newNodes = GetNodes(index, newEdges);
var nodesToAdd = newNodes.Where(n => !allNodes.Any(existingNode => existingNode.Id == n.Id)).ToList();
allNodes.AddRange(nodesToAdd);
nodesToExplore.AddRange(nodesToAdd);
depth++;
}
// 如果节点数超过限制,保留权重最高的节点
if (allNodes.Count > GraphSearchOption.MaxNodes)
{
allNodes = allNodes
.OrderByDescending(n => nodeWeights.GetValueOrDefault(n.Id, 0))
.Take(GraphSearchOption.MaxNodes)
.ToList();
// 确保边的节点都在保留的节点中
allEdges = allEdges
.Where(e => allNodes.Any(n => n.Id == e.Source) && allNodes.Any(n => n.Id == e.Target))
.ToList();
}
return new GraphModel
{
Nodes = allNodes,
Edges = allEdges
};
}
/// <summary>
/// 通过社区算法检索社区节点
/// </summary>
/// <param name="index"></param>
/// <param name="initialNodes"></param>
/// <returns></returns>
private GraphModel GetGraphAllCommunitiesRecursion(string index, List<Nodes> initialNodes)
{
var allNodes = new List<Nodes>();
var allEdges = new List<Edges>();
var nodeIds = initialNodes.Select(x => x.Id).ToList();
var communitiesNodes = _communities_Repositories.GetDB().Queryable<Communities>()
.LeftJoin<CommunitieNodes>((c, cn) => c.CommunitieId == cn.CommunitieId)
.LeftJoin<Nodes>((c, cn, n) => cn.NodeId == n.Id)
.Where((c, cn, n) => nodeIds.Contains(n.Id)).Select((c, cn, n) => new Nodes() { Index = n.Index, Id = n.Id, Name = n.Name, Type = n.Type, Desc = n.Desc }).ToList();
allNodes.AddRange(communitiesNodes);
var newEdges = GetEdges(index, allNodes);
foreach (var edge in newEdges)
{
if (!allEdges.Any(e => e.Source == edge.Source && e.Target == edge.Target))
{
allEdges.Add(edge);
}
}
// 如果节点数超过最大限制,进行截断
if (allNodes.Count > GraphSearchOption.MaxNodes)
{
allNodes = allNodes.Take(GraphSearchOption.MaxNodes).ToList();
}
// 需要相应地处理 allEdges,确保边的节点在 allNodes 中
allEdges = allEdges.Where(e => allNodes.Any(p => p.Id == e.Source) && allNodes.Any(p => p.Id == e.Target)).ToList();
return new GraphModel
{
Nodes = allNodes,
Edges = allEdges
};
}
/// <summary>
/// 获取边信息
/// </summary>
/// <param name="index">索引</param>
/// <param name="nodes">节点列表</param>
/// <returns></returns>
private List<Edges> GetEdges(string index, List<Nodes> nodes)
{
var nodeIds = nodes.Select(x => x.Id).ToList();
var edges = new List<Edges>();
edges = _edges_Repositories.GetList(x => x.Index == index && nodeIds.Contains(x.Source) && nodeIds.Contains(x.Target));
return edges;
}
/// <summary>
/// 获取节点信息
/// </summary>
/// <param name="index">索引</param>
/// <param name="edges">边列表</param>
/// <returns></returns>
private List<Nodes> GetNodes(string index, List<Edges> edges)
{
var targets = edges.Select(p => p.Target).ToList();
var sources = edges.Select(p => p.Source).ToList();
List<string> nodeIds = new List<string>();
nodeIds.AddRange(targets);
nodeIds.AddRange(sources);
var nodes = _nodes_Repositories.GetList(p => p.Index == index || nodeIds.Contains(p.Id));
return nodes;
}
/// <summary>
/// 获取相关社区ID列表
/// </summary>
private List<string> GetRelevantCommunities(string index, List<string> nodeIds)
{
var communities = _communitieNodes_Repositories.GetDB().Queryable<CommunitieNodes>()
.Where(cn => nodeIds.Contains(cn.NodeId))
.Select(cn => cn.CommunitieId)
.Distinct()
.ToList();
return communities;
}
#endregion
}
}
================================================
FILE: src/GraphRag.Net/Domain/Service/SemanticService.cs
================================================
using Azure.AI.OpenAI;
using GraphRag.Net.Options;
using GraphRag.Net.Domain.Interface;
using GraphRag.Net.Utils;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.SemanticKernel;
using Microsoft.SemanticKernel.Connectors.OpenAI;
using Microsoft.SemanticKernel.Connectors.Postgres;
using Microsoft.SemanticKernel.Connectors.Sqlite;
using Microsoft.SemanticKernel.Memory;
using Npgsql;
using Newtonsoft.Json;
using GraphRag.Net.Domain.Model.Graph;
using Polly;
using Polly.Retry;
using GraphRag.Net.Common.Options;
namespace GraphRag.Net.Domain.Service
{
[ServiceDescription(typeof(ISemanticService), ServiceLifetime.Scoped)]
public class SemanticService(Kernel _kernel) : ISemanticService
{
public async Task<GraphModel> CreateGraphAsync(string input)
{
var retryPolicy = Policy.Handle<Exception>().RetryAsync(GraphSysOption.RetryCounnt, (ex, count) =>
{
Console.WriteLine($"CreateGraphAsync失败,重试{count}次,异常信息{ex.Message}");
});
var result = await retryPolicy.ExecuteAsync<GraphModel>(async () =>
{
OpenAIPromptExecutionSettings settings = new()
{
Temperature = 0,
ResponseFormat = ChatCompletionsResponseFormat.JsonObject
};
KernelFunction createFun = _kernel.Plugins.GetFunction("graph", "create");
var args = new KernelArguments(settings)
{
["input"] = input,
};
var skresult = await _kernel.InvokeAsync(createFun, args);
string json = skresult.GetValue<string>()?.Trim() ?? "";
var graph = JsonConvert.DeserializeObject<GraphModel>(json);
return graph;
});
return result;
}
public async Task<string> GetGraphAnswerAsync(string graph, string input)
{
KernelFunction createFun = _kernel.Plugins.GetFunction("graph", "search");
var args = new KernelArguments()
{
["graph"] = graph,
["input"] = input,
};
var skresult = await _kernel.InvokeAsync(createFun, args);
string result = skresult.GetValue<string>()?.Trim() ?? "";
return result;
}
public async IAsyncEnumerable<StreamingKernelContent> GetGraphAnswerStreamAsync(string graph, string input)
{
KernelFunction createFun = _kernel.Plugins.GetFunction("graph", "search");
var args = new KernelArguments()
{
["graph"] = graph,
["input"] = input,
};
var skresult = _kernel.InvokeStreamingAsync(createFun, args);
await foreach (var content in skresult)
{
yield return content;
}
}
public async Task<string> GetGraphCommunityAnswerAsync(string graph, string community, string global, string input)
{
KernelFunction createFun = _kernel.Plugins.GetFunction("graph", "community_search");
var args = new KernelArguments()
{
["graph"] = graph,
["community"] = community,
["global"] = global,
["input"] = input,
};
var skresult = await _kernel.InvokeAsync(createFun, args);
string result = skresult.GetValue<string>()?.Trim() ?? "";
return result;
}
public async IAsyncEnumerable<StreamingKernelContent> GetGraphCommunityAnswerStreamAsync(string graph, string community, string global, string input)
{
KernelFunction createFun = _kernel.Plugins.GetFunction("graph", "community_search");
var args = new KernelArguments()
{
["graph"] = graph,
["community"] = community,
["global"] = global,
["input"] = input,
};
var skresult = _kernel.InvokeStreamingAsync(createFun, args);
await foreach (var content in skresult)
{
yield return content;
}
}
public async Task<RelationShipModel> GetRelationship(string node1, string node2)
{
var retryPolicy = Policy.Handle<Exception>().RetryAsync(GraphSysOption.RetryCounnt, (ex, count) =>
{
Console.WriteLine($"GetRelationship失败,重试{count}次,异常信息{ex.Message}");
});
var result = await retryPolicy.ExecuteAsync<RelationShipModel>(async () =>
{
OpenAIPromptExecutionSettings settings = new()
{
Temperature = 0,
ResponseFormat = ChatCompletionsResponseFormat.JsonObject
};
KernelFunction createFun = _kernel.Plugins.GetFunction("graph", "relationship");
var args = new KernelArguments(settings)
{
["node1"] = node1,
["node2"] = node2,
};
var skresult = await _kernel.InvokeAsync(createFun, args);
string json = skresult.GetValue<string>()?.Trim() ?? "";
var relation = JsonConvert.DeserializeObject<RelationShipModel>(json);
return relation;
});
return result;
}
public async Task<string> MergeDesc(string desc1, string desc2)
{
KernelFunction createFun = _kernel.Plugins.GetFunction("graph", "mergedesc");
var args = new KernelArguments()
{
["desc1"] = desc1,
["desc2"] = desc2,
};
var skresult = await _kernel.InvokeAsync(createFun, args);
string result = skresult.GetValue<string>()?.Trim() ?? "";
return result;
}
public async Task<string> CommunitySummaries(string nodes)
{
KernelFunction createFun = _kernel.Plugins.GetFunction("graph", "community_summaries");
var args = new KernelArguments()
{
["nodes"] = nodes
};
var skresult = await _kernel.InvokeAsync(createFun, args);
string result = skresult.GetValue<string>()?.Trim() ?? "";
return result;
}
public async Task<string> GlobalSummaries(string community)
{
KernelFunction createFun = _kernel.Plugins.GetFunction("graph", "global_summaries");
var args = new KernelArguments()
{
["community"] = community
};
var skresult = await _kernel.InvokeAsync(createFun, args);
string result = skresult.GetValue<string>()?.Trim() ?? "";
return result;
}
/// <summary>
/// 获取SemanticTextMemory
/// </summary>
/// <returns></returns>
/// <exception cref="InvalidOperationException"></exception>
public async Task<SemanticTextMemory> GetTextMemory()
{
IMemoryStore memoryStore = null;
switch (GraphDBConnectionOption.DbType)
{
case "Sqlite":
memoryStore = await SqliteMemoryStore.ConnectAsync(GraphDBConnectionOption.VectorConnection);
break;
case "PostgreSQL":
NpgsqlDataSourceBuilder dataSourceBuilder = new(GraphDBConnectionOption.VectorConnection);
dataSourceBuilder.UseVector();
NpgsqlDataSource dataSource = dataSourceBuilder.Build();
memoryStore = new PostgresMemoryStore(dataSource, vectorSize: 1536, schema: "public");
break;
}
if (memoryStore == null)
{
throw new InvalidOperationException("GraphDBConnection error failed to initialize memory store.");
}
var handler = new OpenAIHttpClientHandler();
var httpClient = new HttpClient(handler);
httpClient.Timeout = TimeSpan.FromMinutes(10);
var embeddingGenerator = new OpenAITextEmbeddingGenerationService(GraphOpenAIOption.EmbeddingModel, GraphOpenAIOption.Key, httpClient: new HttpClient(handler));
SemanticTextMemory textMemory = new(memoryStore, embeddingGenerator);
return textMemory;
}
}
}
================================================
FILE: src/GraphRag.Net/Extensions/ServiceCollectionExtensions.cs
================================================
using System.Reflection;
using GraphRag.Net;
using GraphRag.Net.Options;
using GraphRag.Net.Repositories;
using GraphRag.Net.Utils;
using Microsoft.SemanticKernel;
using SqlSugar;
namespace Microsoft.Extensions.DependencyInjection
{
/// <summary>
/// 容器扩展
/// </summary>
public static class ServiceCollectionExtensions
{
/// <summary>
/// 从程序集中加载类型并添加到容器中
/// </summary>
/// <param name="services">容器</param>
/// <returns></returns>
public static IServiceCollection AddGraphRagNet(this IServiceCollection services, Kernel _kernel = null)
{
Type attributeType = typeof(ServiceDescriptionAttribute);
//var refAssembyNames = Assembly.GetExecutingAssembly().GetReferencedAssemblies();
Assembly assembly = Assembly.Load("GraphRag.Net");
var types = assembly.GetTypes();
foreach (var classType in types)
{
if (!classType.IsAbstract && classType.IsClass && classType.IsDefined(attributeType, false))
{
ServiceDescriptionAttribute serviceAttribute = (classType.GetCustomAttribute(attributeType) as ServiceDescriptionAttribute);
switch (serviceAttribute.Lifetime)
{
case ServiceLifetime.Scoped:
services.AddScoped(serviceAttribute.ServiceType, classType);
break;
case ServiceLifetime.Singleton:
services.AddSingleton(serviceAttribute.ServiceType, classType);
break;
case ServiceLifetime.Transient:
services.AddTransient(serviceAttribute.ServiceType, classType);
break;
}
}
}
CodeFirst();
InitSK(services, _kernel);
return services;
}
/// <summary>
/// 初始化SK
/// </summary>
/// <param name="services"></param>
/// <param name="_kernel">可以提供自定义Kernel</param>
static void InitSK(IServiceCollection services,Kernel _kernel = null)
{
var handler = new OpenAIHttpClientHandler();
services.AddTransient<Kernel>((serviceProvider) =>
{
if (_kernel == null)
{
_kernel = Kernel.CreateBuilder()
.AddOpenAIChatCompletion(
modelId: GraphOpenAIOption.ChatModel,
apiKey: GraphOpenAIOption.Key,
httpClient: new HttpClient(handler)
)
.Build();
}
//导入插件
if (!_kernel.Plugins.Any(p => p.Name == "graph"))
{
var pluginPatth = Path.Combine(RepoFiles.SamplePluginsPath(), "graph");
Console.WriteLine($"pluginPatth:{pluginPatth}");
_kernel.ImportPluginFromPromptDirectory(pluginPatth);
}
return _kernel;
});
}
/// <summary>
/// 初始化DB
/// </summary>
static void CodeFirst()
{
// 获取仓储服务
var _repository = new Nodes_Repositories();
// 创建数据库(如果不存在)
_repository.GetDB().DbMaintenance.CreateDatabase();
// 在所有程序集中查找具有[SugarTable]特性的类
var assembly = Assembly.GetExecutingAssembly();
// 获取该程序集中所有具有SugarTable特性的类型
var entityTypes = assembly.GetTypes()
.Where(type => TypeIsEntity(type));
// 为每个找到的类型初始化数据库表
foreach (var type in entityTypes)
{
_repository.GetDB().CodeFirst.InitTables(type);
}
}
static bool TypeIsEntity(Type type)
{
// 检查类型是否具有SugarTable特性
return type.GetCustomAttributes(typeof(SugarTable), inherit: false).Length > 0;
}
}
}
================================================
FILE: src/GraphRag.Net/GraphRag.Net.csproj
================================================
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net6.0;net7.0;net8.0</TargetFrameworks>
<LangVersion>latest</LangVersion>
<Version>$(Version)</Version>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<Authors>许泽宇</Authors>
<Product>GraphRag.Net</Product>
<Company>xuzeyu</Company>
<Title>GraphRag.Net</Title>
<Description>
GraphRag for .NET –这是一个参考GraphRag的DotNet简易实现。
基于微软在论文中提到的实现思路,执行过程GraphRAG主要实现了如下功能:
Source Documents → Text Chunks:将源文档分割成文本块。
Text Chunks → Element Instances:从每个文本块中提取图节点和边的实例。
Element Instances → Element Summaries:为每个图元素生成摘要。
Element Summaries → Graph Communities:使用社区检测算法将图划分为社区。
Graph Communities → Community Summaries:为每个社区生成摘要。
Community Summaries → Community Answers → Global Answer:使用社区摘要生成局部答案,然后汇总这些局部答案以生成全局答案。
商务需求联系微信xuzeyu91
</Description>
<PackageProjectUrl>https://github.com/xuzeyu91/GraphRag.Net</PackageProjectUrl>
<Tags>AI, Rag, GraphRag</Tags>
<PackageLicenseExpression>Apache-2.0</PackageLicenseExpression>
<NoWarn>CA1050,CA1707,CA2007,VSTHRD111,CS1591,RCS1110,CA5394,SKEXP0001,SKEXP0002,SKEXP0003,SKEXP0004,SKEXP0010,SKEXP0011,,SKEXP0012,SKEXP0020,SKEXP0021,SKEXP0022,SKEXP0023,SKEXP0024,SKEXP0025,SKEXP0026,SKEXP0027,SKEXP0028,SKEXP0029,SKEXP0030,SKEXP0031,SKEXP0032,SKEXP0040,SKEXP0041,SKEXP0042,SKEXP0050,SKEXP0051,SKEXP0052,SKEXP0053,SKEXP0054,SKEXP0055,SKEXP0060,SKEXP0061,SKEXP0101,SKEXP0102</NoWarn>
<GenerateDocumentationFile>True</GenerateDocumentationFile>
<DocumentationFile>GraphRag.Net.xml</DocumentationFile>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.SemanticKernel" Version="$(SKVersion)" />
<PackageReference Include="Microsoft.SemanticKernel.Core" Version="$(SKVersion)" />
<PackageReference Include="Microsoft.SemanticKernel.Plugins.Core" Version="$(SKVersion)-alpha" />
<PackageReference Include="Microsoft.SemanticKernel.Connectors.Postgres" Version="$(SKVersion)-alpha" />
<PackageReference Include="Microsoft.SemanticKernel.Connectors.Sqlite" Version="$(SKVersion)-alpha" />
<PackageReference Include="Microsoft.SemanticKernel.Plugins.Memory" Version="$(SKVersion)-alpha" />
<PackageReference Include="Polly" Version="8.5.0" />
<PackageReference Include="SqlSugarCore" Version="5.1.4.171" />
</ItemGroup>
</Project>
================================================
FILE: src/GraphRag.Net/Repositories/Base/IRepository.cs
================================================
using GraphRag.Net.Model;
using SqlSugar;
using System.Linq.Expressions;
namespace GraphRag.Net.Base
{
public interface IRepository<T>
{
SqlSugarScope GetDB();
List<T> GetList();
Task<List<T>> GetListAsync();
List<T> GetList(Expression<Func<T, bool>> whereExpression);
Task<List<T>> GetListAsync(Expression<Func<T, bool>> whereExpression);
int Count(Expression<Func<T, bool>> whereExpression);
Task<int> CountAsync(Expression<Func<T, bool>> whereExpression);
PageList<T> GetPageList(Expression<Func<T, bool>> whereExpression, PageModel page);
Task<PageList<T>> GetPageListAsync(Expression<Func<T, bool>> whereExpression, PageModel page);
PageList<T> GetPageList(Expression<Func<T, bool>> whereExpression, PageModel page, Expression<Func<T, object>> orderByExpression = null, OrderByType orderByType = OrderByType.Asc);
Task<PageList<T>> GetPageListAsync(Expression<Func<T, bool>> whereExpression, PageModel page, Expression<Func<T, object>> orderByExpression = null, OrderByType orderByType = OrderByType.Asc);
PageList<T> GetPageList(List<IConditionalModel> conditionalList, PageModel page);
Task<PageList<T>> GetPageListAsync(List<IConditionalModel> conditionalList, PageModel page);
PageList<T> GetPageList(List<IConditionalModel> conditionalList, PageModel page, Expression<Func<T, object>> orderByExpression = null, OrderByType orderByType = OrderByType.Asc);
Task<PageList<T>> GetPageListAsync(List<IConditionalModel> conditionalList, PageModel page, Expression<Func<T, object>> orderByExpression = null, OrderByType orderByType = OrderByType.Asc);
T GetById(dynamic id);
Task<T> GetByIdAsync(dynamic id);
T GetSingle(Expression<Func<T, bool>> whereExpression);
Task<T> GetSingleAsync(Expression<Func<T, bool>> whereExpression);
T GetFirst(Expression<Func<T, bool>> whereExpression);
Task<T> GetFirstAsync(Expression<Func<T, bool>> whereExpression);
bool Insert(T obj);
Task<bool> InsertAsync(T obj);
bool InsertRange(List<T> objs);
Task<bool> InsertRangeAsync(List<T> objs);
int InsertReturnIdentity(T obj);
Task<int> InsertReturnIdentityAsync(T obj);
long InsertReturnBigIdentity(T obj);
Task<long> InsertReturnBigIdentityAsync(T obj);
bool DeleteByIds(dynamic[] ids);
Task<bool> DeleteByIdsAsync(dynamic[] ids);
bool Delete(dynamic id);
Task<bool> DeleteAsync(dynamic id);
bool Delete(T obj);
Task<bool> DeleteAsync(T obj);
bool Delete(Expression<Func<T, bool>> whereExpression);
Task<bool> DeleteAsync(Expression<Func<T, bool>> whereExpression);
bool Update(T obj);
Task<bool> UpdateAsync(T obj);
bool UpdateRange(List<T> objs);
bool InsertOrUpdate(T obj);
Task<bool> InsertOrUpdateAsync(T obj);
Task<bool> UpdateRangeAsync(List<T> objs);
bool IsAny(Expression<Func<T, bool>> whereExpression);
Task<bool> IsAnyAsync(Expression<Func<T, bool>> whereExpression);
}
}
================================================
FILE: src/GraphRag.Net/Repositories/Base/Repository.cs
================================================
using GraphRag.Net.Model;
using SqlSugar;
using System.Linq.Expressions;
namespace GraphRag.Net.Base
{
public class Repository<T> : SimpleClient<T> where T : class, new()
{
public Repository(ISqlSugarClient context = null) : base(context)//注意这里要有默认值等于null
{
if (context == null)
{
}
}
//注意:如果使用Client不能写成静态的,Scope并发更高
public static SqlSugarScope SqlScope = SqlSugarHelper.SqlScope();
public SimpleClient<T> CurrentDb
{ get { return new SimpleClient<T>(SqlScope); } }//用来处理T表的常用操作
#region 通用方法
public virtual SqlSugarScope GetDB()
{
return SqlScope;
}
/// <summary>
/// 获取所有list
/// </summary>
/// <returns></returns>
public virtual List<T> GetList()
{
return CurrentDb.GetList();
}
/// <summary>
/// 获取所有list-异步
/// </summary>
/// <returns></returns>
public virtual async Task<List<T>> GetListAsync()
{
return await CurrentDb.GetListAsync();
}
/// <summary>
/// 根据lambda查询
/// </summary>
/// <param name="whereExpression"></param>
/// <returns></returns>
public virtual List<T> GetList(Expression<Func<T, bool>> whereExpression)
{
return CurrentDb.GetList(whereExpression);
}
/// <summary>
/// 根据lambda查询-异步
/// </summary>
/// <param name="whereExpression"></param>
/// <returns></returns>
public virtual async Task<List<T>> GetListAsync(Expression<Func<T, bool>> whereExpression)
{
return await CurrentDb.GetListAsync(whereExpression);
}
/// <summary>
/// 根据lambda表达式获取数量
/// </summary>
/// <param name="whereExpression"></param>
/// <returns></returns>
public virtual int Count(Expression<Func<T, bool>> whereExpression)
{
return CurrentDb.Count(whereExpression);
}
/// <summary>
/// 根据lambda表达式获取数量-异步
/// </summary>
/// <param name="whereExpression"></param>
/// <returns></returns>
public virtual async Task<int> CountAsync(Expression<Func<T, bool>> whereExpression)
{
return await CurrentDb.CountAsync(whereExpression);
}
/// <summary>
/// 获取分页
/// </summary>
/// <param name="whereExpression"></param>
/// <param name="page"></param>
/// <returns></returns>
public virtual PageList<T> GetPageList(Expression<Func<T, bool>> whereExpression, PageModel page)
{
PageList<T> list = new PageList<T>();
list.List = CurrentDb.GetPageList(whereExpression, page);
list.PageIndex = page.PageIndex;
list.PageSize = page.PageSize;
list.TotalCount = page.TotalCount;
return list;
}
/// <summary>
/// 获取分页-异步
/// </summary>
/// <param name="whereExpression"></param>
/// <param name="page"></param>
/// <returns></returns>
public virtual async Task<PageList<T>> GetPageListAsync(Expression<Func<T, bool>> whereExpression, PageModel page)
{
PageList<T> list = new PageList<T>();
list.List = await CurrentDb.GetPageListAsync(whereExpression, page);
list.PageIndex = page.PageIndex;
list.PageSize = page.PageSize;
list.TotalCount = page.TotalCount;
return list;
}
public virtual PageList<T> GetPageList(Expression<Func<T, bool>> whereExpression, PageModel page, Expression<Func<T, object>> orderByExpression = null, OrderByType orderByType = OrderByType.Asc)
{
PageList<T> list = new PageList<T>();
list.List = CurrentDb.GetPageList(whereExpression, page, orderByExpression, orderByType);
list.PageIndex = page.PageIndex;
list.PageSize = page.PageSize;
list.TotalCount = page.TotalCount;
return list;
}
public virtual async Task<PageList<T>> GetPageListAsync(Expression<Func<T, bool>> whereExpression, PageModel page, Expression<Func<T, object>> orderByExpression = null, OrderByType orderByType = OrderByType.Asc)
{
PageList<T> list = new PageList<T>();
list.List = await CurrentDb.GetPageListAsync(whereExpression, page, orderByExpression, orderByType);
list.PageIndex = page.PageIndex;
list.PageSize = page.PageSize;
list.TotalCount = page.TotalCount;
return list;
}
public virtual PageList<T> GetPageList(List<IConditionalModel> conditionalList, PageModel page)
{
PageList<T> list = new PageList<T>();
list.List = CurrentDb.GetPageList(conditionalList, page);
list.PageIndex = page.PageIndex;
list.PageSize = page.PageSize;
list.TotalCount = page.TotalCount;
return list;
}
public virtual async Task<PageList<T>> GetPageListAsync(List<IConditionalModel> conditionalList, PageModel page)
{
PageList<T> list = new PageList<T>();
list.List = await CurrentDb.GetPageListAsync(conditionalList, page);
list.PageIndex = page.PageIndex;
list.PageSize = page.PageSize;
list.TotalCount = page.TotalCount;
return list;
}
public virtual PageList<T> GetPageList(List<IConditionalModel> conditionalList, PageModel page, Expression<Func<T, object>> orderByExpression = null, OrderByType orderByType = OrderByType.Asc)
{
PageList<T> list = new PageList<T>();
list.List = CurrentDb.GetPageList(conditionalList, page, orderByExpression, orderByType);
list.PageIndex = page.PageIndex;
list.PageSize = page.PageSize;
list.TotalCount = page.TotalCount;
return list;
}
public virtual async Task<PageList<T>> GetPageListAsync(List<IConditionalModel> conditionalList, PageModel page, Expression<Func<T, object>> orderByExpression = null, OrderByType orderByType = OrderByType.Asc)
{
PageList<T> list = new PageList<T>();
list.List = await CurrentDb.GetPageListAsync(conditionalList, page, orderByExpression, orderByType);
list.PageIndex = page.PageIndex;
list.PageSize = page.PageSize;
list.TotalCount = page.TotalCount;
return list;
}
/// <summary>
/// 根据id获取实体
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
public virtual T GetById(dynamic id)
{
return CurrentDb.GetById(id);
}
/// <summary>
/// 根据id获取实体-异步
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
public virtual async Task<T> GetByIdAsync(dynamic id)
{
return await CurrentDb.GetByIdAsync(id);
}
/// <summary>
/// 根据lambda获取单个对象 (注意,需要确保唯一,如果获取到2个会报错,这种场景需要使用GetFirst)
/// </summary>
/// <param name="whereExpression"></param>
/// <returns></returns>
public virtual T GetSingle(Expression<Func<T, bool>> whereExpression)
{
return CurrentDb.GetSingle(whereExpression); //Db.Queryable<T>().First(whereExpression);
}
/// <summary>
/// 根据lambda获取单个对象-异步 (注意,需要确保唯一,如果获取到2个会报错,这种场景需要使用GetFirst)
/// </summary>
/// <param name="whereExpression"></param>
/// <returns></returns>
public virtual async Task<T> GetSingleAsync(Expression<Func<T, bool>> whereExpression)
{
return await CurrentDb.GetSingleAsync(whereExpression); //await Db.Queryable<T>().FirstAsync(whereExpression);
}
/// <summary>
/// 根据lambda获取单个对象
/// </summary>
/// <param name="whereExpression"></param>
/// <returns></returns>
public virtual T GetFirst(Expression<Func<T, bool>> whereExpression)
{
return GetDB().Queryable<T>().First(whereExpression);
}
/// <summary>
/// 根据lambda获取单个对象 --异步
/// </summary>
/// <param name="whereExpression"></param>
/// <returns></returns>
public virtual async Task<T> GetFirstAsync(Expression<Func<T, bool>> whereExpression)
{
return await GetDB().Queryable<T>().FirstAsync(whereExpression);
}
/// <summary>
/// 实体插入
/// </summary>
/// <param name="obj"></param>
/// <returns></returns>
public virtual bool Insert(T obj)
{
return CurrentDb.Insert(obj);
}
/// <summary>
/// 实体插入-异步
/// </summary>
/// <param name="obj"></param>
/// <returns></returns>
public virtual async Task<bool> InsertAsync(T obj)
{
return await CurrentDb.InsertAsync(obj);
}
/// <summary>
/// 批量插入
/// </summary>
/// <param name="objs"></param>
/// <returns></returns>
public virtual bool InsertRange(List<T> objs)
{
return CurrentDb.InsertRange(objs);
}
/// <summary>
/// 批量插入-异步
/// </summary>
/// <param name="objs"></param>
/// <returns></returns>
public virtual async Task<bool> InsertRangeAsync(List<T> objs)
{
return await CurrentDb.InsertRangeAsync(objs);
}
/// <summary>
/// 插入返回自增列
/// </summary>
/// <param name="obj"></param>
/// <returns></returns>
public virtual int InsertReturnIdentity(T obj)
{
return CurrentDb.InsertReturnIdentity(obj);
}
/// <summary>
/// 插入返回自增列-异步
/// </summary>
/// <param name="obj"></param>
/// <returns></returns>
public virtual async Task<int> InsertReturnIdentityAsync(T obj)
{
return await CurrentDb.InsertReturnIdentityAsync(obj);
}
/// <summary>
/// 插入返回longid
/// </summary>
/// <param name="obj"></param>
/// <returns></returns>
public virtual long InsertReturnBigIdentity(T obj)
{
return CurrentDb.InsertReturnBigIdentity(obj);
}
/// <summary>
/// 插入返回longid-异步
/// </summary>
/// <param name="obj"></param>
/// <returns></returns>
public virtual async Task<long> InsertReturnBigIdentityAsync(T obj)
{
return await CurrentDb.InsertReturnBigIdentityAsync(obj);
}
/// <summary>
/// 批量删除
/// </summary>
/// <param name="ids"></param>
/// <returns></returns>
public virtual bool DeleteByIds(dynamic[] ids)
{
return CurrentDb.DeleteByIds(ids);
}
/// <summary>
/// 批量删除-异步
/// </summary>
/// <param name="ids"></param>
/// <returns></returns>
public virtual async Task<bool> DeleteByIdsAsync(dynamic[] ids)
{
return await CurrentDb.DeleteByIdsAsync(ids);
}
/// <summary>
/// 根据主键删除
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
public virtual bool Delete(dynamic id)
{
return CurrentDb.DeleteById(id);
}
/// <summary>
/// 根据主键删除-异步
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
public virtual async Task<bool> DeleteAsync(dynamic id)
{
return await CurrentDb.DeleteByIdAsync(id);
}
/// <summary>
/// 根据实体删除
/// </summary>
/// <param name="obj"></param>
/// <returns></returns>
public virtual bool Delete(T obj)
{
return CurrentDb.Delete(obj);
}
/// <summary>
/// 根据实体删除-异步
/// </summary>
/// <param name="obj"></param>
/// <returns></returns>
public virtual async Task<bool> DeleteAsync(T obj)
{
return await CurrentDb.DeleteAsync(obj);
}
/// <summary>
/// 根据表达式删除
/// </summary>
/// <param name="whereExpression"></param>
/// <returns></returns>
public virtual bool Delete(Expression<Func<T, bool>> whereExpression)
{
return CurrentDb.Delete(whereExpression);
}
/// <summary>
/// 根据表达式删除-异步
/// </summary>
/// <param name="whereExpression"></param>
/// <returns></returns>
public virtual async Task<bool> DeleteAsync(Expression<Func<T, bool>> whereExpression)
{
return await CurrentDb.DeleteAsync(whereExpression);
}
/// <summary>
/// 更新
/// </summary>
/// <param name="obj"></param>
/// <returns></returns>
public virtual bool Update(T obj)
{
return CurrentDb.Update(obj);
}
/// <summary>
/// 更新-异步
/// </summary>
/// <param name="obj"></param>
/// <returns></returns>
public virtual async Task<bool> UpdateAsync(T obj)
{
return await CurrentDb.UpdateAsync(obj);
}
/// <summary>
/// 批量更新
/// </summary>
/// <param name="objs"></param>
/// <returns></returns>
public virtual bool UpdateRange(List<T> objs)
{
return CurrentDb.UpdateRange(objs);
}
/// <summary>
/// 新增或修改
/// </summary>
/// <param name="obj"></param>
/// <returns></returns>
public virtual bool InsertOrUpdate(T obj)
{
return CurrentDb.InsertOrUpdate(obj);
}
/// <summary>
/// 新增或修改-异步
/// </summary>
/// <param name="obj"></param>
/// <returns></returns>
public virtual async Task<bool> InsertOrUpdateAsync(T obj)
{
return await CurrentDb.InsertOrUpdateAsync(obj);
}
/// <summary>
/// 批量更新-异步
/// </summary>
/// <param name="objs"></param>
/// <returns></returns>
public virtual async Task<bool> UpdateRangeAsync(List<T> objs)
{
return await CurrentDb.UpdateRangeAsync(objs);
}
/// <summary>
/// 是否包含元素
/// </summary>
/// <param name="whereExpression"></param>
/// <returns></returns>
public virtual bool IsAny(Expression<Func<T, bool>> whereExpression)
{
return CurrentDb.IsAny(whereExpression);
}
/// <summary>
/// 是否包含元素-异步
/// </summary>
/// <param name="whereExpression"></param>
/// <returns></returns>
public virtual async Task<bool> IsAnyAsync(Expression<Func<T, bool>> whereExpression)
{
return await CurrentDb.IsAnyAsync(whereExpression);
}
#endregion 通用方法
}
}
================================================
FILE: src/GraphRag.Net/Repositories/Base/SqlSugarHelper.cs
================================================
using GraphRag.Net.Options;
using SqlSugar;
using System.Reflection;
namespace GraphRag.Net.Base
{
public class SqlSugarHelper()
{
/// <summary>
/// sqlserver连接
/// </summary>
public static SqlSugarScope SqlScope()
{
string DBType = GraphDBConnectionOption.DbType;
string ConnectionString = GraphDBConnectionOption.DBConnection;
var config = new ConnectionConfig()
{
ConnectionString = ConnectionString,
InitKeyType = InitKeyType.Attribute,//从特性读取主键和自增列信息
IsAutoCloseConnection = true,
ConfigureExternalServices = new ConfigureExternalServices
{
//注意: 这儿AOP设置不能少
EntityService = (c, p) =>
{
/***高版C#写法***/
//支持string?和string
if (p.IsPrimarykey == false && new NullabilityInfoContext()
.Create(c).WriteState is NullabilityState.Nullable)
{
p.IsNullable = true;
}
}
}
};
DbType dbType = (DbType)Enum.Parse(typeof(DbType), DBType);
config.DbType = dbType;
var scope = new SqlSugarScope(config, Db =>
{
});
return scope;
}
}
}
================================================
FILE: src/GraphRag.Net/Repositories/Graph/CommunitieNodes/CommunitieNodes.cs
================================================
using SqlSugar;
namespace GraphRag.Net.Repositories
{
/// <summary>
/// 社区与节点关系
/// </summary>
[SugarTable("CommunitieNodes")]
[SugarIndex("i_communitienodes_index", nameof(CommunitieNodes.Index), OrderByType.Asc)]
[SugarIndex("i_communitienodes_communitieid", nameof(CommunitieNodes.CommunitieId), OrderByType.Asc)]
[SugarIndex("i_communitienodes_nodeid", nameof(CommunitieNodes.NodeId), OrderByType.Asc)]
public class CommunitieNodes
{
/// <summary>
/// 索引信息
/// </summary>
public string Index { get; set; }
/// <summary>
/// 社区关键节点ID
/// </summary>
public string CommunitieId { get; set; }
/// <summary>
/// 节点ID
/// </summary>
public string NodeId { get; set; }
}
}
================================================
FILE: src/GraphRag.Net/Repositories/Graph/CommunitieNodes/CommunitieNodes_Repositories.cs
================================================
using GraphRag.Net.Base;
using Microsoft.Extensions.DependencyInjection;
namespace GraphRag.Net.Repositories
{
[ServiceDescription(typeof(ICommunitieNodes_Repositories), ServiceLifetime.Scoped)]
public class CommunitieNodes_Repositories : Repository<CommunitieNodes>, ICommunitieNodes_Repositories
{
}
}
================================================
FILE: src/GraphRag.Net/Repositories/Graph/CommunitieNodes/ICommunitieNodes_Repositories.cs
================================================
using GraphRag.Net.Base;
namespace GraphRag.Net.Repositories
{
public interface ICommunitieNodes_Repositories : IRepository<CommunitieNodes>
{
}
}
================================================
FILE: src/GraphRag.Net/Repositories/Graph/Communities/Communities.cs
================================================
using SqlSugar;
namespace GraphRag.Net.Repositories
{
/// <summary>
/// 社区
/// </summary>
[SugarTable("Communities")]
[SugarIndex("i_communities_index", nameof(Communities.Index), OrderByType.Asc)]
public class Communities
{
/// <summary>
/// 社区ID
/// </summary>
[SugarColumn(IsPrimaryKey = true)]
public string CommunitieId { get; set; }
/// <summary>
/// 索引信息
/// </summary>
public string Index { get; set; }
/// <summary>
/// 社区摘要
/// </summary>
[SugarColumn(ColumnDataType = "varchar(4000)")]
public string Summaries { get; set; }
}
}
================================================
FILE: src/GraphRag.Net/Repositories/Graph/Communities/Communities_Repositories.cs
================================================
using GraphRag.Net.Base;
using Microsoft.Extensions.DependencyInjection;
namespace GraphRag.Net.Repositories
{
[ServiceDescription(typeof(ICommunities_Repositories), ServiceLifetime.Scoped)]
public class Communities_Repositories : Repository<Communities>, ICommunities_Repositories
{
}
}
================================================
FILE: src/GraphRag.Net/Repositories/Graph/Communities/ICommunities_Repositories.cs
================================================
using GraphRag.Net.Base;
namespace GraphRag.Net.Repositories
{
public interface ICommunities_Repositories : IRepository<Communities>
{
}
}
================================================
FILE: src/GraphRag.Net/Repositories/Graph/Edges/Edges.cs
================================================
using SqlSugar;
namespace GraphRag.Net.Repositories
{
/// <summary>
/// 边
/// </summary>
[SugarTable("Edges")]
[SugarIndex("i_edges_index", nameof(Edges.Index), OrderByType.Asc)]
[SugarIndex("i_edges_source", nameof(Edges.Source), OrderByType.Asc)]
[SugarIndex("i_edges_target", nameof(Edges.Target), OrderByType.Asc)]
public class Edges
{
/// <summary>
/// 主键
/// </summary>
[SugarColumn(IsPrimaryKey = true)]
public string Id { get; set; }
/// <summary>
/// 索引
/// </summary>
public string Index { get; set; }
/// <summary>
/// 源ID
/// </summary>
public string Source { get; set; }
/// <summary>
/// 目标ID
/// </summary>
public string Target { get; set; }
/// <summary>
/// 关系信息
/// </summary>
[SugarColumn(ColumnDataType = "varchar(2000)")]
public string Relationship { get; set; }
}
}
================================================
FILE: src/GraphRag.Net/Repositories/Graph/Edges/Edges_Repositories.cs
================================================
using GraphRag.Net.Base;
using Microsoft.Extensions.DependencyInjection;
namespace GraphRag.Net.Repositories
{
[ServiceDescription(typeof(IEdges_Repositories), ServiceLifetime.Scoped)]
public class Edges_Repositories : Repository<Edges>, IEdges_Repositories
{
}
}
================================================
FILE: src/GraphRag.Net/Repositories/Graph/Edges/IEdges_Repositories.cs
================================================
using GraphRag.Net.Base;
namespace GraphRag.Net.Repositories
{
public interface IEdges_Repositories : IRepository<Edges>
{
}
}
================================================
FILE: src/GraphRag.Net/Repositories/Graph/Global/Globals.cs
================================================
using SqlSugar;
namespace GraphRag.Net.Repositories
{
/// <summary>
/// 社区
/// </summary>
[SugarTable("Globals")]
[SugarIndex("i_global_index", nameof(Globals.Index), OrderByType.Asc)]
public class Globals
{
/// <summary>
/// 索引信息
/// </summary>
public string Index { get; set; }
/// <summary>
/// 全局摘要
/// </summary>
[SugarColumn(ColumnDataType = "varchar(4000)")]
public string Summaries { get; set; }
}
}
================================================
FILE: src/GraphRag.Net/Repositories/Graph/Global/Globals_Repositories.cs
================================================
using GraphRag.Net.Base;
using Microsoft.Extensions.DependencyInjection;
namespace GraphRag.Net.Repositories
{
[ServiceDescription(typeof(IGlobals_Repositories), ServiceLifetime.Scoped)]
public class Globals_Repositories : Repository<Globals>, IGlobals_Repositories
{
}
}
================================================
FILE: src/GraphRag.Net/Repositories/Graph/Global/IGlobals_Repositories.cs
================================================
using GraphRag.Net.Base;
namespace GraphRag.Net.Repositories
{
public interface IGlobals_Repositories : IRepository<Globals>
{
}
}
================================================
FILE: src/GraphRag.Net/Repositories/Graph/Nodes/INodes_Repositories.cs
================================================
using GraphRag.Net.Base;
namespace GraphRag.Net.Repositories
{
public interface INodes_Repositories : IRepository<Nodes>
{
}
}
================================================
FILE: src/GraphRag.Net/Repositories/Graph/Nodes/Nodes.cs
================================================
using SqlSugar;
namespace GraphRag.Net.Repositories
{
/// <summary>
/// 节点
/// </summary>
[SugarTable("Nodes")]
[SugarIndex("i_nodes_index", nameof(Nodes.Index), OrderByType.Asc)]
public class Nodes
{
/// <summary>
/// 主键
/// </summary>
[SugarColumn(IsPrimaryKey = true)]
public string Id { get; set; }
/// <summary>
/// 索引
/// </summary>
public string Index { get; set; }
/// <summary>
/// 名称
/// </summary>
public string Name { get; set; }
/// <summary>
/// 类型
/// </summary>
public string Type { get; set; }
/// <summary>
/// 节点描述
/// </summary>
[SugarColumn(ColumnDataType = "varchar(2000)")]
public string? Desc { get; set; }
}
}
================================================
FILE: src/GraphRag.Net/Repositories/Graph/Nodes/Nodes_Repositories.cs
================================================
using GraphRag.Net.Base;
using Microsoft.Extensions.DependencyInjection;
namespace GraphRag.Net.Repositories
{
[ServiceDescription(typeof(INodes_Repositories), ServiceLifetime.Scoped)]
public class Nodes_Repositories : Repository<Nodes>, INodes_Repositories
{
}
}
================================================
FILE: src/GraphRag.Net/Utils/ConvertUtils.cs
================================================
using Newtonsoft.Json;
using System.ComponentModel;
using System.Reflection;
using System.Text.RegularExpressions;
using System.Web;
namespace GraphRag.Net.Utils
{
internal static class ConvertUtils
{
/// <summary>
/// 判断是否为空,为空返回true
/// </summary>
/// <param name="data"></param>
/// <returns></returns>
public static bool IsNull(this object data)
{
//如果为null
if (data == null)
{
return true;
}
//如果为""
if (data.GetType() == typeof(String))
{
if (string.IsNullOrEmpty(data.ToString().Trim()))
{
return true;
}
}
return false;
}
/// <summary>
/// 判断是否为空,为空返回true
/// </summary>
/// <param name="data"></param>
/// <returns></returns>
public static bool IsNotNull(this object data)
{
//如果为null
if (data == null)
{
return false;
}
//如果为""
if (data.GetType() == typeof(String))
{
if (string.IsNullOrEmpty(data.ToString().Trim()))
{
return false;
}
}
return true;
}
/// <summary>
/// 判断是否为空,为空返回true
/// </summary>
/// <param name="data"></param>
/// <returns></returns>
public static bool IsNull(string data)
{
//如果为null
if (data == null)
{
return true;
}
//如果为""
if (data.GetType() == typeof(String))
{
if (string.IsNullOrEmpty(data.ToString().Trim()))
{
return true;
}
}
return false;
}
/// <summary>
/// 将obj类型转换为string
/// </summary>
/// <param name="s"></param>
/// <returns></returns>
public static string ConvertToString(this object s)
{
if (s == null)
{
return "";
}
else
{
return Convert.ToString(s);
}
}
/// <summary>
/// object 转int32
/// </summary>
/// <param name="s"></param>
/// <returns></returns>
public static Int32 ConvertToInt32(this object s)
{
int i = 0;
if (s == null)
{
return 0;
}
else
{
int.TryParse(s.ToString(), out i);
}
return i;
}
/// <summary>
/// object 转int32
/// </summary>
/// <param name="s"></param>
/// <returns></returns>
public static Int64 ConvertToInt64(this object s)
{
long i = 0;
if (s == null)
{
return 0;
}
else
{
long.TryParse(s.ToString(), out i);
}
return i;
}
/// <summary>
/// 将字符串转double
/// </summary>
/// <param name="s"></param>
/// <returns></returns>
public static double ConvertToDouble(this object s)
{
double i = 0;
if (s == null)
{
return 0;
}
else
{
double.TryParse(s.ToString(), out i);
}
return i;
}
/// <summary>
/// 转换为datetime类型
/// </summary>
/// <param name="s"></param>
/// <returns></returns>
public static DateTime ConvertToDateTime(this string s)
{
DateTime dt = new DateTime();
if (s == null || s == "")
{
return DateTime.Now;
}
DateTime.TryParse(s, out dt);
return dt;
}
/// <summary>
/// 转换为datetime类型的格式字符串
/// </summary>
/// <param name="s">要转换的对象</param>
/// <param name="y">格式化字符串</param>
/// <returns></returns>
public static string ConvertToDateTime(this string s, string y)
{
DateTime dt = new DateTime();
DateTime.TryParse(s, out dt);
return dt.ToString(y);
}
/// <summary>
/// 将字符串转换成decimal
/// </summary>
/// <param name="s"></param>
/// <returns></returns>
public static decimal ConvertToDecimal(this object s)
{
decimal d = 0;
if (s == null || s == "")
{
return 0;
}
Decimal.TryParse(s.ToString(), out d);
return d;
}
/// <summary>
/// decimal保留2位小数
/// </summary>
public static decimal DecimalFraction(this decimal num)
{
return Convert.ToDecimal(num.ToString("f2"));
}
/// <summary>
/// 替换html种的特殊字符
/// </summary>
/// <param name="s"></param>
/// <returns></returns>
public static string ReplaceHtml(this string s)
{
return s.Replace("<", "<").Replace(">", ">").Replace("&", "&").Replace(""", "\"");
}
/// <summary>
/// 流转byte
/// </summary>
/// <param name="stream"></param>
/// <returns></returns>
public static byte[] StreamToByte(this Stream stream)
{
byte[] bytes = new byte[stream.Length];
stream.Read(bytes, 0, bytes.Length);
// 设置当前流的位置为流的开始
stream.Seek(0, SeekOrigin.Begin);
return bytes;
}
public static string JsonToMarkDown(this string s)
{
return $"{Environment.NewLine}```json{Environment.NewLine}{s}{Environment.NewLine}```{Environment.NewLine}";
}
/// <summary>
/// json参数转化querystring参数
/// </summary>
/// <param name="parameters"></param>
/// <returns></returns>
public static string ToQueryString(this Dictionary<string, string> parameters)
{
var nameValueCollection = HttpUtility.ParseQueryString(string.Empty);
foreach (var param in parameters)
{
nameValueCollection[param.Key] = param.Value;
}
return nameValueCollection.ToString();
}
/// <summary>
/// 忽略大小写匹配
/// </summary>
/// <param name="s"></param>
/// <param name="value"></param>
/// <returns></returns>
public static bool ComparisonIgnoreCase(this string s, string value)
{
return s.Equals(value, StringComparison.OrdinalIgnoreCase);
}
public static string GetDescription(this Enum value)
{
FieldInfo field = value.GetType().GetField(value.ToString());
if (field != null)
{
DescriptionAttribute attribute = (DescriptionAttribute)field.GetCustomAttribute(typeof(DescriptionAttribute));
if (attribute != null)
{
return attribute.Description;
}
}
return value.ToString();
}
/// <summary>
/// 是否为流式请求
/// </summary>
/// <param name="value"></param>
/// <returns></returns>
public static bool IsStream(this string value)
{
// 正则表达式忽略空格的情况
string pattern = @"\s*""stream""\s*:\s*true\s*";
// 使用正则表达式匹配
bool contains = Regex.IsMatch(value, pattern);
return contains;
}
/// <summary>
/// \uxxxx转中文,保留换行符号
/// </summary>
/// <param name="unicodeString"></param>
/// <returns></returns>
public static string Unescape(this string value)
{
if (value.IsNull())
{
return "";
}
try
{
Formatting formatting = Formatting.None;
object jsonObj = JsonConvert.DeserializeObject(value);
string unescapeValue = JsonConvert.SerializeObject(jsonObj, formatting);
return unescapeValue;
}
catch (Exception ex)
{
Console.WriteLine(ex.ToString());
return "";
}
}
}
}
================================================
FILE: src/GraphRag.Net/Utils/OpenAIHttpClientHandler.cs
================================================
using GraphRag.Net.Options;
using System.Text;
using System.Text.RegularExpressions;
namespace GraphRag.Net.Utils
{
internal class OpenAIHttpClientHandler : HttpClientHandler
{
protected override async Task<HttpResponseMessage> SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
{
UriBuilder uriBuilder;
Regex regex = new Regex(@"(https?)://([^/:]+)(:\d+)?/(.*)");
Match match = regex.Match(GraphOpenAIOption.EndPoint);
var mediaType = request.Content.Headers.ContentType.MediaType;
string requestBody = (await request.Content.ReadAsStringAsync()).Unescape();
var uncaseBody = new StringContent(requestBody, Encoding.UTF8, mediaType);
request.Content = uncaseBody;
if (Environment.GetEnvironmentVariable("ASPNETCORE_ENVIRONMENT") == "Development" && request.Content != null)
{
//便于调试查看请求prompt
Console.WriteLine(requestBody);
}
if (match.Success)
{
string xieyi = match.Groups[1].Value;
string host = match.Groups[2].Value;
string port = match.Groups[3].Value; // 可选的端口号
string route = match.Groups[4].Value;
// 如果port不为空,它将包含冒号,所以你可能需要去除它
port = string.IsNullOrEmpty(port) ? port : port.Substring(1);
// 拼接host和端口号
var hostnew = string.IsNullOrEmpty(port) ? host : $"{host}:{port}";
switch (request.RequestUri.LocalPath)
{
case "/v1/chat/completions":
//替换代理
uriBuilder = new UriBuilder(request.RequestUri)
{
// 这里是你要修改的 URL
Scheme = $"{xieyi}://{hostnew}/",
Host = host,
Path = route + "v1/chat/completions",
};
if (port.ConvertToInt32() != 0)
{
uriBuilder.Port = port.ConvertToInt32();
}
request.RequestUri = uriBuilder.Uri;
break;
case "/v1/embeddings":
uriBuilder = new UriBuilder(request.RequestUri)
{
// 这里是你要修改的 URL
Scheme = $"{xieyi}://{host}/",
Host = host,
Path = route + "v1/embeddings",
};
if (port.ConvertToInt32() != 0)
{
uriBuilder.Port = port.ConvertToInt32();
}
request.RequestUri = uriBuilder.Uri;
break;
}
}
// 接着,调用基类的 SendAsync 方法将你的修改后的请求发出去
HttpResponseMessage response = await base.SendAsync(request, cancellationToken);
return response;
}
}
}
================================================
FILE: src/GraphRag.Net/Utils/RepoUtils/AppException.cs
================================================
// Copyright (c) Microsoft. All rights reserved.
namespace GraphRag.Net.Utils;
internal class AppException : Exception
{
public AppException() : base()
{
}
public AppException(string message) : base(message)
{
}
public AppException(string message, Exception innerException) : base(message, innerException)
{
}
}
================================================
FILE: src/GraphRag.Net/Utils/RepoUtils/ObjectExtensions.cs
================================================
using System.Text.Json;
namespace GraphRag.Net.Utils
{
internal static class ObjectExtensions
{
private static readonly JsonSerializerOptions s_jsonOptionsCache = new() { WriteIndented = true };
public static string AsJson(this object obj)
{
return JsonSerializer.Serialize(obj, s_jsonOptionsCache);
}
}
}
================================================
FILE: src/GraphRag.Net/Utils/RepoUtils/RepoFiles.cs
================================================
// Copyright (c) Microsoft. All rights reserved.
using System.Reflection;
namespace GraphRag.Net.Utils;
internal static class RepoFiles
{
/// <summary>
/// Scan the local folders from the repo, looking for "samples/plugins" folder.
/// </summary>
/// <returns>The full path to samples/plugins</returns>
public static string SamplePluginsPath()
{
string baseDirectory = AppDomain.CurrentDomain.BaseDirectory;
string folderName = "graphPlugins";
string FindPluginsDirectory(string startDir, string targetFolder)
{
string currDir = Path.GetFullPath(startDir);
const int maxAttempts = 10;
for (int i = 0; i < maxAttempts; i++)
{
string potentialPath = Path.Combine(currDir, targetFolder);
if (Directory.Exists(potentialPath))
{
return potentialPath;
}
currDir = Path.GetFullPath(Path.Combine(currDir, ".."));
}
return null; // Not found after max attempts.
}
// Check in the BaseDirectory and its parent directories
string path = FindPluginsDirectory(baseDirectory, folderName)
?? FindPluginsDirectory(baseDirectory + Path.DirectorySeparatorChar + folderName, folderName);
if (string.IsNullOrEmpty(path))
{
throw new AppException("Plugins directory not found. The app needs the plugins from the repo to work.");
}
return path;
}
}
================================================
FILE: src/GraphRag.Net.Web/.config/dotnet-tools.json
================================================
{
"version": 1,
"isRoot": true,
"tools": {
"dotnet-ef": {
"version": "8.0.8",
"commands": [
"dotnet-ef"
],
"rollForward": false
}
}
}
================================================
FILE: src/GraphRag.Net.Web/App.razor
================================================
<Router AppAssembly="@typeof(Program).Assembly">
<Found Context="routeData">
<CascadingValue Value="routeData">
<RouteView RouteData="@routeData" DefaultLayout="@typeof(BasicLayout)" />
</CascadingValue>
</Found>
<NotFound>
<LayoutView Layout="@typeof(BasicLayout)">
<p>Sorry, there's nothing at this address.</p>
</LayoutView>
</NotFound>
</Router>
<AntContainer />
================================================
FILE: src/GraphRag.Net.Web/Components/GlobalHeader/RightContent.razor
================================================
@namespace GraphRag.Net.Web.Components
@inherits AntDomComponentBase
<Space Class="@ClassMapper.Class" Size="@("26")">
<button class="github_btn" onclick="window.open('https://github.com/AIDotNet/GraphRag.Net')"></button>
</Space>
<style>
.github_btn {
cursor: pointer;
border: none;
background-image: url('http://img.shields.io/github/stars/aidotnet/graphrag.net?style=social');
width: 88px;
height: 20px;
}
</style>
================================================
FILE: src/GraphRag.Net.Web/Components/GlobalHeader/RightContent.razor.cs
================================================
using AntDesign;
using AntDesign.ProLayout;
using GraphRag.Net.Web.Models;
using Microsoft.AspNetCore.Components;
namespace GraphRag.Net.Web.Components
{
public partial class RightContent
{
private CurrentUser _currentUser = new CurrentUser();
private NoticeIconData[] _notifications = { };
private NoticeIconData[] _messages = { };
private NoticeIconData[] _events = { };
private int _count = 0;
private List<AutoCompleteDataItem<string>> DefaultOptions { get; set; } = new List<AutoCompleteDataItem<string>>
{
new AutoCompleteDataItem<string>
{
Label = "umi ui",
Value = "umi ui"
},
new AutoCompleteDataItem<string>
{
Label = "Pro Table",
Value = "Pro Table"
},
new AutoCompleteDataItem<string>
{
Label = "Pro Layout",
Value = "Pro Layout"
}
};
public AvatarMenuItem[] AvatarMenuItems { get; set; } = new AvatarMenuItem[]
{
new() { Key = "center", IconType = "user", Option = "个人中心"},
new() { Key = "setting", IconType = "setting", Option = "个人设置"},
new() { IsDivider = true },
new() { Key = "logout", IconType = "logout", Option = "退出登录"}
};
[Inject] protected NavigationManager NavigationManager { get; set; }
[Inject] protected MessageService MessageService { get; set; }
protected override async Task OnInitializedAsync()
{
await base.OnInitializedAsync();
SetClassMap();
}
protected void SetClassMap()
{
ClassMapper
.Clear()
.Add("right");
}
public void HandleSelectUser(MenuItem item)
{
switch (item.Key)
{
case "center":
NavigationManager.NavigateTo("/account/center");
break;
case "setting":
NavigationManager.NavigateTo("/account/settings");
break;
case "logout":
NavigationManager.NavigateTo("/user/login");
break;
}
}
public void HandleSelectLang(MenuItem item)
{
}
public async Task HandleClear(string key)
{
switch (key)
{
case "notification":
_notifications = new NoticeIconData[] { };
break;
case "message":
_messages = new NoticeIconData[] { };
break;
case "event":
_events = new NoticeIconData[] { };
break;
}
await MessageService.Success($"清空了{key}");
}
public async Task HandleViewMore(string key)
{
await MessageService.Info("Click on view more");
}
}
}
================================================
FILE: src/GraphRag.Net.Web/Controllers/GraphController.cs
================================================
using GraphRag.Net.Domain.Interface;
using GraphRag.Net.Domain.Model.Graph;
using Microsoft.AspNetCore.Mvc;
namespace GraphRag.Net.Api.Controllers
{
[Route("api/[controller]/[action]")]
[ApiController]
public class GraphController(IGraphService _graphService) : ControllerBase
{
/// <summary>
/// 获取所有的索引数据
/// </summary>
/// <returns></returns>
[HttpGet]
public async Task<IActionResult> GetAllIndex()
{
var graphModel = _graphService.GetAllIndex();
return Ok(graphModel);
}
/// <summary>
/// 获取所有的图谱数据
/// </summary>
/// <param name="index"></param>
/// <returns></returns>
[HttpGet]
public async Task<IActionResult> GetAllGraphs(string index)
{
if (string.IsNullOrEmpty(index))
{
return Ok(new GraphViewModel());
}
var graphModel = _graphService.GetAllGraphs(index);
return Ok(graphModel);
}
/// <summary>
/// 插入文本数据
/// </summary>
/// <param name="model"></param>
/// <returns></returns>
[HttpPost]
public async Task<IActionResult> InsertGraphData(InputModel model)
{
await _graphService.InsertGraphDataAsync(model.Index, model.Input);
return Ok();
}
/// <summary>
/// 搜索递归获取节点相关的所有边和节点进行图谱对话
/// </summary>
/// <param name="model"></param>
/// <returns></returns>
[HttpPost]
public async Task<IActionResult> SearchGraph(InputModel model)
{
var result = await _graphService.SearchGraphAsync(model.Index, model.Input);
return Ok(result);
}
/// <summary>
/// 通过社区算法检索社区节点进行对话
/// </summary>
/// <param name="model"></param>
/// <returns></returns>
[HttpPost]
public async Task<IActionResult> SearchGraphCommunity(InputModel model)
{
var result = await _graphService.SearchGraphCommunityAsync(model.Index, model.Input);
return Ok(result);
}
/// <summary>
/// 导入txt文档
/// </summary>
/// <param name="index"></param>
/// <param name="file"></param>
/// <returns></returns>
[HttpPost]
public async Task<IActionResult> ImportTxt(string index,IFormFile file)
{
var forms = await Request.ReadFormAsync();
using (var stream = new StreamReader(file.OpenReadStream()))
{
var txt = await stream.ReadToEndAsync();
await _graphService.InsertTextChunkAsync(index,txt);
return Ok();
}
}
/// <summary>
/// 通过社区检测生成社区和摘要
/// </summary>
/// <param name="index"></param>
/// <returns></returns>
[HttpGet]
public async Task<IActionResult> GraphCommunities(string index)
{
await _graphService.GraphCommunitiesAsync(index);
return Ok();
}
/// <summary>
/// 通过社区摘要生成全局摘要
/// </summary>
/// <param name="index"></param>
/// <returns></returns>
[HttpGet]
public async Task<IActionResult> GraphGlobal(string index)
{
await _graphService.GraphGlobalAsync(index);
return Ok();
}
/// <summary>
/// 删除图谱数据
/// </summary>
/// <param name="index"></param>
/// <returns></returns>
[HttpGet]
public async Task<IActionResult> DeleteGraph(string index)
{
await _graphService.DeleteGraph(index);
return Ok();
}
}
public class InputModel
{
public string Index { get; set; }
public string Input { get; set; }
}
}
================================================
FILE: src/GraphRag.Net.Web/Extensions/DateTimeExtension.cs
================================================
namespace GraphRag.Net.Web
{
public static class DateTimeExtension
{
private const int Second = 1;
private const int Minute = 60 * Second;
private const int Hour = 60 * Minute;
private const int Day = 24 * Hour;
private const int Month = 30 * Day;
// todo: Need to be localized
public static string ToFriendlyDisplay(this DateTime dateTime)
{
var ts = DateTime.Now - dateTime;
var delta = ts.TotalSeconds;
if (delta < 0)
{
return "not yet";
}
if (delta < 1 * Minute)
{
return ts.Seconds == 1 ? "1 second ago" : ts.Seconds + " seconds ago";
}
if (delta < 2 * Minute)
{
return "1 minute ago";
}
if (delta < 45 * Minute)
{
return ts.Minutes + "minute";
}
if (delta < 90 * Minute)
{
return "1 hour ago";
}
if (delta < 24 * Hour)
{
return ts.Hours + " hours ago";
}
if (delta < 48 * Hour)
{
return "yesterday";
}
if (delta < 30 * Day)
{
return ts.Days + " days ago";
}
if (delta < 12 * Month)
{
var months = Convert.ToInt32(Math.Floor((double)ts.Days / 30));
return months <= 1 ? "A month ago" : months + " months ago";
}
else
{
var years = Convert.ToInt32(Math.Floor((double)ts.Days / 365));
return years <= 1 ? "a year ago" : years + " years ago";
}
}
}
}
================================================
FILE: src/GraphRag.Net.Web/GraphRag.Net.Web.csproj
================================================
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFrameworks>net6.0;net7.0;net8.0</TargetFrameworks>
<LangVersion>latest</LangVersion>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<Authors>许泽宇</Authors>
<Product>GraphRag.Net</Product>
<Company>xuzeyu</Company>
<Description>商务需求联系微信xuzeyu91</Description>
<GenerateDocumentationFile>True</GenerateDocumentationFile>
<DocumentationFile>GraphRag.Net.Web.xml</DocumentationFile>
<NoWarn>CA1050,CA1707,CA2007,VSTHRD111,CS1591,RCS1110,CA5394,SKEXP0001,SKEXP0002,SKEXP0003,SKEXP0004,SKEXP0010,SKEXP0011,,SKEXP0012,SKEXP0020,SKEXP0021,SKEXP0022,SKEXP0023,SKEXP0024,SKEXP0025,SKEXP0026,SKEXP0027,SKEXP0028,SKEXP0029,SKEXP0030,SKEXP0031,SKEXP0032,SKEXP0040,SKEXP0041,SKEXP0042,SKEXP0050,SKEXP0051,SKEXP0052,SKEXP0053,SKEXP0054,SKEXP0055,SKEXP0060,SKEXP0061,SKEXP0101,SKEXP0102,KMEXP01</NoWarn>
</PropertyGroup>
<ItemGroup>
<Content Remove="graphPlugins\graph\community_search\config.json" />
<Content Remove="graphPlugins\graph\community_summaries\config.json" />
<Content Remove="graphPlugins\graph\create\config.json" />
<Content Remove="graphPlugins\graph\global_summaries\config.json" />
<Content Remove="graphPlugins\graph\mergedesc\config.json" />
<Content Remove="graphPlugins\graph\relationship\config.json" />
<Content Remove="graphPlugins\graph\search\config.json" />
</ItemGroup>
<ItemGroup>
<None Include="graphPlugins\**">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>
<ItemGroup>
<PackageReference Include="AntDesign.Charts" Version="0.5.6" />
<PackageReference Include="AntDesign.ProLayout" Version="1.0.1" />
<PackageReference Include="Polly" Version="8.5.0" />
<PackageReference Include="SqlSugarCore" Version="5.1.4.171" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="7.2.0" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\GraphRag.Net\GraphRag.Net.csproj" />
</ItemGroup>
<ItemGroup>
<None Update="graphPlugins\graph\community_search\skprompt.txt">
<PackagePath>graphPlugins\</PackagePath>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<Pack>true</Pack>
</None>
<None Update="graphPlugins\graph\community_summaries\skprompt.txt">
<PackagePath>graphPlugins\</PackagePath>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<Pack>true</Pack>
</None>
<None Update="graphPlugins\graph\create\skprompt.txt">
<PackagePath>graphPlugins\</PackagePath>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<Pack>true</Pack>
</None>
<None Update="graphPlugins\graph\global_summaries\skprompt.txt">
<PackagePath>graphPlugins\</PackagePath>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<Pack>true</Pack>
</None>
<None Update="graphPlugins\graph\mergedesc\skprompt.txt">
<PackagePath>graphPlugins\</PackagePath>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<Pack>true</Pack>
</None>
<None Update="graphPlugins\graph\relationship\skprompt.txt">
<PackagePath>graphPlugins\</PackagePath>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<Pack>true</Pack>
</None>
<None Update="graphPlugins\graph\search\skprompt.txt">
<PackagePath>graphPlugins\</PackagePath>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<Pack>true</Pack>
</None>
</ItemGroup>
</Project>
================================================
FILE: src/GraphRag.Net.Web/GraphRag.Net.Web.xml
================================================
<?xml version="1.0"?>
<doc>
<assembly>
<name>GraphRag.Net.Web</name>
</assembly>
<members>
<member name="M:GraphRag.Net.Api.Controllers.GraphController.GetAllIndex">
<summary>
获取所有的索引数据
</summary>
<returns></returns>
</member>
<member name="M:GraphRag.Net.Api.Controllers.GraphController.GetAllGraphs(System.String)">
<summary>
获取所有的图谱数据
</summary>
<param name="index"></param>
<returns></returns>
</member>
<member name="M:GraphRag.Net.Api.Controllers.GraphController.InsertGraphData(GraphRag.Net.Api.Controllers.InputModel)">
<summary>
插入文本数据
</summary>
<param name="model"></param>
<returns></returns>
</member>
<member name="M:GraphRag.Net.Api.Controllers.GraphController.SearchGraph(GraphRag.Net.Api.Controllers.InputModel)">
<summary>
搜索递归获取节点相关的所有边和节点进行图谱对话
</summary>
<param name="model"></param>
<returns></returns>
</member>
<member name="M:GraphRag.Net.Api.Controllers.GraphController.SearchGraphCommunity(GraphRag.Net.Api.Controllers.InputModel)">
<summary>
通过社区算法检索社区节点进行对话
</summary>
<param name="model"></param>
<returns></returns>
</member>
<member name="M:GraphRag.Net.Api.Controllers.GraphController.ImportTxt(System.String,Microsoft.AspNetCore.Http.IFormFile)">
<summary>
导入txt文档
</summary>
<param name="index"></param>
<param name="file"></param>
<returns></returns>
</member>
<member name="M:GraphRag.Net.Api.Controllers.GraphController.GraphCommunities(System.String)">
<summary>
通过社区检测生成社区和摘要
</summary>
<param name="index"></param>
<returns></returns>
</member>
<member name="M:GraphRag.Net.Api.Controllers.GraphController.GraphGlobal(System.String)">
<summary>
通过社区摘要生成全局摘要
</summary>
<param name="index"></param>
<returns></returns>
</member>
<member name="M:GraphRag.Net.Api.Controllers.GraphController.DeleteGraph(System.String)">
<summary>
删除图谱数据
</summary>
<param name="index"></param>
<returns></returns>
</member>
</members>
</doc>
================================================
FILE: src/GraphRag.Net.Web/Layouts/BasicLayout.razor
================================================
@namespace GraphRag.Net.Web
@inherits LayoutComponentBase
<AntDesign.ProLayout.BasicLayout
Logo="@("https://gw.alipayobjects.com/zos/rmsportal/KDpgvguMpGfqaHPjicRK.svg")"
MenuData="_menuData">
<RightContentRender>
<GraphRag.Net.Web.Components.RightContent />
</RightContentRender>
<ChildContent>
@Body
</ChildContent>
<FooterRender>
<FooterView Copyright="2024 许泽宇的技术分享" Links="Links"></FooterView>
</FooterRender>
</AntDesign.ProLayout.BasicLayout>
<SettingDrawer />
@code
{
private MenuDataItem[] _menuData = { };
[Inject] public HttpClient HttpClient { get; set; }
protected override async Task OnInitializedAsync()
{
await base.OnInitializedAsync();
_menuData = await HttpClient.GetFromJsonAsync<MenuDataItem[]>("data/menu.json");
}
public LinkItem[] Links { get; set; } =
{
new LinkItem
{
Key = "GraphRag.Net",
Title = "GraphRag.Net",
Href = "https://github.com/xuzeyu91/GraphRag.Net",
BlankTarget = true,
}
};
}
================================================
FILE: src/GraphRag.Net.Web/Layouts/UserLayout.razor
================================================
@namespace GraphRag.Net.Web
@using OneOf
@inherits LayoutComponentBase
<div class="container__b__0">
<div class="lang">
<!--todo: selectLang-->
</div>
<div class="content">
<div class="top">
<div class="header">
<a>
<img alt="logo" class="logo" src="assets/logo.svg" />
<span class="title">GraphRag.Net.Web</span>
</a>
</div>
<div class="desc">GraphRag.Net.Web</div>
</div>
@Body
</div>
<FooterView Copyright="2024 许泽宇的技术分享" Links="Links"></FooterView>
</div>
@code
{
public LinkItem[] Links { get; set; } =
{
new LinkItem
{
Key = "GraphRag.Net",
Title = "GraphRag.Net",
Href = "https://github.com/xuzeyu91/GraphRag.Net",
BlankTarget = true,
}
};
}
================================================
FILE: src/GraphRag.Net.Web/Layouts/UserLayout.razor.css
================================================
/* stylelint-disable at-rule-empty-line-before,at-rule-name-space-after,at-rule-no-unknown */
/* stylelint-disable no-duplicate-selectors */
/* stylelint-disable */
/* stylelint-disable declaration-bang-space-before,no-duplicate-selectors,string-no-newline */
.container__b__0 {
display: flex;
flex-direction: column;
height: 100vh;
overflow: auto;
background: #f0f2f5;
}
.container__b__0 .lang {
width: 100%;
height: 40px;
line-height: 44px;
text-align: right;
}
.container__b__0 .lang :global(.ant-dropdown-trigger) {
margin-right: 24px;
}
.container__b__0 .content {
flex: 1;
padding: 32px 0;
}
.container__b__0 .top {
text-align: center;
}
.container__b__0 .header {
height: 44px;
line-height: 44px;
}
.container__b__0 .header a {
text-decoration: none;
}
.container__b__0 .logo {
height: 44px;
margin-right: 16px;
vertical-align: top;
}
.container__b__0 .title {
position: relative;
top: 2px;
color: rgba(0, 0, 0, 0.85);
font-weight: 600;
font-size: 33px;
font-family: Avenir, 'Helvetica Neue', Arial, Helvetica, sans-serif;
}
.container__b__0 .desc {
margin-top: 12px;
margin-bottom: 40px;
color: rgba(0, 0, 0, 0.45);
font-size: 14px;
}
@media (min-width: 768px) {
.container__b__0 {
background-image: url('https://gw.alipayobjects.com/zos/rmsportal/TVYTbAXWheQpRcWDaDMu.svg');
background-repeat: no-repeat;
background-position: center 110px;
background-size: 100%;
}
.container__b__0 .content {
padding: 32px 0 24px;
}
}
================================================
FILE: src/GraphRag.Net.Web/Mock/MockChatCompletion.cs
================================================
using Microsoft.SemanticKernel;
using Microsoft.SemanticKernel.ChatCompletion;
using System.Runtime.CompilerServices;
using System.Text;
using System.Text.Encodings.Web;
using System.Text.Json;
using System.Text.Json.Serialization;
using System.Text.Unicode;
namespace GraphRag.Net.Web.Mock
{
public class MockChatCompletion : IChatCompletionService
{
private readonly Dictionary<string, object?> _attributes = new();
private string _chatId;
private static readonly JsonSerializerOptions _jsonSerializerOptions = new()
{
NumberHandling = JsonNumberHandling.AllowReadingFromString,
Encoder = JavaScriptEncoder.Create(UnicodeRanges.All)
};
public IReadOnlyDictionary<string, object?> Attributes => _attributes;
public MockChatCompletion()
{
}
public async Task<IReadOnlyList<ChatMessageContent>> GetChatMessageContentsAsync(ChatHistory chatHistory, PromptExecutionSettings? executionSettings = null, Kernel? kernel = null, [EnumeratorCancellation] CancellationToken cancellationToken = default)
{
StringBuilder sb = new();
string result = $"这是一条Mock数据,便于聊天测试,你的消息是:{chatHistory.LastOrDefault().ToString()}";
return [new(AuthorRole.Assistant, result.ToString())];
}
public async IAsyncEnumerable<StreamingChatMessageContent> GetStreamingChatMessageContentsAsync(ChatHistory chatHistory, PromptExecutionSettings? executionSettings = null, Kernel? kernel = null, [EnumeratorCancellation] CancellationToken cancellationToken = default)
{
StringBuilder sb = new();
string result = $"这是一条Mock数据,便于聊天测试,你的消息是:{chatHistory.LastOrDefault().ToString()}";
foreach (var c in result)
{
yield return new StreamingChatMessageContent(AuthorRole.Assistant, c.ToString());
}
}
}
}
================================================
FILE: src/GraphRag.Net.Web/Mock/MockTextCompletion.cs
================================================
using Microsoft.SemanticKernel;
using Microsoft.SemanticKernel.Services;
using Microsoft.SemanticKernel.TextGeneration;
using System.Text;
using System.Text.Encodings.Web;
using System.Text.Json;
using System.Text.Json.Serialization;
using System.Text.Unicode;
namespace GraphRag.Net.Web.Mock
{
public class MockTextCompletion : ITextGenerationService, IAIService
{
private readonly Dictionary<string, object?> _attributes = new();
private string _chatId;
private static readonly JsonSerializerOptions _jsonSerializerOptions = new()
{
NumberHandling = JsonNumberHandling.AllowReadingFromString,
Encoder = JavaScriptEncoder.Create(UnicodeRanges.All)
};
public IReadOnlyDictionary<string, object?> Attributes => _attributes;
public MockTextCompletion()
{
}
public async Task<IReadOnlyList<TextContent>> GetTextContentsAsync(string prompt, PromptExecutionSettings? executionSettings = null, Kernel? kernel = null, CancellationToken cancellationToken = default)
{
StringBuilder sb = new();
string result = $"这是一条Mock数据,便于聊天测试,你的消息是:{prompt}";
return [new(result.ToString())];
}
public async IAsyncEnumerable<StreamingTextContent> GetStreamingTextContentsAsync(string prompt, PromptExecutionSettings? executionSettings = null, Kernel? kernel = null, CancellationToken cancellationToken = default)
{
StringBuilder sb = new();
string result = $"这是一条Mock数据,便于聊天测试,你的消息是:{prompt}";
foreach (var c in result)
{
var streamingTextContent = new StreamingTextContent(c.ToString(), modelId: "mock");
yield return streamingTextContent;
}
}
}
}
================================================
FILE: src/GraphRag.Net.Web/Mock/MockTextEmbeddingGeneratorService.cs
================================================
using Microsoft.SemanticKernel;
using Microsoft.SemanticKernel.Embeddings;
using Microsoft.SemanticKernel.Services;
namespace GraphRag.Net.Web.Mock
{
public sealed class MockTextEmbeddingGeneratorService : ITextEmbeddingGenerationService
{
private Dictionary<string, object?> AttributesInternal { get; } = [];
public IReadOnlyDictionary<string, object?> Attributes => this.AttributesInternal;
public MockTextEmbeddingGeneratorService()
{
}
public async Task<IList<ReadOnlyMemory<float>>> GenerateEmbeddingsAsync(
IList<string> data,
Kernel? kernel = null,
CancellationToken cancellationToken = default)
{
IList<ReadOnlyMemory<float>> results = new List<ReadOnlyMemory<float>>();
float[] array1 = { 1.0f, 2.0f, 3.0f };
float[] array2 = { 4.0f, 5.0f, 6.0f };
float[] array3 = { 7.0f, 8.0f, 9.0f };
// 将数组包装为ReadOnlyMemory<float>并添加到列表中
results.Add(new ReadOnlyMemory<float>(array1));
results.Add(new ReadOnlyMemory<float>(array2));
results.Add(new ReadOnlyMemory<float>(array3));
return results;
}
public void Dispose()
{
}
}
}
================================================
FILE: src/GraphRag.Net.Web/Models/ActivitiesType.cs
================================================
namespace GraphRag.Net.Web.Models
{
public class ActivitiesType
{
public string Id { get; set; }
public DateTime UpdatedAt { get; set; }
public ActivityUser User { get; set; }
public ActivityGroup Group { get; set; }
public ActivityProject Project { get; set; }
public string Template { get; set; }
}
}
================================================
FILE: src/GraphRag.Net.Web/Models/ActivityGroup.cs
================================================
namespace GraphRag.Net.Web.Models
{
public class ActivityGroup
{
public string Name { get; set; }
public string Link { get; set; }
}
}
================================================
FILE: src/GraphRag.Net.Web/Models/ActivityProject.cs
================================================
namespace GraphRag.Net.Web.Models
{
public class ActivityProject
{
public string Name { get; set; }
public string Link { get; set; }
}
}
================================================
FILE: src/GraphRag.Net.Web/Models/ActivityUser.cs
================================================
namespace GraphRag.Net.Web.Models
{
public class ActivityUser
{
public string Name { get; set; }
public string Avatar { get; set; }
}
}
================================================
FILE: src/GraphRag.Net.Web/Models/AdvancedOperation.cs
================================================
namespace GraphRag.Net.Web.Models
{
public class AdvancedOperation
{
public string Key { get; set; }
public string Type { get; set; }
public string Name { get; set; }
public string Status { get; set; }
public string UpdatedAt { get; set; }
public string Memo { get; set; }
}
}
================================================
FILE: src/GraphRag.Net.Web/Models/AdvancedProfileData.cs
================================================
namespace GraphRag.Net.Web.Models
{
public class AdvancedProfileData
{
public AdvancedOperation[] AdvancedOperation1 { get; set; }
public AdvancedOperation[] AdvancedOperation2 { get; set; }
public AdvancedOperation[] AdvancedOperation3 { get; set; }
}
}
================================================
FILE: src/GraphRag.Net.Web/Models/BasicGood.cs
================================================
namespace GraphRag.Net.Web.Models
{
public class BasicGood
{
public string Id { get; set; }
public string Name { get; set; }
public string Barcode { get; set; }
public string Price { get; set; }
public string Num { get; set; }
public string Amount { get; set; }
}
}
================================================
FILE: src/GraphRag.Net.Web/Models/BasicProfileDataType.cs
================================================
namespace GraphRag.Net.Web.Models
{
public class BasicProfileDataType
{
public BasicGood[] BasicGoods { get; set; }
public BasicProgress[] BasicProgress { get; set; }
}
}
================================================
FILE: src/GraphRag.Net.Web/Models/BasicProgress.cs
================================================
namespace GraphRag.Net.Web.Models
{
public class BasicProgress
{
public string Key { get; set; }
public string Time { get; set; }
public string Rate { get; set; }
public string Status
gitextract_nfiuwx4k/
├── .github/
│ └── workflows/
│ └── nuget-publish.yml
├── .gitignore
├── Directory.Build.props
├── GraphRag.Net.sln
├── LICENSE
├── README.en.md
├── README.md
└── src/
├── GraphRag.Net/
│ ├── Common/
│ │ ├── Options/
│ │ │ ├── GraphDBConnectionOption.cs
│ │ │ ├── GraphOpenAIOption.cs
│ │ │ ├── GraphSearchOption.cs
│ │ │ ├── GraphSysOption.cs
│ │ │ └── TextChunkerOption.cs
│ │ └── ServiceDescriptionAttribute.cs
│ ├── Domain/
│ │ ├── Interface/
│ │ │ ├── ICommunityDetectionService.cs
│ │ │ ├── IGraphService.cs
│ │ │ └── ISemanticService.cs
│ │ ├── Model/
│ │ │ ├── Graph/
│ │ │ │ ├── Graph.cs
│ │ │ │ ├── GraphModel.cs
│ │ │ │ ├── GraphViewModel.cs
│ │ │ │ ├── RelationShipModel.cs
│ │ │ │ └── TextMemModel.cs
│ │ │ └── PageList.cs
│ │ └── Service/
│ │ ├── CommunityDetectionService.cs
│ │ ├── GraphService.cs
│ │ └── SemanticService.cs
│ ├── Extensions/
│ │ └── ServiceCollectionExtensions.cs
│ ├── GraphRag.Net.csproj
│ ├── Repositories/
│ │ ├── Base/
│ │ │ ├── IRepository.cs
│ │ │ ├── Repository.cs
│ │ │ └── SqlSugarHelper.cs
│ │ └── Graph/
│ │ ├── CommunitieNodes/
│ │ │ ├── CommunitieNodes.cs
│ │ │ ├── CommunitieNodes_Repositories.cs
│ │ │ └── ICommunitieNodes_Repositories.cs
│ │ ├── Communities/
│ │ │ ├── Communities.cs
│ │ │ ├── Communities_Repositories.cs
│ │ │ └── ICommunities_Repositories.cs
│ │ ├── Edges/
│ │ │ ├── Edges.cs
│ │ │ ├── Edges_Repositories.cs
│ │ │ └── IEdges_Repositories.cs
│ │ ├── Global/
│ │ │ ├── Globals.cs
│ │ │ ├── Globals_Repositories.cs
│ │ │ └── IGlobals_Repositories.cs
│ │ └── Nodes/
│ │ ├── INodes_Repositories.cs
│ │ ├── Nodes.cs
│ │ └── Nodes_Repositories.cs
│ └── Utils/
│ ├── ConvertUtils.cs
│ ├── OpenAIHttpClientHandler.cs
│ └── RepoUtils/
│ ├── AppException.cs
│ ├── ObjectExtensions.cs
│ └── RepoFiles.cs
└── GraphRag.Net.Web/
├── .config/
│ └── dotnet-tools.json
├── App.razor
├── Components/
│ └── GlobalHeader/
│ ├── RightContent.razor
│ └── RightContent.razor.cs
├── Controllers/
│ └── GraphController.cs
├── Extensions/
│ └── DateTimeExtension.cs
├── GraphRag.Net.Web.csproj
├── GraphRag.Net.Web.xml
├── Layouts/
│ ├── BasicLayout.razor
│ ├── UserLayout.razor
│ └── UserLayout.razor.css
├── Mock/
│ ├── MockChatCompletion.cs
│ ├── MockTextCompletion.cs
│ └── MockTextEmbeddingGeneratorService.cs
├── Models/
│ ├── ActivitiesType.cs
│ ├── ActivityGroup.cs
│ ├── ActivityProject.cs
│ ├── ActivityUser.cs
│ ├── AdvancedOperation.cs
│ ├── AdvancedProfileData.cs
│ ├── BasicGood.cs
│ ├── BasicProfileDataType.cs
│ ├── BasicProgress.cs
│ ├── ChartData.cs
│ ├── ChartDataItem.cs
│ ├── ChatMessage.cs
│ ├── CurrentUser.cs
│ ├── FormItemLayout.cs
│ ├── FormModel.cs
│ ├── LayoutModel.cs
│ ├── ListFormModel.cs
│ ├── ListItemDataType.cs
│ ├── LoginParamsType.cs
│ ├── NoticeItem.cs
│ ├── NoticeType.cs
│ ├── OfflineChartDataItem.cs
│ ├── OfflineDataItem.cs
│ ├── RadarDataItem.cs
│ └── SearchDataItem.cs
├── Pages/
│ ├── Graph/
│ │ ├── Chat.razor
│ │ ├── Chat.razor.cs
│ │ └── Graph.razor
│ ├── Index.razor
│ └── _Host.cshtml
├── Program.cs
├── Utils/
│ └── LongToDateTimeConverter.cs
├── _Imports.razor
├── appsettings.json
├── graphPlugins/
│ └── graph/
│ ├── community_search/
│ │ ├── config.json
│ │ └── skprompt.txt
│ ├── community_summaries/
│ │ ├── config.json
│ │ └── skprompt.txt
│ ├── create/
│ │ ├── config.json
│ │ └── skprompt.txt
│ ├── global_summaries/
│ │ ├── config.json
│ │ └── skprompt.txt
│ ├── mergedesc/
│ │ ├── config.json
│ │ └── skprompt.txt
│ ├── relationship/
│ │ ├── config.json
│ │ └── skprompt.txt
│ └── search/
│ ├── config.json
│ └── skprompt.txt
└── wwwroot/
├── appsettings.json
├── css/
│ └── site.css
├── data/
│ ├── activities.json
│ ├── advanced.json
│ ├── basic.json
│ ├── current_user.json
│ ├── fake_chart_data.json
│ ├── fake_list.json
│ ├── menu.json
│ ├── notice.json
│ └── notices.json
├── index.html
└── js/
├── relation-graph.umd.js
└── vue2.js
SYMBOL INDEX (1214 symbols across 77 files)
FILE: src/GraphRag.Net.Web/Components/GlobalHeader/RightContent.razor.cs
class RightContent (line 8) | public partial class RightContent
method OnInitializedAsync (line 47) | protected override async Task OnInitializedAsync()
method SetClassMap (line 54) | protected void SetClassMap()
method HandleSelectUser (line 61) | public void HandleSelectUser(MenuItem item)
method HandleSelectLang (line 77) | public void HandleSelectLang(MenuItem item)
method HandleClear (line 81) | public async Task HandleClear(string key)
method HandleViewMore (line 98) | public async Task HandleViewMore(string key)
FILE: src/GraphRag.Net.Web/Controllers/GraphController.cs
class GraphController (line 7) | [Route("api/[controller]/[action]")]
method GetAllIndex (line 15) | [HttpGet]
method GetAllGraphs (line 28) | [HttpGet]
method InsertGraphData (line 45) | [HttpPost]
method SearchGraph (line 57) | [HttpPost]
method SearchGraphCommunity (line 69) | [HttpPost]
method ImportTxt (line 82) | [HttpPost]
method GraphCommunities (line 99) | [HttpGet]
method GraphGlobal (line 111) | [HttpGet]
method DeleteGraph (line 123) | [HttpGet]
class InputModel (line 131) | public class InputModel
FILE: src/GraphRag.Net.Web/Extensions/DateTimeExtension.cs
class DateTimeExtension (line 3) | public static class DateTimeExtension
method ToFriendlyDisplay (line 12) | public static string ToFriendlyDisplay(this DateTime dateTime)
FILE: src/GraphRag.Net.Web/Mock/MockChatCompletion.cs
class MockChatCompletion (line 12) | public class MockChatCompletion : IChatCompletionService
method MockChatCompletion (line 26) | public MockChatCompletion()
method GetChatMessageContentsAsync (line 31) | public async Task<IReadOnlyList<ChatMessageContent>> GetChatMessageCon...
method GetStreamingChatMessageContentsAsync (line 38) | public async IAsyncEnumerable<StreamingChatMessageContent> GetStreamin...
FILE: src/GraphRag.Net.Web/Mock/MockTextCompletion.cs
class MockTextCompletion (line 12) | public class MockTextCompletion : ITextGenerationService, IAIService
method MockTextCompletion (line 25) | public MockTextCompletion()
method GetTextContentsAsync (line 30) | public async Task<IReadOnlyList<TextContent>> GetTextContentsAsync(str...
method GetStreamingTextContentsAsync (line 37) | public async IAsyncEnumerable<StreamingTextContent> GetStreamingTextCo...
FILE: src/GraphRag.Net.Web/Mock/MockTextEmbeddingGeneratorService.cs
class MockTextEmbeddingGeneratorService (line 7) | public sealed class MockTextEmbeddingGeneratorService : ITextEmbeddingGe...
method MockTextEmbeddingGeneratorService (line 11) | public MockTextEmbeddingGeneratorService()
method GenerateEmbeddingsAsync (line 15) | public async Task<IList<ReadOnlyMemory<float>>> GenerateEmbeddingsAsync(
method Dispose (line 34) | public void Dispose()
FILE: src/GraphRag.Net.Web/Models/ActivitiesType.cs
class ActivitiesType (line 3) | public class ActivitiesType
FILE: src/GraphRag.Net.Web/Models/ActivityGroup.cs
class ActivityGroup (line 3) | public class ActivityGroup
FILE: src/GraphRag.Net.Web/Models/ActivityProject.cs
class ActivityProject (line 3) | public class ActivityProject
FILE: src/GraphRag.Net.Web/Models/ActivityUser.cs
class ActivityUser (line 3) | public class ActivityUser
FILE: src/GraphRag.Net.Web/Models/AdvancedOperation.cs
class AdvancedOperation (line 3) | public class AdvancedOperation
FILE: src/GraphRag.Net.Web/Models/AdvancedProfileData.cs
class AdvancedProfileData (line 3) | public class AdvancedProfileData
FILE: src/GraphRag.Net.Web/Models/BasicGood.cs
class BasicGood (line 3) | public class BasicGood
FILE: src/GraphRag.Net.Web/Models/BasicProfileDataType.cs
class BasicProfileDataType (line 3) | public class BasicProfileDataType
FILE: src/GraphRag.Net.Web/Models/BasicProgress.cs
class BasicProgress (line 3) | public class BasicProgress
FILE: src/GraphRag.Net.Web/Models/ChartData.cs
class ChartData (line 3) | public class ChartData
FILE: src/GraphRag.Net.Web/Models/ChartDataItem.cs
class ChartDataItem (line 3) | public class ChartDataItem
FILE: src/GraphRag.Net.Web/Models/ChatMessage.cs
class ChatMessage (line 3) | public class ChatMessage
FILE: src/GraphRag.Net.Web/Models/CurrentUser.cs
class TagType (line 3) | public class TagType
class GeographicType (line 9) | public class GeographicType
class CurrentUser (line 15) | public class CurrentUser
class UserLiteItem (line 34) | public class UserLiteItem
FILE: src/GraphRag.Net.Web/Models/FormItemLayout.cs
class FormItemLayout (line 5) | public class FormItemLayout
FILE: src/GraphRag.Net.Web/Models/FormModel.cs
class StepFormModel (line 3) | public class StepFormModel
class AdvancedFormModel (line 13) | public class AdvancedFormModel
class BasicFormModel (line 29) | public class BasicFormModel
class Owner (line 41) | public class Owner
FILE: src/GraphRag.Net.Web/Models/LayoutModel.cs
class LayoutModel (line 5) | public class LayoutModel
FILE: src/GraphRag.Net.Web/Models/ListFormModel.cs
class ListFormModel (line 3) | public class ListFormModel
class BasicListFormModel (line 12) | public class BasicListFormModel
FILE: src/GraphRag.Net.Web/Models/ListItemDataType.cs
class Member (line 6) | public class Member
class ListItemDataType (line 13) | public class ListItemDataType
FILE: src/GraphRag.Net.Web/Models/LoginParamsType.cs
class LoginParamsType (line 5) | public class LoginParamsType
FILE: src/GraphRag.Net.Web/Models/NoticeItem.cs
class NoticeItem (line 5) | public class NoticeItem : NoticeIconData
FILE: src/GraphRag.Net.Web/Models/NoticeType.cs
class NoticeType (line 3) | public class NoticeType
FILE: src/GraphRag.Net.Web/Models/OfflineChartDataItem.cs
class OfflineChartDataItem (line 3) | public class OfflineChartDataItem
FILE: src/GraphRag.Net.Web/Models/OfflineDataItem.cs
class OfflineDataItem (line 3) | public class OfflineDataItem
FILE: src/GraphRag.Net.Web/Models/RadarDataItem.cs
class RadarDataItem (line 3) | public class RadarDataItem
FILE: src/GraphRag.Net.Web/Models/SearchDataItem.cs
class SearchDataItem (line 3) | public class SearchDataItem
FILE: src/GraphRag.Net.Web/Pages/Graph/Chat.razor.cs
class Chat (line 7) | public partial class Chat
method OnInitializedAsync (line 21) | protected override async Task OnInitializedAsync()
method Search (line 27) | private async Task Search()
method Search1 (line 35) | private async Task Search1()
method OnSelectedItemChangedHandler (line 43) | private void OnSelectedItemChangedHandler(string value)
method BeforeUpload (line 49) | private bool BeforeUpload(UploadFileItem file)
method OnSingleCompleted (line 71) | private void OnSingleCompleted(UploadInfo fileinfo)
method InputText (line 77) | private async Task InputText()
FILE: src/GraphRag.Net.Web/Utils/LongToDateTimeConverter.cs
class LongToDateTimeConverter (line 7) | public class LongToDateTimeConverter : JsonConverter<DateTime>
method Read (line 9) | public override DateTime Read(ref Utf8JsonReader reader, Type typeToCo...
method Write (line 17) | public override void Write(Utf8JsonWriter writer, DateTime value, Json...
FILE: src/GraphRag.Net.Web/wwwroot/js/relation-graph.umd.js
function _t (line 1) | function _t(e){if(e&&e.__esModule)return e;const s=Object.create(null,{[...
function h (line 1) | function h(){i||(i=!0,o())}
method getDescendantNodes (line 1) | getDescendantNodes(e){const s=[];return e.lot&&e.lot.childs&&e.lot.child...
method analysisNodes (line 1) | analysisNodes(e,s,t,o){s.length>o.max_length&&(o.max_length=s.length),t>...
method analysisNodes4Didirectional (line 1) | analysisNodes4Didirectional(e,s,t,o,n){s.length>o.max_length&&(o.max_len...
method conductStrengthToParents (line 1) | conductStrengthToParents(e){e.lot.parent&&Math.abs(e.lot.level)-1===Math...
method analysisDataTree (line 1) | analysisDataTree(e,s,t=1){const o=[];let n=0;e.forEach(i=>{(i.lot.level=...
method conductStrengthToParents4Folder (line 1) | conductStrengthToParents4Folder(e){e.lot.parent&&(e.lot.parent.lot.stren...
method analysisDataFolder (line 1) | analysisDataFolder(e,s,t){const o=[];let n=0,i;e.forEach(a=>{(a.lot.leve...
method isAllowShowNode (line 1) | isAllowShowNode(e,s=0){return s>15?!0:(!e.lot||!e.lot.parent||x.isAllowS...
method getNodeWidth (line 1) | getNodeWidth(e,s){return e.el.offsetWidth||e.width||s&&s.defaultNodeWidt...
method getNodeHeight (line 1) | getNodeHeight(e,s){return e.el.offsetHeight||e.height||s&&s.defaultNodeH...
method getNodeXByLotX (line 1) | getNodeXByLotX(e,s){return(s.offset_x||0)+this.getNodeXByCenterX(e,s,s.l...
method getNodeYByLotY (line 1) | getNodeYByLotY(e,s){return(s.offset_y||0)+this.getNodeYByCenterY(e,s,s.l...
method getNodeXByCenterX (line 1) | getNodeXByCenterX(e,s,t){return s.alignItems==="right"?t-x.getNodeWidth(...
method getNodeYByCenterY (line 1) | getNodeYByCenterY(e,s,t){return s.alignItems==="top"?t:s.alignItems==="b...
method getCenterXByNodeX (line 1) | getCenterXByNodeX(e,s,t){return t+x.getNodeHeight(s,e)/2}
method getCenterYByNodeY (line 1) | getCenterYByNodeY(e,s,t){return t+x.getNodeHeight(s,e)/2}
method getLotXByNodeX (line 1) | getLotXByNodeX(e,s){const t=s.offset_x||0;return this.getCenterXByNodeX(...
method getLotYByNodeY (line 1) | getLotYByNodeY(e,s){const t=s.offset_y||0;return this.getCenterYByNodeY(...
method isRectangleOverlap (line 1) | isRectangleOverlap(e,s){const t=e.x+F,o=s.x+F,n=e.el.offsetWidth-F*2,i=s...
method isXOverlap (line 1) | isXOverlap(e,s,t,o){return!(s>=e+t||s+o<=e)}
method isYOverlap (line 1) | isYOverlap(e,s,t,o){return!(s>=e+t||s+o<=e)}
method shapesOverlap (line 1) | shapesOverlap(e,s,t=1,o=1){return this.isRectangleOverlap(e,s)}
method getNoOverlapLimitedPosition (line 1) | getNoOverlapLimitedPosition(e,s,t,o){const n=e.x+F,i=e.y+F,a=s+F,l=o.x+F...
method flatNodeData (line 1) | flatNodeData(e,s,t,o){e.forEach(n=>{t.push(n),s&&o.push({from:s.id,to:n....
class ct (line 1) | class ct{constructor(s,t,o){v(this,"graphOptions");v(this,"layoutOptions...
method constructor (line 1) | constructor(s,t,o){v(this,"graphOptions");v(this,"layoutOptions");v(th...
method setLinks (line 1) | setLinks(s){u("setLinks:",s.length),this.allLinks=s}
method refresh (line 1) | refresh(){this.placeNodes(this.allNodes,this.rootNode)}
method placeNodes (line 1) | placeNodes(s,t){this.allNodes=s,this.rootNode=t}
method snapshotBeforeAnimation (line 1) | snapshotBeforeAnimation(){this.allNodes.forEach(s=>{!x.isAllowShowNode...
method animationLayout (line 1) | animationLayout(s=!0){return C(this,null,function*(){s&&this.snapshotB...
method playAnimation (line 1) | playAnimation(s){if(u("[LayoutAnimationEffect]",this.currentAnimationS...
class Gt (line 1) | class Gt extends ct{constructor(t,o,n){super(t,o,n);v(this,"enableGather...
method constructor (line 1) | constructor(t,o,n){super(t,o,n);v(this,"enableGatherNodes",!1);v(this,...
method refresh (line 1) | refresh(){return C(this,null,function*(){u("SeeksBidirectionalTreeLayo...
method analysisNodes4Didirectional (line 1) | analysisNodes4Didirectional(t,o,n,i,a){u(`${a} level ${n} size: ${o.le...
method placeNodes (line 1) | placeNodes(t,o){return C(this,null,function*(){if(u("SeeksBidirectiona...
method placeNodesPosition (line 1) | placeNodesPosition(t,o,n){if(t.fixed!==!0){const i=this.layoutOptions....
method placeRelativePosition (line 1) | placeRelativePosition(t,o,n){const i=this.graphOptions.viewSize;if(thi...
method gatherNodes (line 1) | gatherNodes(t,o,n){if(!this.enableGatherNodes)return;const i={};t.forE...
method getBloomingNearByParent (line 1) | getBloomingNearByParent(t,o,n,i){let a=9999,l;for(const r of n)if(r.lo...
method getLevelDistance (line 1) | getLevelDistance(t,o,n){const i=Math.abs(o);if(this.levelDistanceArr&&...
function Fe (line 1) | function Fe(e,s,t,o,n,i,a,l,r){const h=n-e,c=i-s,p=Math.sqrt(h*h+c*c),d=...
method getRectPoint (line 1) | getRectPoint(e,s,t,o,n,i,a,l,r=!1,h=1,c=1,p=14){const d=c-(h-1)/2,g=e+n/...
method getRectPointBasic (line 1) | getRectPointBasic(e,s,t,o,n,i,a,l){const r=e+n/2,h=s+i/2,c=t+a/2,p=o+l/2...
method getRectJoinPoint (line 1) | getRectJoinPoint(e,s,t,o,n,i,a,l){const r=e+n/2,h=s+i/2,c=t+a/2,p=o+l/2,...
method getRectHJoinPoint (line 1) | getRectHJoinPoint(e,s,t,o,n,i,a){const l=i/2;return e+n<t?{x:e+n+5,y:s+l...
method getRectLeftJoinPoint (line 1) | getRectLeftJoinPoint(e,s,t,o,n,i,a){const l=i/2;return{x:e,y:s+l}}
method getRectRightJoinPoint (line 1) | getRectRightJoinPoint(e,s,t,o,n,i,a){const l=i/2;return{x:e+n,y:s+l}}
method getRectTopJoinPoint (line 1) | getRectTopJoinPoint(e,s,t,o,n,i,a){return{x:e+n/2,y:s}}
method getRectBottomJoinPoint (line 1) | getRectBottomJoinPoint(e,s,t,o,n,i,a,l,r,h,c,p,d=14,g){return g!==void 0...
method getRectVJoinPoint (line 1) | getRectVJoinPoint(e,s,t,o,n,i,a,l){const r=n/2;return s+i<o?{y:s+i+5,x:e...
method getBorderPoint (line 1) | getBorderPoint(e,s,t,o,n,i,a,l,r){return r===0?this.getCirclePoint(e,s,t...
method getBorderPoint4MultiLine (line 1) | getBorderPoint4MultiLine(e,s,t,o,n,i,a,l,r,h,c,p,d=14){return r===0?this...
method getCirclePoint (line 1) | getCirclePoint(e,s,t,o,n,i,a,l){const r=t+a/2,h=o+l/2,c=e+n/2,p=s+i/2,d=...
method getCirclePoint4MultiLine (line 1) | getCirclePoint4MultiLine(e,s,t,o,n,i,a,l,r,h,c,p,d=0){let g=t+a/2;const ...
method getCirclePointBasic (line 1) | getCirclePointBasic(e,s,t,o,n,i,a,l,r){const h=e+n/2,c=s+i/2,p=t+a/2,d=o...
method getCirclePointPlus (line 1) | getCirclePointPlus(e,s,t,o,n,i,a,l){const r=e+n/2,h=s+i/2,c=t+a/2,p=o+l/...
method getOvalPoint (line 1) | getOvalPoint(e,s,t,o,n,i=180){const a=o*(360/n),l=(180-i+a)*Math.PI/180;...
method getAngleType (line 1) | getAngleType(e,s){if(e>=0&&s>=0)return 1;if(e<0&&s>=0)return 2;if(e<0&&s...
method getTextAngle (line 1) | getTextAngle(e,s,t,o){let n=Math.atan2(o-s,t-e)*180/Math.PI;return n<0&&...
method getTreePointFromTop (line 1) | getTreePointFromTop(e,s,t,o,n,i){return e?{x:e-300+Math.max(600/((n===1?...
method getTreePointFromRight (line 1) | getTreePointFromRight(e,s,t,o,n,i){return e?{x:e-t,y:s-200+Math.max(400/...
method getTreePointFromBottom (line 1) | getTreePointFromBottom(e,s,t,o,n,i){return e?{x:e-300+Math.max(600/((n==...
method getTreePointFromLeft (line 1) | getTreePointFromLeft(e,s,t,o,n,i){return e?{x:e+t,y:s-200+Math.max(400/(...
class dt (line 1) | class dt extends ct{constructor(t,o,n){super(t,o,n);v(this,"layoutOption...
method constructor (line 1) | constructor(t,o,n){super(t,o,n);v(this,"layoutOptions");v(this,"fastSt...
method refresh (line 1) | refresh(){this.placeNodes(this.allNodes,this.rootNode)}
method placeNodes (line 1) | placeNodes(t,o){if(u("!!!SeeksForceLayouter.placeNodes"),o)u("layout b...
method easyPlaceGroupNodes (line 1) | easyPlaceGroupNodes(t){if(u("[layout canvasOffset]",this.graphOptions....
method easyAnalysisNodes (line 1) | easyAnalysisNodes(t){this.allNodes.forEach(i=>{i.lot.eached=!1,i.lot.n...
method easyPlaceRelativePosition (line 1) | easyPlaceRelativePosition(t,o){o.forEach(i=>{if(i.lot.subling.level===...
method updateVisibleNodes (line 1) | updateVisibleNodes(t){this.visibleNodes=[],t&&(this.allNodes=t),this.a...
method autoLayout (line 1) | autoLayout(t=!1){this.layoutTimes=0,this.updateVisibleNodes(),u("Layou...
method layoutFinished (line 1) | layoutFinished(){this.isMainLayouer&&(this.graphOptions.autoLayouting=...
method resetCalcNodes (line 1) | resetCalcNodes(){u("resetCalcNodes:",this.visibleNodes.length),this.fo...
method doForceLayout (line 1) | doForceLayout(t){if(this.graphOptions.instanceDestroyed){u("stop layou...
method graphEventHandle (line 1) | graphEventHandle(t,...o){if(t===$.nodeDragStart){const n=o[0],i=this.c...
method connectToGraphInstance (line 1) | connectToGraphInstance(){this.viewUpdate=()=>{this.graphInstance._data...
method disConnectToGraphInstance (line 1) | disConnectToGraphInstance(){this.graphInstance.removeEventListener(thi...
method calcNodesPosition (line 1) | calcNodesPosition(){if(this.byNode)for(let t=0;t<this.forCalcNodes.len...
method stop (line 1) | stop(){u("[SeeksForceLayouter]stop:",this.graphOptions.autoLayouting),...
method addElasticByLine (line 1) | addElasticByLine(t,o,n=1){const i=t.x,a=t.y,l=o.x,r=o.y;let h=Math.sqr...
method addGravityByNode (line 1) | addGravityByNode(t,o){const n=t.x,i=t.y,a=o.x,l=o.y;if(Math.abs(n-a)>t...
method addFtoNode (line 1) | addFtoNode(t,o,n){if(t.ignoreForce||Number.isNaN(o)||Number.isNaN(n))r...
method applyToNodePosition (line 1) | applyToNodePosition(t){if(t.fixed)return;let o=t.Fx,n=t.Fy;if(o>this.m...
class Bt (line 1) | class Bt extends dt{constructor(t,o,n){super(t,o,n);v(this,"layoutOption...
method constructor (line 1) | constructor(t,o,n){super(t,o,n);v(this,"layoutOptions");this.layoutOpt...
method refresh (line 1) | refresh(){return C(this,null,function*(){u("SeeksCenterLayouter:refres...
method placeNodes (line 1) | placeNodes(t,o){return C(this,null,function*(){if(u("SeeksCenterLayout...
method getLevelDistanceArr (line 1) | getLevelDistanceArr(){let t=[];if(this.layoutOptions.levelDistance&&(t...
method getLevelR (line 1) | getLevelR(t,o){if(t.length===0)return;let n=0;for(let i=0;i<o&&i<t.len...
method placeRelativePosition (line 1) | placeRelativePosition(t,o,n){const i=this.layoutOptions.distance_coeff...
class Tt (line 1) | class Tt extends dt{constructor(s,t,o){super(s,t,o)}refresh(){return C(t...
method constructor (line 1) | constructor(s,t,o){super(s,t,o)}
method refresh (line 1) | refresh(){return C(this,null,function*(){yield this.placeNodes(this.al...
method placeNodes (line 1) | placeNodes(s,t){return C(this,null,function*(){if(t)u("layout by root:...
class At (line 1) | class At extends ct{constructor(t,o,n){super(t,o,n);v(this,"graphOptions...
method constructor (line 1) | constructor(t,o,n){super(t,o,n);v(this,"graphOptions");v(this,"layoutO...
method refresh (line 1) | refresh(){this.placeNodes(this.__origin_nodes,this.rootNode)}
method placeNodes (line 1) | placeNodes(t,o){if(o)u("layout by root:",o);else{u("root is null:",o);...
class Ue (line 1) | class Ue extends ct{constructor(t,o,n){super(t,o,n);v(this,"graphInstanc...
method constructor (line 1) | constructor(t,o,n){super(t,o,n);v(this,"graphInstance");v(this,"layout...
method refresh (line 1) | refresh(){return C(this,null,function*(){u("SeeksBidirectionalTreeLayo...
method analysisNodes4Didirectional (line 1) | analysisNodes4Didirectional(t,o,n,i){this.analysisBothWay(t,o,n,i);con...
method analysisBothWay (line 1) | analysisBothWay(t,o,n,i){u(`level ${n} size: ${o.length}`),o.length>i....
method placeNodes (line 1) | placeNodes(t,o){return C(this,null,function*(){if(u("SeeksBidirectiona...
method placeNodesPosition (line 1) | placeNodesPosition(t,o,n){if(t.fixed!==!0){const i=this.layoutOptions....
method placeRelativePosition (line 1) | placeRelativePosition(t,o,n){const i=this.graphOptions.viewSize;if(thi...
method getLevelDistance (line 1) | getLevelDistance(t,o,n){const i=Math.abs(o);if(this.levelDistanceArr&&...
class je (line 1) | class je extends ct{constructor(t,o,n){super(t,o,n);v(this,"enableGather...
method constructor (line 1) | constructor(t,o,n){super(t,o,n);v(this,"enableGatherNodes",!1);v(this,...
method refresh (line 1) | refresh(){return C(this,null,function*(){u("SeeksBidirectionalTreeLayo...
method analysisNodes4Didirectional (line 1) | analysisNodes4Didirectional(t,o,n,i,a){u(`${a} level ${n} size: ${o.le...
method placeNodes (line 1) | placeNodes(t,o){return C(this,null,function*(){if(u("SeeksBidirectiona...
method placeNodesPosition (line 1) | placeNodesPosition(t,o,n){if(t.fixed!==!0){const i=this.layoutOptions....
method placeRelativePosition (line 1) | placeRelativePosition(t,o,n){const i=Z(this.layoutOptions.min_per_widt...
method gatherNodes (line 1) | gatherNodes(t,o,n){if(!this.enableGatherNodes)return;const i={};t.forE...
method getBloomingNearByParent (line 1) | getBloomingNearByParent(t,o,n,i){let a=9999,l;for(const r of n)if(r.lo...
method getLevelDistance (line 1) | getLevelDistance(t,o,n){const i=Math.abs(o);if(this.levelDistanceArr&&...
class Je (line 1) | class Je{constructor(s,t){v(this,"options");v(this,"listeners");v(this,"...
method constructor (line 1) | constructor(s,t){v(this,"options");v(this,"listeners");v(this,"isReact...
method enableDebugLog (line 1) | enableDebugLog(s){this.options.debug=s,window&&(window.relationGraphDe...
method setUpdateViewHook (line 1) | setUpdateViewHook(s){this.isReact=!0,this.updateViewHook=s}
method _dataUpdated (line 1) | _dataUpdated(){if(this._dataUpdating){this._dataUpdatingNext=!0;return...
method _doSomethingAfterDataUpdated (line 1) | _doSomethingAfterDataUpdated(){u("_dataUpdated:",this._dataUpdatingNex...
method addEventListener (line 1) | addEventListener(s){this.eventHandlers.includes(s)||this.eventHandlers...
method removeEventListener (line 1) | removeEventListener(s){const t=this.eventHandlers.indexOf(s);t!==-1&&t...
method setEventEmitHook (line 1) | setEventEmitHook(s){this._hook=s}
method emitEvent (line 1) | emitEvent(s,...t){let o=this.defaultEventHandler(s,...t);for(const n o...
method defaultEventHandler (line 1) | defaultEventHandler(s,...t){if(s===$.nodeDragStart)this.listeners.onNo...
class qe (line 1) | class qe extends Je{constructor(t,o){super(t,o);v(this,"$dom");v(this,"$...
method constructor (line 1) | constructor(t,o){super(t,o);v(this,"$dom");v(this,"$canvasDom");v(this...
method setDom (line 1) | setDom(t){this.$dom=t,this.addResizeListener(this.$dom,(o,n)=>{u("resi...
method setCanvasDom (line 1) | setCanvasDom(t){this.$canvasDom=t}
method getBoundingClientRect (line 1) | getBoundingClientRect(){return this.$dom.getBoundingClientRect()}
method addResizeListener (line 1) | addResizeListener(t,o){this.resizeListenerMap.set(t,o),this.resizeObse...
method _onNodeResize (line 1) | _onNodeResize(t,o,n){if(o===0||n===0)return;const i=this.nodeMap.get(t...
method addNodeResizeListener (line 1) | addNodeResizeListener(t,o){this.nodeMap.set(t,o),this.resizeObserver.o...
method removeNodeResizeListener (line 1) | removeNodeResizeListener(t){this.nodeMap.delete(t),this.resizeObserver...
method removeResizeListener (line 1) | removeResizeListener(t){this.resizeListenerMap.delete(t),this.resizeOb...
class Ke (line 1) | class Ke extends qe{constructor(t,o){super(t,o);v(this,"graphData",{root...
method constructor (line 1) | constructor(t,o){super(t,o);v(this,"graphData",{rootNode:void 0,nodes:...
method setReactiveData (line 1) | setReactiveData(t,o){this.reactiveData=o,this.graphData=t,this.allLine...
method setReactiveDataVue3 (line 1) | setReactiveDataVue3(t,o){this.reactiveData=o,this.graphData=t,this.all...
method _setOptions (line 1) | _setOptions(t){const o=Lt(t);this.reactiveData?Object.assign(this.reac...
method _initLayoutByLayoutOptions (line 1) | _initLayoutByLayoutOptions(t){this.options.layoutClassName=t.layoutCla...
method initLayouter (line 1) | initLayouter(){if(this.userLayouerClass)u("Use user layouter:",this.us...
method _setJsonData (line 1) | _setJsonData(t,o=!1){return C(this,null,function*(){yield this.clearGr...
method clearGraph (line 1) | clearGraph(){return C(this,null,function*(){this.graphData.nodes=[],th...
method clearElementLines (line 1) | clearElementLines(){return C(this,null,function*(){this.graphData.elem...
method generateNewNodeId (line 1) | generateNewNodeId(t=5){const o=this.generateNewUUID(t);return this.get...
method generateNewUUID (line 1) | generateNewUUID(t=5){const o="0123456789abcdefghijklmnopqrstuvwxyzABCD...
method loadNodes (line 1) | loadNodes(t){const o={};this.graphData.nodes.forEach(i=>{o[i.id]=i});c...
method loadLines (line 1) | loadLines(t){const o={};this.graphData.nodes.forEach(a=>{o[a.id]=a});c...
method getNextLineId (line 1) | getNextLineId(t){const o=this.nextLineId++,n=`${t.seeks_id}-${o}`;for(...
method flatNodeData (line 1) | flatNodeData(t,o,n,i){x.flatNodeData(t,o,n,i)}
method loadGraphJsonData (line 1) | loadGraphJsonData(t){t.lines||(t.lines=t.relations,console.warn("[rela...
method getLineArrow (line 1) | getLineArrow(t,o=!1,n=!1){const i=o?"start-":"";if(n)return`${this.opt...
method getNodes (line 1) | getNodes(){return this.graphData.nodes}
method getLinks (line 1) | getLinks(){return this.graphData.links}
method transRGNodeToJsonObject (line 1) | transRGNodeToJsonObject(t){const o=yt(t);return o.selected=!1,o}
method transRGLinkToJsonObject (line 1) | transRGLinkToJsonObject(t){const o=[];return vt(t,o),o}
method transRGLineToJsonObject (line 1) | transRGLineToJsonObject(t){return St(t)}
method getGraphJsonData (line 1) | getGraphJsonData(){const t=[],o=[];return this.graphData.nodes.forEach...
method getGraphJsonOptions (line 1) | getGraphJsonOptions(){const t={},o=["layouter","autoLayouting","canvas...
method printGraphJsonData (line 1) | printGraphJsonData(){console.log("graph options:",JSON.stringify(this....
method getNodeById (line 1) | getNodeById(t){for(let o=0;o<this.graphData.nodes.length;o++)if(this.g...
method getLinkById (line 1) | getLinkById(t){for(let o=0;o<this.graphData.links.length;o++)if(this.g...
method getLinkByLineId (line 1) | getLinkByLineId(t){for(let o=0;o<this.graphData.links.length;o++)if(th...
method addNodes (line 1) | addNodes(t){u("addNodes:",t),this.loadNodes(t),this._dataUpdated()}
method addLines (line 1) | addLines(t){u("addLines:",t),this.loadLines(t),this._dataUpdated()}
method addElementLines (line 1) | addElementLines(t){u("addElementLines:",t),t.forEach(o=>{const n=docum...
method getElementLineById (line 1) | getElementLineById(t){for(const o of this.graphData.elementLines)for(c...
method getElementLines (line 1) | getElementLines(){const t=[];return this.graphData.elementLines.forEac...
method removeElementLine (line 1) | removeElementLine(t){u("removeElementLine:",t);for(const o of this.gra...
method removeELementLineById (line 1) | removeELementLineById(t){u("removeELementLineById:",t);for(const o of ...
method updateElementLines (line 1) | updateElementLines(){u("updateElementLines:",this.graphData.elementLin...
method _updateElementLines (line 1) | _updateElementLines(){this.graphData.elementLines.forEach(t=>{const o=...
method _updateElementLinePosition (line 1) | _updateElementLinePosition(t,o){if(!t)return;const n=t.getBoundingClie...
method getElementPosition (line 1) | getElementPosition(t){const n=document.getElementById(t).getBoundingCl...
method removeNodeById (line 1) | removeNodeById(t){let o=0;for(let i=0;i<this.graphData.links.length;i+...
method removeNode (line 1) | removeNode(t){this.removeNodeById(t.id),this._dataUpdated()}
method removeLinkByTwoNode (line 1) | removeLinkByTwoNode(t,o){for(const n of this.getLinks())if(n.fromNode....
method getGroupByNode (line 1) | getGroupByNode(t,o=[]){o.includes(t)||o.push(t);for(const n of t.targe...
method _clearItem (line 1) | _clearItem(t,o){for(let n=0;n<t.length;n++)t[n]===o&&(t.splice(n,1),n--)}
method removeNodeRef (line 1) | removeNodeRef(t,o){t&&(t.targetNodes&&this._clearItem(t.targetNodes,o)...
method removeLinkById (line 1) | removeLinkById(t){u("removeLinkById:",t);for(let o=0;o<this.graphData....
method removeLink (line 1) | removeLink(t){u("removeLink:",t),this.removeLinkById(t.seeks_id),this....
method removeLine (line 1) | removeLine(t,o){u("removeLine:",t,o);for(let n=0;n<t.relations.length;...
method removeLineById (line 1) | removeLineById(t){u("removeLineById:",t);for(const o of this.graphData...
method setNodePosition (line 1) | setNodePosition(t,o,n){t.x=o,t.y=n}
method getGraphOffet (line 1) | getGraphOffet(){const t=this.options.graphOffset_x||0,o=this.options.g...
method setCanvasCenter (line 1) | setCanvasCenter(t,o){const n=this.options.viewSize.width/2,i=this.opti...
method setCanvasOffset (line 1) | setCanvasOffset(t,o){this.options.canvasOffset.x=t,this.options.canvas...
method findGroupNodes (line 1) | findGroupNodes(t,o){o.push(t),t.targetNodes.forEach(n=>{o.includes(n)|...
method resetViewSize (line 1) | resetViewSize(t=!1){!this.options||(this.options.viewSize.width=this.$...
method refreshNVAnalysisInfo (line 1) | refreshNVAnalysisInfo(){if(!this.$dom){console.error("cannot get view ...
method getStuffSize (line 1) | getStuffSize(t){const o=t||this.graphData.nodes;let n=9999999,i=999999...
method getNodesCenter (line 1) | getNodesCenter(){const t=this.getStuffSize();u("getStuffSize:",t);cons...
method querySearchAsync (line 1) | querySearchAsync(t){if(u("fetch-suggestions",t),t=t.trim(),t==="")retu...
method printOptions (line 1) | printOptions(){const t=this.getGraphJsonOptions();console.log("options...
method printData (line 1) | printData(){const t=this.getGraphJsonData();console.log("data:",t),con...
method loading (line 1) | loading(t=""){this.options.graphLoading=!0,this.options.graphLoadingTe...
method clearLoading (line 1) | clearLoading(){this.options.graphLoading=!1,this.options.graphLoadingT...
method updateVisbleViewNodes (line 1) | updateVisbleViewNodes(t=!1){!t&&(!this.options.performanceMode||this.o...
method _updateVisbleViewNodes (line 1) | _updateVisbleViewNodes(){const t=this.getBoundingClientRect(),o=this.g...
class Qe (line 1) | class Qe extends Ke{constructor(t,o){super(t,o);v(this,"$watermarkDom",n...
method constructor (line 1) | constructor(t,o){super(t,o);v(this,"$watermarkDom",null);v(this,"$wate...
method setWatermarkDom (line 1) | setWatermarkDom(t,o=!0,n=!1,i="br"){o&&(this.$watermarkDom=t),this.$wa...
method setBackgroundDom (line 1) | setBackgroundDom(t,o=!0,n=!0){o&&(this.$backgroundDom=t)}
method dataURLToBlob (line 1) | dataURLToBlob(t){try{const o=t.split(","),n=o[0],i=n&&n.match(/:(.*?);...
method createGraphCanvas (line 1) | createGraphCanvas(t="png"){return C(this,null,function*(){const o=this...
method mergeCanvas (line 1) | mergeCanvas(t,o,n){const i=window.devicePixelRatio,a=document.createEl...
method createGraphBackgroundCanvas (line 1) | createGraphBackgroundCanvas(t="png"){return C(this,null,function*(){co...
method createGraphWatermarkCanvas (line 1) | createGraphWatermarkCanvas(t="png"){return C(this,null,function*(){con...
method createGraphMainCanvas (line 1) | createGraphMainCanvas(t="png"){return C(this,null,function*(){const o=...
method createImage (line 1) | createImage(t,o,n,i){return C(this,null,function*(){return u("createIm...
method getImageBase64 (line 1) | getImageBase64(t="png"){return C(this,null,function*(){const o=yield t...
method downloadAsImage (line 1) | downloadAsImage(t="png",o){return C(this,null,function*(){if(this.emit...
method downloadImageAsFile (line 1) | downloadImageAsFile(t,o,n){return C(this,null,function*(){const i=docu...
class to (line 1) | class to extends Qe{constructor(s,t){super(s,t)}createReturnValue(s,t){r...
method constructor (line 1) | constructor(s,t){super(s,t)}
method createReturnValue (line 1) | createReturnValue(s,t){return{path:s,textPosition:t}}
method createLinePath (line 1) | createLinePath(s,t,o){let n=s.fromNode;n||(n={x:0,y:0,el:{offsetWidth:...
method _getJunctionPoint (line 1) | _getJunctionPoint(s,t){return s===et.border?q.getBorderPoint4MultiLine...
method createLinePathByTwoNode (line 1) | createLinePathByTwoNode(s,t,o,n=0,i=1){const a=o.lineShape||this.optio...
method createLinePathData (line 1) | createLinePathData(s,t,o,n,i,a,l,r,h,c,p,d,g,f,m,_,y,M){const S=g-l,z=...
method calcCurveCenter (line 1) | calcCurveCenter(s,t,o,n,i=.5){const a={x:(1-i)*s.x+i*t.x,y:(1-i)*s.y+i...
method createCheckedLinePath (line 1) | createCheckedLinePath(){const s=this.options.checkedLineId;if(!!s)try{...
method createCheckedLineStrokeWidth (line 1) | createCheckedLineStrokeWidth(){const s=this.options.checkedLineId;if(!...
method getTextTransform (line 1) | getTextTransform(s,t,o,n){if(Number.isNaN(t)||Number.isNaN(o))return"t...
method getArrow (line 1) | getArrow(s,t,o=!1){if(o){if(s.isReverse){if(s.showEndArrow===!1)return...
method getLineTextStyle (line 1) | getLineTextStyle(s,t,o){let n=t.text;if(!n)return null;let i=0;const a...
class eo (line 1) | class eo extends to{constructor(t,o){super(t,o);v(this,"zoomCenter_of_ne...
method constructor (line 1) | constructor(t,o){super(t,o);v(this,"zoomCenter_of_newSize",{x:0,y:0})}
method zoom (line 1) | zoom(t,o){this.options.canvasZoom+t<5&&(u("zoom:reset zoom=10"),t=5-th...
method _zoomEnd (line 1) | _zoomEnd(t,o){this.refreshNVAnalysisInfo(),t<=40&&o>40&&(this.options....
method setZoom (line 1) | setZoom(t,o){const n=Math.floor(t-this.options.canvasZoom);this.zoom(n...
method getCanvasCoordinateByClientCoordinate (line 1) | getCanvasCoordinateByClientCoordinate(t){const o=this.options.canvasZo...
method getClientCoordinateByCanvasCoordinate (line 1) | getClientCoordinateByCanvasCoordinate(t){const o=this.options.canvasZo...
method getViewPointByCanvasPoint (line 1) | getViewPointByCanvasPoint(t){const o=this.options.canvasZoom/100,{NMCa...
method getCanvasPointByViewPoint (line 1) | getCanvasPointByViewPoint(t){const o=this.$dom.getBoundingClientRect()...
method analysisByZoom (line 1) | analysisByZoom(t,o){const n={NMViewPosition:{x:0,y:0},NMViewCenter:{x:...
method showZoomCenter (line 1) | showZoomCenter(t,o){if(!this.$dom)return{buff_x:0,buff_y:0};const n=th...
class oo (line 1) | class oo extends eo{constructor(s,t){super(s,t)}doLayout(){return C(this...
method constructor (line 1) | constructor(s,t){super(s,t)}
method doLayout (line 1) | doLayout(){return C(this,null,function*(){if(!this.layouter){u("no lay...
method refresh (line 1) | refresh(s=!0){return C(this,null,function*(){this.resetViewSize(!0),th...
method playShowEffect (line 1) | playShowEffect(){return C(this,null,function*(){if(this.graphData.node...
method moveToCenter (line 1) | moveToCenter(){return C(this,null,function*(){if(this.options.useAnima...
method zoomToFitWhenRefresh (line 1) | zoomToFitWhenRefresh(){return C(this,null,function*(){this.options.zoo...
method placeOtherNodes (line 1) | placeOtherNodes(){return C(this,null,function*(){const s=this.options....
method placeSingleNodes (line 1) | placeSingleNodes(s){if(s.length>0){u("sigle nodes:",s.length);const t=...
method placeOtherGroup (line 1) | placeOtherGroup(s,t){return C(this,null,function*(){if(s.length>0){u("...
method zoomToFit (line 1) | zoomToFit(s){return C(this,null,function*(){const t=this.getStuffSize(...
method animateGoto (line 1) | animateGoto(s,t,o){return C(this,null,function*(){return new Promise((...
method animateToZoom (line 1) | animateToZoom(s,t){return C(this,null,function*(){return new Promise((...
method animateStepAction (line 1) | animateStepAction(s,t,o,n,i){s<o?(n(s,o),setTimeout(()=>{this.animateS...
method toggleAutoLayout (line 1) | toggleAutoLayout(){this.options.autoLayouting=!this.options.autoLayout...
method startAutoLayout (line 1) | startAutoLayout(){this.options.autoLayouting=!0,this.layouter.autoLayo...
method stopAutoLayout (line 1) | stopAutoLayout(){this.options.autoLayouting=!1,this.layouter.stop?this...
method sleep (line 1) | sleep(s){return C(this,null,function*(){yield mt(s)})}
method startDrag (line 1) | startDrag(e,s,t,o){o?Pt=(n,i,a)=>{const l=n-st.x,r=i-st.y;o(l,r,it,st,a)...
method onNodeMove (line 1) | onNodeMove(e){const s=It(e);Pt(s.clientX,s.clientY,e)}
method onNodeDragend (line 1) | onNodeDragend(e){tt(e)?(document.body.removeEventListener("touchmove",Q....
class io (line 1) | class io extends oo{constructor(t,o){super(t,o);v(this,"prevClickTime",0...
method constructor (line 1) | constructor(t,o){super(t,o);v(this,"prevClickTime",0);v(this,"movingLi...
method setDefaultLineShape (line 1) | setDefaultLineShape(t){this.options.defaultLineShape=t}
method setDefaultJunctionPoint (line 1) | setDefaultJunctionPoint(t){this.options.defaultJunctionPoint=t}
method setCheckedNode (line 1) | setCheckedNode(t){this.options.checkedNodeId=t}
method setCheckedLinkAndLine (line 1) | setCheckedLinkAndLine(t,o){this.options.checkedLinkId=t.seeks_id,this....
method clearChecked (line 1) | clearChecked(){this.options.checkedNodeId="",this.options.checkedLineI...
method selectNode (line 1) | selectNode(t,o){t.selected=o}
method flashNode (line 1) | flashNode(t,o){t.flashing=o}
method updateNodeOffsetSize (line 1) | updateNodeOffsetSize(t,o,n){t.el.offsetWidth=o,t.el.offsetHeight=n}
method onNodeClick (line 1) | onNodeClick(t,o){return C(this,null,function*(){if(Date.now()-this.pre...
method onNodeDragStart (line 1) | onNodeDragStart(t,o){if(this.options.disableDragNode||t.disableDrag)re...
method onNodeDraged (line 1) | onNodeDraged(t,o,n,i){if(o===0&&n===0){u("[node]node click by drag"),t...
method onNodeDragEnd (line 1) | onNodeDragEnd(t,o){this.updateElementLines(),this.emitEvent($.nodeDrag...
method onLineClick (line 1) | onLineClick(t,o,n){return C(this,null,function*(){u("onLineClick:","li...
method expandOrCollapseNode (line 1) | expandOrCollapseNode(t,o){return C(this,null,function*(){t.expanded===...
method setChildsFromPosition (line 1) | setChildsFromPosition(t,o){t.lot.childs.forEach(n=>{n.x=o.x,n.y=o.y,th...
method expandNode (line 1) | expandNode(t,o){return C(this,null,function*(){u("onNodeExpand:",t),t....
method getDescendantNodes (line 1) | getDescendantNodes(t){return x.getDescendantNodes(t)}
method setChildsToPosition (line 1) | setChildsToPosition(t,o){t.lot.childs.forEach(n=>{n.lot.from_x=n.x,n.l...
method collapseNode (line 1) | collapseNode(t,o){return C(this,null,function*(){u("onNodeCollapse:",t...
method onCanvasDragEnd (line 1) | onCanvasDragEnd(t){this.updateEditingControllerView(),this.emitEvent($...
method onCanvasClick (line 1) | onCanvasClick(t){this.options.creatingLinePlot&&this.onCanvasClickWhen...
method clickGraphMask (line 1) | clickGraphMask(t){this.clearLoading()}
method onCanvasSelectionEnd (line 1) | onCanvasSelectionEnd(t,o){this.emitEvent($.onCanvasSelectionEnd,t,o)}
method startCreatingNodePlot (line 1) | startCreatingNodePlot(t,o){this.options.newNodeTemplate=ft(JSON.parse(...
method startCreatingLinePlot (line 1) | startCreatingLinePlot(t,o){const n=tt(t);o&&o.onCreateLine&&(this.onCr...
method stopCreatingLinePlot (line 1) | stopCreatingLinePlot(){u("[CreatingLinePlot]stop CreatingLinePlot!"),t...
method onMovingWhenCreatingLinePlot (line 1) | onMovingWhenCreatingLinePlot(t){if(u("[CreatingLinePlot]mousemove"),th...
method onCanvasClickWhenCreatingLinePlot (line 1) | onCanvasClickWhenCreatingLinePlot(t){if(Date.now()-this.step1EventTime...
method onNodeClickWhenCreatingLinePlot (line 1) | onNodeClickWhenCreatingLinePlot(t){this.options.newLinkTemplate.fromNo...
method onCreateLine (line 1) | onCreateLine(t,o){u("[CreatingLinePlot][fire-event]onCreateLine:",t,o)...
method isNode (line 1) | isNode(t){const o=Mt(t,"rel-node-peel","rel-map");return o?this.getNod...
method isLink (line 1) | isLink(t){const o=Mt(t,"rel-link-peel","rel-map");return o?this.getLin...
method onContextmenu (line 1) | onContextmenu(t){this.stopCreatingLinePlot();let o="canvas",n=this.isN...
method fullscreen (line 1) | fullscreen(t){return C(this,null,function*(){if(Y.default.element&&Y.d...
method focusNodeById (line 1) | focusNodeById(t){return C(this,null,function*(){let o;this.graphData.n...
method focusRootNode (line 1) | focusRootNode(){return C(this,null,function*(){u("relation-graph:focus...
method handleSelect (line 1) | handleSelect(t){return C(this,null,function*(){u("checked:",t),scrollT...
method onMouseWheel (line 1) | onMouseWheel(t){if(this.options.disableZoom)return t.cancelBubble=!1,!...
method _onMouseWheel (line 1) | _onMouseWheel(t,o){const n={x:t.clientX,y:t.clientY};this.zoom(o,n)}
method onLineDragStart (line 1) | onLineDragStart(t,o){u("onLineDragStart...");const n={x:t.fromNode.x,y...
method onLineDragEnd (line 1) | onLineDragEnd(t,o,n){u("onLineDragEnd"),this.updateElementLines()}
method onCanvasDragStart (line 1) | onCanvasDragStart(t){if(u("[canvas]onCanvasDragStart..."),this.options...
method onCanvasDragStop (line 1) | onCanvasDragStop(t,o,n){if(u("[canvas]onCanvasDragStop..."),this.optio...
method startCreateSelection (line 1) | startCreateSelection(t){let o=!1;const n=(i,a,l,r,h)=>{if(!o&&Math.abs...
class so (line 1) | class so extends io{constructor(s,t){super(s,t)}dataUpdated(){(this.isRe...
method constructor (line 1) | constructor(s,t){super(s,t)}
method dataUpdated (line 1) | dataUpdated(){(this.isReact||this.options.canvasZoom<=40)&&this._dataU...
method setOptions (line 1) | setOptions(s,t=!1){return C(this,null,function*(){if(this.disableNextL...
method setLayouter (line 1) | setLayouter(s){u("setLayouterClass::",s),this.userLayouerClass=s,this....
method switchLayout (line 1) | switchLayout(s,t=!0,o=!1){return C(this,null,function*(){this.emitEven...
method setJsonData (line 1) | setJsonData(s,t=!1){return C(this,null,function*(){this.options.canvas...
method appendJsonData (line 1) | appendJsonData(s,t=!0){return C(this,null,function*(){u("appendData:",...
class ao (line 1) | class ao extends so{constructor(t,o){super(t,o);v(this,"$easyViewCanvas"...
method constructor (line 1) | constructor(t,o){super(t,o);v(this,"$easyViewCanvas");v(this,"$evCanva...
method setEasyViewCanvas (line 1) | setEasyViewCanvas(t){this.$easyViewCanvas=t,this.$evCanvasCtx=this.$ea...
method startUpdateTask (line 1) | startUpdateTask(){this.updateEasyView(),requestAnimationFrame(this.sta...
method updateEasyView (line 1) | updateEasyView(){this.updateMiniView(),this.options.performanceMode&&(...
method _updateEasyView (line 1) | _updateEasyView(){try{this.easyViewUpdating=!0,this.evDosomethingBefor...
method evDosomethingBeforeDraw (line 1) | evDosomethingBeforeDraw(){const t=this.$easyViewCanvas.getBoundingClie...
method evDrawAllNodes (line 1) | evDrawAllNodes(){for(const t of this.getNodes())x.isAllowShowNode(t)&&...
method evDrawNode (line 1) | evDrawNode(t){(t.nodeShape!==void 0&&t.nodeShape!==null?t.nodeShape:th...
method getNodeColor (line 1) | getNodeColor(t){const o=t.color||this.options.defaultNodeColor||"red";...
method evDrawNode4Rect (line 1) | evDrawNode4Rect(t){const o=this.$evCanvasCtx,n=t.el.offsetWidth-16,i=t...
method evDrawNode4Circle (line 1) | evDrawNode4Circle(t){const o=this.$evCanvasCtx,n=t.el.offsetWidth-16,i...
method evDrawAllLines (line 1) | evDrawAllLines(){for(const t of this.getLinks())if(x.isAllowShowNode(t...
method evDrawLine (line 1) | evDrawLine(t,o,n){const i=this.$evCanvasCtx;this.easyViewOffset.x+t.fr...
method getPointValue (line 1) | getPointValue(t,o,n){return n?t+parseFloat(o):parseFloat(o)}
method evDrawSvgPathOnCanvas (line 1) | evDrawSvgPathOnCanvas(t,o){const n=o.match(/[a-zA-Z][^a-zA-Z]*/g);let ...
class ro (line 1) | class ro extends ao{constructor(){super(...arguments);v(this,"_onResizin...
method constructor (line 1) | constructor(){super(...arguments);v(this,"_onResizing");v(this,"_onRes...
method setEditingNodes (line 1) | setEditingNodes(t){this.options.editingController.nodes.forEach(o=>{o....
method addEditingNode (line 1) | addEditingNode(t){this.options.editingController.nodes.forEach(o=>{o.s...
method removeEditingNode (line 1) | removeEditingNode(t){this.options.editingController.nodes.forEach(o=>{...
method toggleEditingNode (line 1) | toggleEditingNode(t){this.options.editingController.nodes.forEach(o=>{...
method updateEditingControllerView (line 1) | updateEditingControllerView(){if(this.updateEditingLineView(),!this.op...
method _getEventPoint (line 1) | _getEventPoint(t){const o={x:t.clientX,y:t.clientY};if(tt(t)){const i=...
method onResizeStart (line 1) | onResizeStart(t,o){this._resizeType=t,this._startPoint=this._getEventP...
method onResizing (line 1) | onResizing(t){const o=this._getEventPoint(t),n=o.x-this._startPoint.x,...
method _applyResizeScale (line 1) | _applyResizeScale(t){const o=this.options.editingController.width/this...
method onResizeEnd (line 1) | onResizeEnd(t){const o=this._getEventPoint(t);o.x-this._startPoint.x,o...
method draggingSelectedNodes (line 1) | draggingSelectedNodes(t,o,n){if(!this.options.editingController.nodes....
method getNodesInSelectionView (line 1) | getNodesInSelectionView(t){const o=this.getBoundingClientRect(),n=this...
method updateEditingConnectControllerView (line 1) | updateEditingConnectControllerView(){const t=this.options.nodeConnectC...
method setEditingLine (line 1) | setEditingLine(t,o){this.options.editingLineController.link=o,this.opt...
method updateReferenceLineView (line 1) | updateReferenceLineView(t,o,n){if(!this.options.showReferenceLine)retu...
method updateEditingLineView (line 1) | updateEditingLineView(){if(this.updateElementLines(),!this.options.edi...
method getStartAndEndPoint (line 1) | getStartAndEndPoint(t){const o=t.match(/[a-zA-Z][^a-zA-Z]*/g);let n=0,...
method startMoveLineVertex (line 1) | startMoveLineVertex(t,o){o.stopPropagation();const n=this.options.edit...
method startCreateLineByTemplate (line 1) | startCreateLineByTemplate(t,o,n){n.stopPropagation();const i=this.opti...
method onLineVertexBeDropped (line 1) | onLineVertexBeDropped(t,o){o.stopPropagation();const n=this.options.no...
method startMoveLineText (line 1) | startMoveLineText(t){const o=this._getEventPoint(t),n=this.options.edi...
class lo (line 1) | class lo extends ro{constructor(t,o){super(t,o);v(this,"$miniViewCanvas"...
method constructor (line 1) | constructor(t,o){super(t,o);v(this,"$miniViewCanvas");v(this,"$mvCanva...
method setMiniViewCanvas (line 1) | setMiniViewCanvas(t){this.$miniViewCanvas=t,this.$mvCanvasCtx=this.$mi...
method updateMiniView (line 1) | updateMiniView(){!this.options.showMiniView||requestAnimationFrame(thi...
method _updateMiniView (line 1) | _updateMiniView(){try{this.miniViewUpdating=!0,this.mvDosomethingBefor...
method mvDosomethingBeforeDraw (line 1) | mvDosomethingBeforeDraw(){let t=9999999,o=9999999,n=-9999999,i=-999999...
method mvDrawMask (line 1) | mvDrawMask(){}
method mvDrawAllNodes (line 1) | mvDrawAllNodes(){for(const t of this.getNodes())x.isAllowShowNode(t)&&...
method mvDrawNode (line 1) | mvDrawNode(t){(t.nodeShape!==void 0&&t.nodeShape!==null?t.nodeShape:th...
method mvDrawNode4Rect (line 1) | mvDrawNode4Rect(t){const o=this.$mvCanvasCtx,n=t.el.offsetWidth-16,i=t...
method mvDrawNode4Circle (line 1) | mvDrawNode4Circle(t){const o=this.$mvCanvasCtx,n=t.el.offsetWidth-16,i...
method mvDrawAllLines (line 1) | mvDrawAllLines(){for(const t of this.getLinks())if(x.isAllowShowNode(t...
method mvDrawLine (line 1) | mvDrawLine(t,o,n){const i=this.$mvCanvasCtx,a=this.createLinePath(t,o,...
method mvDrawSvgPathOnCanvas (line 1) | mvDrawSvgPathOnCanvas(t,o){const n=o.match(/[a-zA-Z][^a-zA-Z]*/g);let ...
method onVisiableViewHandleDragStart (line 1) | onVisiableViewHandleDragStart(t){t.preventDefault(),t.stopPropagation(...
method resetByVisiableView (line 1) | resetByVisiableView(t){return C(this,null,function*(){!this.options.mi...
class Ht (line 1) | class Ht extends lo{constructor(s,t){super(s,t)}ready(){this.initLayoute...
method constructor (line 1) | constructor(s,t){super(s,t)}
method ready (line 1) | ready(){this.initLayouter(),this.resetViewSize(!0),this.refreshNVAnaly...
function G (line 1) | function G(e,s,t,o,n,i,a,l){var r=typeof e=="function"?e.options:e;s&&(r...
function fo (line 1) | function fo(e){for(let s in Wt)this[s]=Wt[s]}
method data (line 1) | data(){return{expanding:!1}}
method oldVersionSlot (line 1) | oldVersionSlot(){const e=this.$scopedSlots.node({node:this.nodeProps});r...
method expandButtonClass (line 1) | expandButtonClass(){return this.nodeProps.expanded===!1?"c-expanded":"c-...
method showExpandHolder (line 1) | showExpandHolder(){if(this.nodeProps.expandHolderPosition&&this.nodeProp...
method options (line 1) | options(){return this.graph.options}
method relationGraph (line 1) | relationGraph(){return this.graphInstance()}
method borderColor (line 1) | borderColor(){return this.nodeProps.borderColor||this.options.defaultNod...
method borderWidth (line 1) | borderWidth(){const e=this.nodeProps.borderWidth===void 0?this.options.d...
method nodeWidth (line 1) | nodeWidth(){if(this.nodeProps.width===0)return;const e=this.nodeProps.wi...
method nodeHeight (line 1) | nodeHeight(){if(this.nodeProps.height===0)return;const e=this.nodeProps....
method created (line 1) | created(){}
method mounted (line 1) | mounted(){this.refreshNodeProperties(),this.relationGraph.addNodeResizeL...
method beforeDestroy (line 1) | beforeDestroy(){this.relationGraph.removeNodeResizeListener(this.$refs.s...
method refreshNodeProperties (line 1) | refreshNodeProperties(){this.$refs.seeksRGNode.offsetWidth===0&&this.$re...
method expandOrCollapseNode (line 1) | expandOrCollapseNode(e){return C(this,null,function*(){u("expandOrCollap...
method onDragStart (line 1) | onDragStart(e){this.relationGraph.onNodeDragStart(this.nodeProps,e)}
method onclick (line 1) | onclick(e){this.relationGraph.onNodeClick(this.nodeProps,e)}
method isAllowShowNode (line 1) | isAllowShowNode(e){return x.isAllowShowNode(e)}
function vo (line 1) | function vo(e){for(let s in Ft)this[s]=Ft[s]}
method data (line 1) | data(){return{is_flashing:!1}}
method checked (line 1) | checked(){return this.relation.id===this.options.checkedLineId}
method options (line 1) | options(){return this.graph.options}
method lineWidth (line 1) | lineWidth(){return this.relation.lineWidth?this.relation.lineWidth:this....
method relationGraph (line 1) | relationGraph(){return this.graphInstance()}
method showStartArrow (line 1) | showStartArrow(){return this.relationGraph.getArrow(this.relation,this.l...
method showEndArrow (line 1) | showEndArrow(){return this.relationGraph.getArrow(this.relation,this.lin...
method pathData (line 1) | pathData(){try{const{path:e,textPosition:s}=this.relationGraph.createLin...
method textStyle (line 1) | textStyle(){return this.relationGraph.getLineTextStyle(this.link,this.re...
method onClick (line 1) | onClick(e,s){this.relationGraph.onLineClick(e,this.link,s)}
function Lo (line 1) | function Lo(e){for(let s in Ut)this[s]=Ut[s]}
method options (line 1) | options(){return this.graph.options}
method relationGraph (line 1) | relationGraph(){return this.graphInstance()}
method lineWidth (line 1) | lineWidth(){return this.relation.lineWidth?this.relation.lineWidth:this....
method lineColor (line 1) | lineColor(){return this.relation.color?this.relation.color:this.options....
method checked (line 1) | checked(){return this.relation.id===this.options.checkedLineId}
method textStyle (line 1) | textStyle(){return this.relationGraph.getLineTextStyle(this.link,this.re...
method pathRef (line 1) | pathRef(){return"#"+this.options.instanceId+"-"+this.relation.id}
method data (line 1) | data(){return{is_flashing:!1}}
method mounted (line 1) | mounted(){}
method onClick (line 1) | onClick(e,s){this.relationGraph.onLineClick(e,this.link,s)}
function Po (line 1) | function Po(e){for(let s in Xt)this[s]=Xt[s]}
method data (line 1) | data(){return{is_flashing:!1}}
method options (line 1) | options(){return this.graph.options}
method relationGraph (line 1) | relationGraph(){return this.graphInstance()}
method show (line 1) | show(){this.isShow=!0}
method mounted (line 1) | mounted(){}
method isAllowShowNode (line 1) | isAllowShowNode(e){return x.isAllowShowNode(e)}
function Do (line 1) | function Do(e){for(let s in Yt)this[s]=Yt[s]}
method checked (line 1) | checked(){return this.relation.id===this.options.checkedLineId}
method pathData (line 1) | pathData(){const{path:e,textPosition:s}=this.relationGraph.createLinePat...
method options (line 1) | options(){return this.graph.options}
method relationGraph (line 1) | relationGraph(){return this.graphInstance()}
method style (line 1) | style(){const e=this.relation.lineWidth!==void 0?this.relation.lineWidth...
method data (line 1) | data(){return{is_flashing:!1}}
method show (line 1) | show(){this.isShow=!0}
function To (line 1) | function To(e){for(let s in Jt)this[s]=Jt[s]}
method options (line 1) | options(){return this.graph.options}
method relationGraph (line 1) | relationGraph(){return this.graphInstance()}
method pathData (line 1) | pathData(){return this.relationGraph.createCheckedLinePath()}
method strokeWidth (line 1) | strokeWidth(){return this.relationGraph.createCheckedLineStrokeWidth()}
method data (line 1) | data(){return{is_flashing:!1}}
method show (line 1) | show(){this.isShow=!0}
function Fo (line 1) | function Fo(e){for(let s in qt)this[s]=qt[s]}
method data (line 1) | data(){return{}}
method options (line 1) | options(){return this.graph.options}
method relationGraph (line 1) | relationGraph(){return this.graphInstance()}
method allLineColors (line 1) | allLineColors(){return this.graph.allLineColors}
function Jo (line 1) | function Jo(e){for(let s in Kt)this[s]=Kt[s]}
method data (line 1) | data(){return{}}
method options (line 1) | options(){return this.graph.options}
method relationGraph (line 1) | relationGraph(){return this.graphInstance()}
method allLineColors (line 1) | allLineColors(){return this.graph.allLineColors}
method created (line 1) | created(){u("[RGGraph created]")}
method mounted (line 1) | mounted(){u("[RGGraph mounted]"),this.init()}
method beforeDestroy (line 1) | beforeDestroy(){}
method init (line 1) | init(){this.$refs.rgCanvas.style.setProperty("--stroke",`url('#${this.op...
function en (line 1) | function en(e){for(let s in Qt)this[s]=Qt[s]}
method data (line 1) | data(){return{}}
method options (line 1) | options(){return this.graph.options}
method relationGraph (line 1) | relationGraph(){return this.graphInstance()}
method allLineColors (line 1) | allLineColors(){return this.graph.allLineColors}
method created (line 1) | created(){u("[RGEasyView created]")}
method mounted (line 1) | mounted(){u("[RGEasyView mounted]"),this.relationGraph.setEasyViewCanvas...
method beforeDestroy (line 1) | beforeDestroy(){}
method init (line 1) | init(){}
function ln (line 1) | function ln(e){for(let s in te)this[s]=te[s]}
method data (line 1) | data(){return{}}
method options (line 1) | options(){return this.graph.options}
method relationGraph (line 1) | relationGraph(){return this.graphInstance()}
method canvasSizeAndPosition (line 1) | canvasSizeAndPosition(){return{width:`${this.options.canvasSize.width}px...
method created (line 1) | created(){u("[RGCanvas created]")}
method mounted (line 1) | mounted(){u("[RGCanvas mounted]"),this.relationGraph.setCanvasDom(this.$...
method beforeDestroy (line 1) | beforeDestroy(){}
method mouseListener (line 1) | mouseListener(e){this.relationGraph.onMouseWheel(e)}
method onDragStart (line 1) | onDragStart(e){this.relationGraph.onCanvasDragStart(e)}
method contextmenu (line 1) | contextmenu(e){this.relationGraph.onContextmenu(e)}
function pn (line 1) | function pn(e){for(let s in ee)this[s]=ee[s]}
method data (line 1) | data(){return{search_text:"",showSettingPanel:!1,currentLayoutName:""}}
method relationGraph (line 1) | relationGraph(){return this.graphInstance()}
method options (line 1) | options(){return this.graph.options}
method toggleSettingPanel (line 1) | toggleSettingPanel(){this.showSettingPanel=!this.showSettingPanel}
method printOptions (line 1) | printOptions(){this.relationGraph.printOptions()}
method printData (line 1) | printData(){this.relationGraph.printData()}
method enableDevlog (line 1) | enableDevlog(){this.relationGraph.enableDebugLog(!this.options.debug),u(...
function vn (line 1) | function vn(e){for(let s in oe)this[s]=oe[s]}
method data (line 1) | data(){return{viewWidth:100,viewHeight:0,minX:0,maxX:0,minY:0,maxY:0,zoo...
method relationGraph (line 1) | relationGraph(){return this.graphInstance()}
method options (line 1) | options(){return this.graph.options}
method mounted (line 1) | mounted(){}
method miniViewHeight (line 1) | miniViewHeight(){let e=9999,s=-9999,t=9999,o=-9999;for(let n=0;n<this.gr...
method getPositionData (line 1) | getPositionData(){const e=this.viewWidth/this.options.canvasNVInfo.width...
method isAllowShowNode (line 1) | isAllowShowNode(e){return x.isAllowShowNode(e)}
function kn (line 1) | function kn(e){for(let s in ne)this[s]=ne[s]}
method data (line 1) | data(){return{height:275,hits:0,downloadPanelWidth:106}}
method relationGraph (line 1) | relationGraph(){return this.graphInstance()}
method options (line 1) | options(){return this.graph.options}
method mounted (line 1) | mounted(){this.relationGraph.listeners.onDownloadExcel!==null&&(this.dow...
method refresh (line 1) | refresh(){this.relationGraph.refresh()}
method switchLayout (line 1) | switchLayout(e){u("change layout:",e),this.relationGraph.switchLayout(e)}
method toggleAutoLayout (line 1) | toggleAutoLayout(){this.relationGraph.toggleAutoLayout()}
method onDownloadExcel (line 1) | onDownloadExcel(){this.relationGraph.listeners.onDownloadExcel()}
method zoomToFit (line 1) | zoomToFit(){return C(this,null,function*(){yield this.relationGraph.setZ...
function $n (line 1) | function $n(e){for(let s in ie)this[s]=ie[s]}
method data (line 1) | data(){return{}}
method relationGraph (line 1) | relationGraph(){return this.graphInstance()}
method options (line 1) | options(){return this.graph.options}
method mounted (line 1) | mounted(){}
method refresh (line 1) | refresh(){this.relationGraph.refresh()}
method switchLayout (line 1) | switchLayout(e){u("change layout:",e),this.relationGraph.switchLayout(e)}
method toggleAutoLayout (line 1) | toggleAutoLayout(){this.relationGraph.toggleAutoLayout()}
method downloadAsImage (line 1) | downloadAsImage(){this.relationGraph.downloadAsImage("png")}
method zoomToFit (line 1) | zoomToFit(){return C(this,null,function*(){yield this.relationGraph.setZ...
function Gn (line 1) | function Gn(e){for(let s in se)this[s]=se[s]}
method relationGraph (line 1) | relationGraph(){return this.graphInstance()}
method options (line 1) | options(){return this.graph.options}
method mounted (line 1) | mounted(){}
function Hn (line 1) | function Hn(e){for(let s in re)this[s]=re[s]}
method data (line 1) | data(){return{}}
method relationGraph (line 1) | relationGraph(){return this.graphInstance()}
method options (line 1) | options(){return this.graph.options}
method clickGraphMask (line 1) | clickGraphMask(e){this.relationGraph.clickGraphMask(e)}
function Yn (line 1) | function Yn(e){for(let s in he)this[s]=he[s]}
method data (line 1) | data(){return{graphInstanceOK:!1,graphData:{rootNode:null,nodes:[],links...
method provide (line 1) | provide(){return{graphData:this.graphData,graph:this.graph,graphInstance...
method created (line 1) | created(){window&&(window.relationGraphDebug=this.options.debug),u("----...
method mounted (line 1) | mounted(){u("---------------------------graph mounted-------------------...
method beforeDestroy (line 1) | beforeDestroy(){u("beforeDestroy:relation-graph"),this.getRelationGraph(...
method updated (line 1) | updated(){u("---------------------------graph updated-------------------...
method getRelationGraph (line 1) | getRelationGraph(){return this.relationGraph}
method doFullscreen (line 1) | doFullscreen(){K("Method [$graphRef.doFullscreen()] has been deprecated....
method getInstance (line 1) | getInstance(){return this.getRelationGraph()}
method setOptions (line 1) | setOptions(e,s){return C(this,null,function*(){K("Method [$graphRef.remo...
method setJsonData (line 1) | setJsonData(o,n,i){return C(this,arguments,function*(e,s,t){return argum...
method appendJsonData (line 1) | appendJsonData(o,n,i){return C(this,arguments,function*(e,s,t){arguments...
method setLayouter (line 1) | setLayouter(e){K("Method [$graphRef.setLayouter()] has been deprecated. ...
method onGraphResize (line 1) | onGraphResize(){K("Method [$graphRef.onGraphResize()] has been deprecate...
method refresh (line 1) | refresh(){return C(this,null,function*(){K("Method [$graphRef.refresh()]...
method doLayout (line 1) | doLayout(){return C(this,null,function*(){K("Method [$graphRef.doLayout(...
method focusRootNode (line 1) | focusRootNode(){return C(this,null,function*(){K("Method [$graphRef.focu...
method focusNodeById (line 1) | focusNodeById(e){return C(this,null,function*(){return K("Method [$graph...
method getNodeById (line 1) | getNodeById(e){return K("Method [$graphRef.getNodeById()] has been depre...
method removeNodeById (line 1) | removeNodeById(e){return K("Method [$graphRef.removeNodeById()] has been...
method getNodes (line 1) | getNodes(){return K("Method [$graphRef.getNodes()] has been deprecated. ...
method getLinks (line 1) | getLinks(){return K("Method [$graphRef.getLinks()] has been deprecated. ...
method getGraphJsonData (line 1) | getGraphJsonData(){return K("Method [$graphRef.getGraphJsonData()] has b...
method getGraphJsonOptions (line 1) | getGraphJsonOptions(){return K("Method [$graphRef.getGraphJsonOptions()]...
function Qn (line 1) | function Qn(e){for(let s in ce)this[s]=ce[s]}
method data (line 1) | data(){return{}}
method relationGraph (line 1) | relationGraph(){return this.graphInstance()}
method options (line 1) | options(){return this.graph.options}
method mounted (line 1) | mounted(){}
method refresh (line 1) | refresh(){this.relationGraph.refresh()}
method switchLayout (line 1) | switchLayout(e){u("change layout:",e),this.relationGraph.switchLayout(e)}
method toggleAutoLayout (line 1) | toggleAutoLayout(){this.relationGraph.toggleAutoLayout()}
method downloadAsImage (line 1) | downloadAsImage(){this.relationGraph.downloadAsImage("png")}
method zoomToFit (line 1) | zoomToFit(){return C(this,null,function*(){yield this.relationGraph.setZ...
function ii (line 1) | function ii(e){for(let s in ue)this[s]=ue[s]}
method data (line 1) | data(){return{originBackgroundColor:"",originBackgroundImage:""}}
method relationGraph (line 1) | relationGraph(){return this.graphInstance()}
method options (line 1) | options(){return this.graph.options}
method show (line 1) | show(){let e=!1;return this.options.snapshotting?this.forImage===!1?e=!1...
method mounted (line 1) | mounted(){this.originBackgroundColor=this.options.backgroundColor,this.o...
method beforeDestroy (line 1) | beforeDestroy(){this.options.backgroundColor=this.originBackgroundColor,...
function ci (line 1) | function ci(e){for(let s in pe)this[s]=pe[s]}
method relationGraph (line 1) | relationGraph(){return this.graphInstance()}
method options (line 1) | options(){return this.graph.options}
method show (line 1) | show(){let e=!1;return this.options.snapshotting?this.forImage===!1?e=!1...
method mounted (line 1) | mounted(){this.$refs.watermarkRef.style.setProperty("--mv-width",this.wi...
method beforeDestroy (line 1) | beforeDestroy(){this.relationGraph.setWatermarkDom(null,this.forImage,th...
function _i (line 1) | function _i(e){for(let s in fe)this[s]=fe[s]}
method options (line 1) | options(){return this.graph.options}
method relationGraph (line 1) | relationGraph(){return this.graphInstance()}
method data (line 1) | data(){return{}}
method onMouseDown (line 1) | onMouseDown(e,s){s.stopPropagation(),this.relationGraph.onResizeStart(e,s)}
function Ci (line 1) | function Ci(e){for(let s in ge)this[s]=ge[s]}
method options (line 1) | options(){return this.graph.options}
method relationGraph (line 1) | relationGraph(){return this.graphInstance()}
method data (line 1) | data(){return{}}
method onMouseDown (line 1) | onMouseDown(e,s){s.stopPropagation(),this.relationGraph.onResizeStart(e,s)}
function Si (line 1) | function Si(e){for(let s in me)this[s]=me[s]}
method options (line 1) | options(){return this.graph.options}
method relationGraph (line 1) | relationGraph(){return this.graphInstance()}
method data (line 1) | data(){return{}}
method onMouseDown (line 1) | onMouseDown(e,s){this.relationGraph.startCreateLineByTemplate(e,this.lin...
function Oi (line 1) | function Oi(e){for(let s in ve)this[s]=ve[s]}
method options (line 1) | options(){return this.graph.options}
method relationGraph (line 1) | relationGraph(){return this.graphInstance()}
method data (line 1) | data(){return{}}
function Gi (line 1) | function Gi(e){for(let s in we)this[s]=we[s]}
method options (line 1) | options(){return this.graph.options}
method relationGraph (line 1) | relationGraph(){return this.graphInstance()}
method data (line 1) | data(){return{}}
method mounted (line 1) | mounted(){this.options.showMiniView=!0,this.$refs.rgMiniView.style.setPr...
method onMouseDown (line 1) | onMouseDown(e){this.relationGraph.onVisiableViewHandleDragStart(e)}
method onClickCanvas (line 1) | onClickCanvas(e){this.relationGraph.resetByVisiableView(e)}
method beforeDestroy (line 1) | beforeDestroy(){this.options.showMiniView=!1}
function Wi (line 1) | function Wi(e){for(let s in Ce)this[s]=Ce[s]}
method options (line 1) | options(){return this.graph.options}
method relationGraph (line 1) | relationGraph(){return this.graphInstance()}
method show (line 1) | show(){return this.options.editingLineController.show}
method text (line 1) | text(){return this.options.editingLineController.line&&this.options.edit...
method data (line 1) | data(){return{lineText:"",editing:!1}}
method show (line 1) | show(e){e||(this.editing=!1,this.lineText="")}
method text (line 1) | text(e){e&&(this.lineText=e,this.$nextTick(()=>{this.relationGraph.updat...
method onMouseDown (line 1) | onMouseDown(e,s){this.relationGraph.startMoveLineVertex(e,s)}
method startMoveText (line 1) | startMoveText(e){this.relationGraph.startMoveLineText(e)}
method startEditingLineText (line 1) | startEditingLineText(e){this.editing=!this.editing}
method onLineTextChange (line 1) | onLineTextChange(e){const s=this.options.editingLineController.line;s&&(...
function Zi (line 1) | function Zi(e){for(let s in be)this[s]=be[s]}
method options (line 1) | options(){return this.graph.options}
method relationGraph (line 1) | relationGraph(){return this.graphInstance()}
method data (line 1) | data(){return{}}
method onMouseUp (line 1) | onMouseUp(e,s){this.relationGraph.onLineVertexBeDropped(e,s)}
function es (line 1) | function es(e){for(let s in Le)this[s]=Le[s]}
method options (line 1) | options(){return this.graph.options}
method relationGraph (line 1) | relationGraph(){return this.graphInstance()}
method data (line 1) | data(){return{}}
function as (line 1) | function as(e){for(let s in Me)this[s]=Me[s]}
method options (line 1) | options(){return this.graph.options}
method relationGraph (line 1) | relationGraph(){return this.graphInstance()}
method data (line 1) | data(){return{}}
method mounted (line 1) | mounted(){this.options.showReferenceLine=!0}
method beforeDestroy (line 1) | beforeDestroy(){this.options.showReferenceLine=!1}
function us (line 1) | function us(e){for(let s in Se)this[s]=Se[s]}
FILE: src/GraphRag.Net.Web/wwwroot/js/vue2.js
function n (line 11) | function n(t){return null==t}
function r (line 11) | function r(t){return null!=t}
function o (line 11) | function o(t){return!0===t}
function i (line 11) | function i(t){return"string"==typeof t||"number"==typeof t||"symbol"==ty...
function a (line 11) | function a(t){return"function"==typeof t}
function s (line 11) | function s(t){return null!==t&&"object"==typeof t}
function u (line 11) | function u(t){return"[object Object]"===c.call(t)}
function l (line 11) | function l(t){var e=parseFloat(String(t));return e>=0&&Math.floor(e)===e...
function f (line 11) | function f(t){return r(t)&&"function"==typeof t.then&&"function"==typeof...
function d (line 11) | function d(t){return null==t?"":Array.isArray(t)||u(t)&&t.toString===c?J...
function p (line 11) | function p(t,e){return e&&e.__v_isRef?e.value:e}
function v (line 11) | function v(t){var e=parseFloat(t);return isNaN(e)?t:e}
function h (line 11) | function h(t,e){for(var n=Object.create(null),r=t.split(","),o=0;o<r.len...
function y (line 11) | function y(t,e){var n=t.length;if(n){if(e===t[n-1])return void(t.length=...
function b (line 11) | function b(t,e){return _.call(t,e)}
function $ (line 11) | function $(t){var e=Object.create(null);return function(n){return e[n]||...
function n (line 11) | function n(n){var r=arguments.length;return r?r>1?t.apply(e,arguments):t...
function T (line 11) | function T(t,e){e=e||0;for(var n=t.length-e,r=new Array(n);n--;)r[n]=t[n...
function A (line 11) | function A(t,e){for(var n in e)t[n]=e[n];return t}
function j (line 11) | function j(t){for(var e={},n=0;n<t.length;n++)t[n]&&A(e,t[n]);return e}
function E (line 11) | function E(t,e,n){}
function D (line 11) | function D(t,e){if(t===e)return!0;var n=s(t),r=s(e);if(!n||!r)return!n&&...
function M (line 11) | function M(t,e){for(var n=0;n<t.length;n++)if(D(t[n],e))return n;return-1}
function I (line 11) | function I(t){var e=!1;return function(){e||(e=!0,t.apply(this,arguments...
function L (line 11) | function L(t,e){return t===e?0===t&&1/t!=1/e:t==t||e==e}
function z (line 11) | function z(t){var e=(t+"").charCodeAt(0);return 36===e||95===e}
function V (line 11) | function V(t,e,n,r){Object.defineProperty(t,e,{value:n,enumerable:!!r,wr...
function at (line 11) | function at(t){return"function"==typeof t&&/native code/.test(t.toString...
function t (line 11) | function t(){this.set=Object.create(null)}
function lt (line 11) | function lt(t){void 0===t&&(t=null),t||ut&&ut._scope.off(),ut=t,t&&t._sc...
function t (line 11) | function t(t,e,n,r,o,i,a,s){this.tag=t,this.data=e,this.children=n,this....
function pt (line 11) | function pt(t){return new ft(void 0,void 0,void 0,String(t))}
function vt (line 11) | function vt(t){var e=new ft(t.tag,t.data,t.children&&t.children.slice(),...
function t (line 11) | function t(){this._pending=!1,this.id=ht++,this.subs=[]}
function bt (line 11) | function bt(t){_t.push(t),yt.target=t}
function $t (line 11) | function $t(){_t.pop(),yt.target=_t[_t.length-1]}
function Ot (line 11) | function Ot(t){St=t}
function t (line 11) | function t(t,n,r){if(void 0===n&&(n=!1),void 0===r&&(r=!1),this.value=t,...
function jt (line 11) | function jt(t,n,r){return t&&b(t,"__ob__")&&t.__ob__ instanceof At?t.__o...
function Et (line 11) | function Et(t,n,r,o,i,a,s){void 0===s&&(s=!1);var c=new yt,u=Object.getO...
function Nt (line 11) | function Nt(t,n,r){if(!Ft(t)){var o=t.__ob__;return e(t)&&l(n)?(t.length...
function Pt (line 11) | function Pt(t,n){if(e(t)&&l(n))t.splice(n,1);else{var r=t.__ob__;t._isVu...
function Dt (line 11) | function Dt(t){for(var n=void 0,r=0,o=t.length;r<o;r++)(n=t[r])&&n.__ob_...
function Mt (line 11) | function Mt(t){return It(t,!0),V(t,"__v_isShallow",!0),t}
function It (line 11) | function It(t,e){Ft(t)||jt(t,e,ot())}
function Lt (line 11) | function Lt(t){return Ft(t)?Lt(t.__v_raw):!(!t||!t.__ob__)}
function Rt (line 11) | function Rt(t){return!(!t||!t.__v_isShallow)}
function Ft (line 11) | function Ft(t){return!(!t||!t.__v_isReadonly)}
function Bt (line 11) | function Bt(t){return!(!t||!0!==t.__v_isRef)}
function Ut (line 11) | function Ut(t,e){if(Bt(t))return t;var n={};return V(n,Ht,!0),V(n,"__v_i...
function zt (line 11) | function zt(t,e,n){Object.defineProperty(t,n,{enumerable:!0,configurable...
function Vt (line 11) | function Vt(t,e,n){var r=t[e];if(Bt(r))return r;var o={get value(){var r...
function qt (line 11) | function qt(t){return Wt(t,!1)}
function Wt (line 11) | function Wt(t,e){if(!u(t))return t;if(Ft(t))return t;var n=e?Jt:Kt,r=t[n...
function Zt (line 11) | function Zt(t,e,n,r){Object.defineProperty(t,n,{enumerable:!0,configurab...
function Xt (line 11) | function Xt(t,n){function r(){var t=r.fns;if(!e(t))return _n(t,null,argu...
function Yt (line 11) | function Yt(t,e,r,i,a,s){var c,u,l,f;for(c in t)u=t[c],l=e[c],f=Gt(c),n(...
function Qt (line 11) | function Qt(t,e,i){var a;t instanceof ft&&(t=t.data.hook||(t.data.hook={...
function te (line 11) | function te(t,e,n,o,i){if(r(e)){if(b(e,n))return t[n]=e[n],i||delete e[n...
function ee (line 11) | function ee(t){return i(t)?[pt(t)]:e(t)?re(t):void 0}
function ne (line 11) | function ne(t){return r(t)&&r(t.text)&&!1===t.isComment}
function re (line 11) | function re(t,a){var s,c,u,l,f=[];for(s=0;s<t.length;s++)n(c=t[s])||"boo...
function ae (line 11) | function ae(t,n,c,u,l,f){return(e(c)||i(c))&&(l=u,u=c,c=void 0),o(f)&&(l...
function se (line 11) | function se(t,e,i){if(t.ns=e,"foreignObject"===t.tag&&(e=void 0,i=!0),r(...
function ce (line 11) | function ce(t,n){var o,i,a,c,u=null;if(e(t)||"string"==typeof t)for(u=ne...
function ue (line 11) | function ue(t,e,n,r){var o,i=this.$scopedSlots[t];i?(n=n||{},r&&(n=A(A({...
function le (line 11) | function le(t){return kr(this.$options,"filters",t)||P}
function fe (line 11) | function fe(t,n){return e(t)?-1===t.indexOf(n):t!==n}
function de (line 11) | function de(t,e,n,r,o){var i=B.keyCodes[e]||n;return o&&r&&!B.keyCodes[e...
function pe (line 11) | function pe(t,n,r,o,i){if(r)if(s(r)){e(r)&&(r=j(r));var a=void 0,c=funct...
function ve (line 11) | function ve(t,e){var n=this._staticTrees||(this._staticTrees=[]),r=n[t];...
function he (line 11) | function he(t,e,n){return me(t,"__once__".concat(e).concat(n?"_".concat(...
function me (line 11) | function me(t,n,r){if(e(t))for(var o=0;o<t.length;o++)t[o]&&"string"!=ty...
function ge (line 11) | function ge(t,e,n){t.isStatic=!0,t.key=e,t.isOnce=n}
function ye (line 11) | function ye(t,e){if(e)if(u(e)){var n=t.on=t.on?A({},t.on):{};for(var r i...
function _e (line 11) | function _e(t,n,r,o){n=n||{$stable:!r};for(var i=0;i<t.length;i++){var a...
function be (line 11) | function be(t,e){for(var n=0;n<e.length;n+=2){var r=e[n];"string"==typeo...
function $e (line 11) | function $e(t,e){return"string"==typeof t?e+t:t}
function we (line 11) | function we(t){t._o=he,t._n=v,t._s=d,t._l=ce,t._t=ue,t._q=D,t._i=M,t._m=...
function xe (line 11) | function xe(t,e){if(!t||!t.length)return{};for(var n={},r=0,o=t.length;r...
function Ce (line 11) | function Ce(t){return t.isComment&&!t.asyncFactory||" "===t.text}
function ke (line 11) | function ke(t){return t.isComment&&t.asyncFactory}
function Se (line 11) | function Se(e,n,r,o){var i,a=Object.keys(r).length>0,s=n?!!n.$stable:!a,...
function Oe (line 11) | function Oe(t,n,r,o){var i=function(){var n=ut;lt(t);var r=arguments.len...
function Te (line 11) | function Te(t,e){return function(){return t[e]}}
function Ae (line 11) | function Ae(e){return{get attrs(){if(!e._attrsProxy){var n=e._attrsProxy...
function je (line 11) | function je(t,e,n,r,o){var i=!1;for(var a in e)a in t?e[a]!==n[a]&&(i=!0...
function Ee (line 11) | function Ee(t,e,n,r){Object.defineProperty(t,e,{enumerable:!0,configurab...
function Ne (line 11) | function Ne(t,e){for(var n in e)t[n]=e[n];for(var n in t)n in e||delete ...
function Pe (line 11) | function Pe(){var t=ut;return t._setupContext||(t._setupContext=Ae(t))}
function Le (line 11) | function Le(t,e){return(t.__esModule||ct&&"Module"===t[Symbol.toStringTa...
function Re (line 11) | function Re(t){if(e(t))for(var n=0;n<t.length;n++){var o=t[n];if(r(o)&&(...
function Fe (line 11) | function Fe(t,e){De.$on(t,e)}
function He (line 11) | function He(t,e){De.$off(t,e)}
function Be (line 11) | function Be(t,e){var n=De;return function r(){null!==e.apply(null,argume...
function Ue (line 11) | function Ue(t,e,n){De=t,Yt(e,n||{},Fe,He,Be,t),De=void 0}
function t (line 11) | function t(t){void 0===t&&(t=!1),this.detached=t,this.active=!0,this.eff...
function Ve (line 11) | function Ve(){return Me}
function Je (line 11) | function Je(t){var e=Ke;return Ke=t,function(){Ke=e}}
function qe (line 11) | function qe(t){for(;t&&(t=t.$parent);)if(t._inactive)return!0;return!1}
function We (line 11) | function We(t,e){if(e){if(t._directInactive=!1,qe(t))return}else if(t._d...
function Ze (line 11) | function Ze(t,e){if(!(e&&(t._directInactive=!0,qe(t))||t._inactive)){t._...
function Ge (line 11) | function Ge(t,e,n,r){void 0===r&&(r=!0),bt();var o=ut,i=Ve();r&<(t);va...
function cn (line 11) | function cn(){var t,e;for(rn=on(),en=!0,Xe.sort(sn),nn=0;nn<Xe.length;nn...
function un (line 11) | function un(t){var e=t.id;if(null==Qe[e]&&(t!==yt.target||!t.noRecurse))...
function vn (line 11) | function vn(t,e){return mn(t,null,{flush:"post"})}
function mn (line 11) | function mn(n,r,o){var i=void 0===o?t:o,s=i.immediate,c=i.deep,u=i.flush...
function gn (line 11) | function gn(t){var e=t._provided,n=t.$parent&&t.$parent._provided;return...
function yn (line 11) | function yn(t,e,n){bt();try{if(e)for(var r=e;r=r.$parent;){var o=r.$opti...
function _n (line 11) | function _n(t,e,n,r,o){var i;try{(i=n?t.apply(e,n):t.call(e))&&!i._isVue...
function bn (line 11) | function bn(t,e,n){if(B.errorHandler)try{return B.errorHandler.call(null...
function $n (line 11) | function $n(t,e,n){if(!q||"undefined"==typeof console)throw t;console.er...
function Sn (line 11) | function Sn(){kn=!1;var t=Cn.slice(0);Cn.length=0;for(var e=0;e<t.length...
function En (line 11) | function En(t,e){var n;if(Cn.push((function(){if(t)try{t.call(e)}catch(t...
function Nn (line 11) | function Nn(t){return function(e,n){if(void 0===n&&(n=ut),n)return funct...
method value (line 11) | get value(){return r()}
method value (line 11) | set value(t){o(t)}
method value (line 11) | get value(){return i?(i.dirty&&i.evaluate(),yt.target&&i.depend(),i.valu...
method value (line 11) | set value(t){r(t)}
function Wn (line 11) | function Wn(t){return Zn(t,qn),qn.clear(),t}
function Zn (line 11) | function Zn(t,n){var r,o,i=e(t);if(!(!i&&!s(t)||t.__v_skip||Object.isFro...
function t (line 11) | function t(t,e,n,r,o){!function(t,e){void 0===e&&(e=Me),e&&e.active&&e.e...
function Qn (line 11) | function Qn(t,e,n){Yn.get=function(){return this[e][n]},Yn.set=function(...
function tr (line 11) | function tr(t){var n=t.$options;if(n.props&&function(t,e){var n=t.$optio...
function nr (line 11) | function nr(t,e,n){var r=!ot();a(n)?(Yn.get=r?rr(e):or(n),Yn.set=E):(Yn....
function rr (line 11) | function rr(t){return function(){var e=this._computedWatchers&&this._com...
function or (line 11) | function or(t){return function(){return t.call(this,this)}}
function ir (line 11) | function ir(t,e,n,r){return u(n)&&(r=n,n=n.handler),"string"==typeof n&&...
function ar (line 11) | function ar(t,e){if(t){for(var n=Object.create(null),r=ct?Reflect.ownKey...
function cr (line 11) | function cr(t){var e=t.options;if(t.super){var n=cr(t.super);if(n!==t.su...
function ur (line 11) | function ur(n,r,i,a,s){var c,u=this,l=s.options;b(a,"_uid")?(c=Object.cr...
function lr (line 11) | function lr(t,e,n,r,o){var i=vt(t);return i.fnContext=n,i.fnOptions=r,e....
function fr (line 11) | function fr(t,e){for(var n in e)t[x(n)]=e[n]}
function dr (line 11) | function dr(t){return t.name||t.__name||t._componentTag}
function hr (line 11) | function hr(i,a,c,u,l){if(!n(i)){var d=c.$options._base;if(s(i)&&(i=d.ex...
function mr (line 11) | function mr(t,e){var n=function(n,r){t(n,r),e(n,r)};return n._merged=!0,n}
function _r (line 11) | function _r(t,e,n){if(void 0===n&&(n=!0),!e)return t;for(var r,o,i,a=ct?...
function br (line 11) | function br(t,e,n){return n?function(){var r=a(e)?e.call(n,n):e,o=a(t)?t...
function $r (line 11) | function $r(t,n){var r=n?t?t.concat(n):e(n)?n:[n]:t;return r?function(t)...
function wr (line 11) | function wr(t,e,n,r){var o=Object.create(t||null);return e?A(o,e):o}
function Cr (line 11) | function Cr(t,n,r){if(a(n)&&(n=n.options),function(t,n){var r=t.props;if...
function kr (line 11) | function kr(t,e,n,r){if("string"==typeof n){var o=t[e];if(b(o,n))return ...
function Sr (line 11) | function Sr(t,e,n,r){var o=e[t],i=!b(n,t),s=n[t],c=jr(Boolean,o.type);if...
function Tr (line 11) | function Tr(t){var e=t&&t.toString().match(Or);return e?e[1]:""}
function Ar (line 11) | function Ar(t,e){return Tr(t)===Tr(e)}
function jr (line 11) | function jr(t,n){if(!e(n))return Ar(n,t)?0:-1;for(var r=0,o=n.length;r<o...
function Er (line 11) | function Er(t){this._init(t)}
function Nr (line 11) | function Nr(t){t.cid=0;var e=1;t.extend=function(t){t=t||{};var n=this,r...
function Pr (line 11) | function Pr(t){return t&&(dr(t.Ctor.options)||t.tag)}
function Dr (line 11) | function Dr(t,n){return e(t)?t.indexOf(n)>-1:"string"==typeof t?t.split(...
function Mr (line 11) | function Mr(t,e){var n=t.cache,r=t.keys,o=t._vnode,i=t.$vnode;for(var a ...
function Ir (line 11) | function Ir(t,e,n,r){var o=t[e];!o||r&&o.tag===r.tag||o.componentInstanc...
function r (line 11) | function r(){n.$off(t,r),e.apply(n,arguments)}
function Xr (line 11) | function Xr(t){for(var e=t.data,n=t,o=t;r(o.componentInstance);)(o=o.com...
function Yr (line 11) | function Yr(t,e){return{staticClass:Qr(t.staticClass,e.staticClass),clas...
function Qr (line 11) | function Qr(t,e){return t?e?t+" "+e:t:e||""}
function to (line 11) | function to(t){return Array.isArray(t)?function(t){for(var e,n="",o=0,i=...
function io (line 11) | function io(t){return ro(t)?"svg":"math"===t?"math":void 0}
function co (line 11) | function co(t){if("string"==typeof t){var e=document.querySelector(t);re...
function fo (line 11) | function fo(t,n){var o=t.data.ref;if(r(o)){var i=t.context,s=t.component...
function po (line 11) | function po(t,e,n){var r=t._setupState;r&&b(r,e)&&(Bt(r[e])?r[e].value=n...
function mo (line 11) | function mo(t,e){return t.key===e.key&&t.asyncFactory===e.asyncFactory&&...
function go (line 11) | function go(t,e,n){var o,i,a={};for(o=e;o<=n;++o)r(i=t[o].key)&&(a[i]=o)...
function _o (line 11) | function _o(t,e){(t.data.directives||e.data.directives)&&function(t,e){v...
function $o (line 11) | function $o(t,e){var n,r,o=Object.create(null);if(!t)return o;for(n=0;n<...
function wo (line 11) | function wo(t){return t.rawName||"".concat(t.name,".").concat(Object.key...
function xo (line 11) | function xo(t,e,n,r,o){var i=t.def&&t.def[e];if(i)try{i(n.elm,t,n,r,o)}c...
function ko (line 11) | function ko(t,e){var i=e.componentOptions;if(!(r(i)&&!1===i.Ctor.options...
function So (line 11) | function So(t,e,n,r){r||t.tagName.indexOf("-")>-1?Oo(t,e,n):Jr(e)?Gr(n)?...
function Oo (line 11) | function Oo(t,e,n){if(Gr(n))t.removeAttribute(e);else{if(Z&&!G&&"TEXTARE...
function Ao (line 11) | function Ao(t,e){var o=e.elm,i=e.data,a=t.data;if(!(n(i.staticClass)&&n(...
function Ro (line 11) | function Ro(t){var e,n,r,o,i,a=!1,s=!1,c=!1,u=!1,l=0,f=0,d=0,p=0;for(r=0...
function Fo (line 11) | function Fo(t,e){var n=e.indexOf("(");if(n<0)return'_f("'.concat(e,'")('...
function Ho (line 11) | function Ho(t,e){console.error("[Vue compiler]: ".concat(t))}
function Bo (line 11) | function Bo(t,e){return t?t.map((function(t){return t[e]})).filter((func...
function Uo (line 11) | function Uo(t,e,n,r,o){(t.props||(t.props=[])).push(Xo({name:e,value:n,d...
function zo (line 11) | function zo(t,e,n,r,o){(o?t.dynamicAttrs||(t.dynamicAttrs=[]):t.attrs||(...
function Vo (line 11) | function Vo(t,e,n,r){t.attrsMap[e]=n,t.attrsList.push(Xo({name:e,value:n...
function Ko (line 11) | function Ko(t,e,n,r,o,i,a,s){(t.directives||(t.directives=[])).push(Xo({...
function Jo (line 11) | function Jo(t,e,n){return n?"_p(".concat(e,',"').concat(t,'")'):t+e}
function qo (line 11) | function qo(e,n,r,o,i,a,s,c){var u;(o=o||t).right?c?n="(".concat(n,")===...
function Wo (line 11) | function Wo(t,e,n){var r=Zo(t,":"+e)||Zo(t,"v-bind:"+e);if(null!=r)retur...
function Zo (line 11) | function Zo(t,e,n){var r;if(null!=(r=t.attrsMap[e]))for(var o=t.attrsLis...
function Go (line 11) | function Go(t,e){for(var n=t.attrsList,r=0,o=n.length;r<o;r++){var i=n[r...
function Xo (line 11) | function Xo(t,e){return e&&(null!=e.start&&(t.start=e.start),null!=e.end...
function Yo (line 11) | function Yo(t,e,n){var r=n||{},o=r.number,i="$$v",a=i;r.trim&&(a="(typeo...
function Qo (line 11) | function Qo(t,e){var n=function(t){if(t=t.trim(),jo=t.length,t.indexOf("...
function ti (line 11) | function ti(){return Eo.charCodeAt(++Po)}
function ei (line 11) | function ei(){return Po>=jo}
function ni (line 11) | function ni(t){return 34===t||39===t}
function ri (line 11) | function ri(t){var e=1;for(Do=Po;!ei();)if(ni(t=ti()))oi(t);else if(91==...
function oi (line 11) | function oi(t){for(var e=t;!ei()&&(t=ti())!==e;);}
function ci (line 11) | function ci(t,e,n){var r=ii;return function o(){null!==e.apply(null,argu...
function li (line 11) | function li(t,e,n,r){if(ui){var o=rn,i=e;e=i._wrapper=function(t){if(t.t...
function fi (line 11) | function fi(t,e,n,r){(r||ii).removeEventListener(t,e._wrapper||e,n)}
function di (line 11) | function di(t,e){if(!n(t.data.on)||!n(e.data.on)){var o=e.data.on||{},i=...
function hi (line 11) | function hi(t,e){if(!n(t.data.domProps)||!n(e.data.domProps)){var i,a,s=...
function mi (line 11) | function mi(t,e){return!t.composing&&("OPTION"===t.tagName||function(t,e...
function _i (line 11) | function _i(t){var e=bi(t.style);return t.staticStyle?A(t.staticStyle,e):e}
function bi (line 11) | function bi(t){return Array.isArray(t)?j(t):"string"==typeof t?yi(t):t}
function Oi (line 11) | function Oi(t,e){var o=e.data,i=t.data;if(!(n(o.staticStyle)&&n(o.style)...
function ji (line 11) | function ji(t,e){if(e&&(e=e.trim()))if(t.classList)e.indexOf(" ")>-1?e.s...
function Ei (line 11) | function Ei(t,e){if(e&&(e=e.trim()))if(t.classList)e.indexOf(" ")>-1?e.s...
function Ni (line 11) | function Ni(t){if(t){if("object"==typeof t){var e={};return!1!==t.css&&A...
function Ui (line 11) | function Ui(t){Bi((function(){Bi(t)}))}
function zi (line 11) | function zi(t,e){var n=t._transitionClasses||(t._transitionClasses=[]);n...
function Vi (line 11) | function Vi(t,e){t._transitionClasses&&y(t._transitionClasses,e),Ei(t,e)}
function Ki (line 11) | function Ki(t,e,n){var r=qi(t,e),o=r.type,i=r.timeout,a=r.propCount;if(!...
function qi (line 11) | function qi(t,e){var n,r=window.getComputedStyle(t),o=(r[Li+"Delay"]||""...
function Wi (line 11) | function Wi(t,e){for(;t.length<e.length;)t=t.concat(t);return Math.max.a...
function Zi (line 11) | function Zi(t){return 1e3*Number(t.slice(0,-1).replace(",","."))}
function Gi (line 11) | function Gi(t,e){var o=t.elm;r(o._leaveCb)&&(o._leaveCb.cancelled=!0,o._...
function Xi (line 11) | function Xi(t,e){var o=t.elm;r(o._enterCb)&&(o._enterCb.cancelled=!0,o._...
function Yi (line 11) | function Yi(t){return"number"==typeof t&&!isNaN(t)}
function Qi (line 11) | function Qi(t){if(n(t))return!1;var e=t.fns;return r(e)?Qi(Array.isArray...
function ta (line 11) | function ta(t,e){!0!==e.data.show&&Gi(e)}
function f (line 11) | function f(t){var e=l.parentNode(t);r(e)&&l.removeChild(e,t)}
function d (line 11) | function d(t,e,n,i,a,s,u){if(r(t.elm)&&r(s)&&(t=s[u]=vt(t)),t.isRootInse...
function p (line 11) | function p(t,e){r(t.data.pendingInsert)&&(e.push.apply(e,t.data.pendingI...
function v (line 11) | function v(t,e,n){r(t)&&(r(n)?l.parentNode(n)===t&&l.insertBefore(t,e,n)...
function m (line 11) | function m(t,n,r){if(e(n))for(var o=0;o<n.length;++o)d(n[o],r,t.elm,null...
function g (line 11) | function g(t){for(;t.componentInstance;)t=t.componentInstance._vnode;ret...
function y (line 11) | function y(t,e){for(var n=0;n<c.create.length;++n)c.create[n](vo,t);r(a=...
function _ (line 11) | function _(t){var e;if(r(e=t.fnScopeId))l.setStyleScope(t.elm,e);else fo...
function b (line 11) | function b(t,e,n,r,o,i){for(;r<=o;++r)d(n[r],i,t,e,!1,n,r)}
function $ (line 11) | function $(t){var e,n,o=t.data;if(r(o))for(r(e=o.hook)&&r(e=e.destroy)&&...
function w (line 11) | function w(t,e,n){for(;e<=n;++e){var o=t[e];r(o)&&(r(o.tag)?(x(o),$(o)):...
function x (line 11) | function x(t,e){if(r(e)||r(t.data)){var n,o=c.remove.length+1;for(r(e)?e...
function C (line 11) | function C(t,e,n,o){for(var i=n;i<o;i++){var a=e[i];if(r(a)&&mo(t,a))ret...
function k (line 11) | function k(t,e,i,a,s,u){if(t!==e){r(e.elm)&&r(a)&&(e=a[s]=vt(e));var f=e...
function S (line 11) | function S(t,e,n){if(o(n)&&r(t.parent))t.parent.data.pendingInsert=e;els...
function T (line 11) | function T(t,e,n,i){var a,s=e.tag,c=e.data,u=e.children;if(i=i||c&&c.pre...
function ra (line 11) | function ra(t,e,n){oa(t,e),(Z||X)&&setTimeout((function(){oa(t,e)}),0)}
function oa (line 11) | function oa(t,e,n){var r=e.value,o=t.multiple;if(!o||Array.isArray(r)){f...
function ia (line 11) | function ia(t,e){return e.every((function(e){return!D(e,t)}))}
function aa (line 11) | function aa(t){return"_value"in t?t._value:t.value}
function sa (line 11) | function sa(t){t.target.composing=!0}
function ca (line 11) | function ca(t){t.target.composing&&(t.target.composing=!1,ua(t.target,"i...
function ua (line 11) | function ua(t,e){var n=document.createEvent("HTMLEvents");n.initEvent(e,...
function la (line 11) | function la(t){return!t.componentInstance||t.data&&t.data.transition?t:l...
function va (line 11) | function va(t){var e=t&&t.componentOptions;return e&&e.Ctor.options.abst...
function ha (line 11) | function ha(t){var e={},n=t.$options;for(var r in n.propsData)e[r]=t[r];...
function ma (line 11) | function ma(t,e){if(/\d-keep-alive$/.test(e.tag))return t("keep-alive",{...
function wa (line 11) | function wa(t){t.elm._moveCb&&t.elm._moveCb(),t.elm._enterCb&&t.elm._ent...
function xa (line 11) | function xa(t){t.data.newPos=t.elm.getBoundingClientRect()}
function Ca (line 11) | function Ca(t){var e=t.data.pos,n=t.data.newPos,r=e.left-n.left,o=e.top-...
function Qa (line 11) | function Qa(t,e){var n=e?Ga:Za;return t.replace(n,(function(t){return Wa...
function ts (line 11) | function ts(t,e){for(var n,r,o=[],i=e.expectHTML,a=e.isUnaryTag||N,s=e.c...
function xs (line 11) | function xs(t,e,n){return{type:1,tag:t,attrsList:e,attrsMap:js(e),rawAtt...
function Cs (line 11) | function Cs(t,e){es=e.warn||Ho,as=e.isPreTag||N,ss=e.mustUseProp||N,cs=e...
function ks (line 11) | function ks(t,e){var n,r;(r=Wo(n=t,"key"))&&(n.key=r),t.plain=!t.key&&!t...
function Ss (line 11) | function Ss(t){var e;if(e=Zo(t,"v-for")){var n=function(t){var e=t.match...
function Os (line 11) | function Os(t,e){t.ifConditions||(t.ifConditions=[]),t.ifConditions.push...
function Ts (line 11) | function Ts(t){var e=t.name.replace(ys,"");return e||"#"!==t.name[0]&&(e...
function As (line 11) | function As(t){var e=t.match(gs);if(e){var n={};return e.forEach((functi...
function js (line 11) | function js(t){for(var e={},n=0,r=t.length;n<r;n++)e[t[n].name]=t[n].val...
function Ps (line 11) | function Ps(t){return xs(t.tag,t.attrsList.slice(),t.parent)}
function Hs (line 11) | function Hs(t,e){t&&(Ms=Fs(e.staticKeys||""),Is=e.isReservedTag||N,Bs(t)...
function Bs (line 11) | function Bs(t){if(t.static=function(t){if(2===t.type)return!1;if(3===t.t...
function Us (line 11) | function Us(t,e){if(1===t.type){if((t.static||t.once)&&(t.staticInFor=e)...
function Gs (line 11) | function Gs(t,e){var n=e?"nativeOn:":"on:",r="",o="";for(var i in t){var...
function Xs (line 11) | function Xs(t){if(!t)return"function(){}";if(Array.isArray(t))return"["....
function Ys (line 11) | function Ys(t){var e=parseInt(t,10);if(e)return"$event.keyCode!==".conca...
function ec (line 11) | function ec(t,e){var n=new tc(e),r=t?"script"===t.tag?"null":nc(t,n):'_c...
function nc (line 11) | function nc(t,e){if(t.parent&&(t.pre=t.pre||t.parent.pre),t.staticRoot&&...
function rc (line 11) | function rc(t,e){t.staticProcessed=!0;var n=e.pre;return t.pre&&(e.pre=t...
function oc (line 11) | function oc(t,e){if(t.onceProcessed=!0,t.if&&!t.ifProcessed)return ic(t,...
function ic (line 11) | function ic(t,e,n,r){return t.ifProcessed=!0,ac(t.ifConditions.slice(),e...
function ac (line 11) | function ac(t,e,n,r){if(!t.length)return r||"_e()";var o=t.shift();retur...
function sc (line 11) | function sc(t,e,n,r){var o=t.for,i=t.alias,a=t.iterator1?",".concat(t.it...
function cc (line 11) | function cc(t,e){var n="{",r=function(t,e){var n=t.directives;if(!n)retu...
function uc (line 11) | function uc(t){return 1===t.type&&("slot"===t.tag||t.children.some(uc))}
function lc (line 11) | function lc(t,e){var n=t.attrsMap["slot-scope"];if(t.if&&!t.ifProcessed&...
function fc (line 11) | function fc(t,e,n,r,o){var i=t.children;if(i.length){var a=i[0];if(1===i...
function dc (line 11) | function dc(t){return void 0!==t.for||"template"===t.tag||"slot"===t.tag}
function pc (line 11) | function pc(t,e){return 1===t.type?nc(t,e):3===t.type&&t.isComment?funct...
function vc (line 11) | function vc(t){for(var e="",n="",r=0;r<t.length;r++){var o=t[r],i=hc(o.v...
function hc (line 11) | function hc(t){return t.replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"...
function mc (line 11) | function mc(t,e){try{return new Function(t)}catch(n){return e.push({err:...
function gc (line 11) | function gc(t){var e=Object.create(null);return function(n,r,o){(r=A({},...
function e (line 11) | function e(e,n){var r=Object.create(t),o=[],i=[];if(n)for(var a in n.mod...
function wc (line 11) | function wc(t){return(_c=_c||document.createElement("div")).innerHTML=t?...
FILE: src/GraphRag.Net/Common/Options/GraphDBConnectionOption.cs
class GraphDBConnectionOption (line 3) | public class GraphDBConnectionOption
FILE: src/GraphRag.Net/Common/Options/GraphOpenAIOption.cs
class GraphOpenAIOption (line 3) | public class GraphOpenAIOption
FILE: src/GraphRag.Net/Common/Options/GraphSearchOption.cs
class GraphSearchOption (line 9) | public class GraphSearchOption
FILE: src/GraphRag.Net/Common/Options/GraphSysOption.cs
class GraphSysOption (line 9) | public class GraphSysOption
FILE: src/GraphRag.Net/Common/Options/TextChunkerOption.cs
class TextChunkerOption (line 3) | public class TextChunkerOption
FILE: src/GraphRag.Net/Common/ServiceDescriptionAttribute.cs
class ServiceDescriptionAttribute (line 5) | public class ServiceDescriptionAttribute : Attribute
method ServiceDescriptionAttribute (line 7) | public ServiceDescriptionAttribute(Type serviceType, ServiceLifetime l...
FILE: src/GraphRag.Net/Domain/Interface/ICommunityDetectionService.cs
type ICommunityDetectionService (line 10) | public interface ICommunityDetectionService
method FastLabelPropagationAlgorithm (line 12) | Dictionary<string, string> FastLabelPropagationAlgorithm(Graph graph, ...
FILE: src/GraphRag.Net/Domain/Interface/IGraphService.cs
type IGraphService (line 6) | public interface IGraphService
method GetAllIndex (line 12) | List<string> GetAllIndex();
method GetAllGraphs (line 18) | GraphViewModel GetAllGraphs(string index);
method InsertTextChunkAsync (line 25) | Task InsertTextChunkAsync(string index, string input);
method InsertGraphDataAsync (line 32) | Task InsertGraphDataAsync(string index, string input);
method SearchGraphModel (line 40) | Task<GraphModel> SearchGraphModel(string index, string input);
method SearchGraphAsync (line 48) | Task<string> SearchGraphAsync(string index, string input);
method SearchGraphCommunityModel (line 55) | Task<GraphModel> SearchGraphCommunityModel(string index, string input);
method SearchGraphStreamAsync (line 62) | IAsyncEnumerable<StreamingKernelContent> SearchGraphStreamAsync(string...
method SearchGraphCommunityAsync (line 69) | Task<string> SearchGraphCommunityAsync(string index, string input);
method SearchGraphCommunityStreamAsync (line 76) | IAsyncEnumerable<StreamingKernelContent> SearchGraphCommunityStreamAsy...
method GraphCommunitiesAsync (line 82) | Task GraphCommunitiesAsync(string index);
method GraphGlobalAsync (line 88) | Task GraphGlobalAsync(string index);
method DeleteGraph (line 95) | Task DeleteGraph(string index);
FILE: src/GraphRag.Net/Domain/Interface/ISemanticService.cs
type ISemanticService (line 7) | public interface ISemanticService
method CreateGraphAsync (line 9) | Task<GraphModel> CreateGraphAsync(string input);
method GetGraphAnswerAsync (line 11) | Task<string> GetGraphAnswerAsync(string graph, string input);
method GetGraphAnswerStreamAsync (line 12) | IAsyncEnumerable<StreamingKernelContent> GetGraphAnswerStreamAsync(str...
method GetGraphCommunityAnswerAsync (line 13) | Task<string> GetGraphCommunityAnswerAsync(string graph, string communi...
method GetGraphCommunityAnswerStreamAsync (line 15) | IAsyncEnumerable<StreamingKernelContent> GetGraphCommunityAnswerStream...
method GetRelationship (line 16) | Task<RelationShipModel> GetRelationship(string node1, string node2);
method MergeDesc (line 17) | Task<string> MergeDesc(string desc1, string desc2);
method CommunitySummaries (line 18) | Task<string> CommunitySummaries(string nodes);
method GlobalSummaries (line 19) | Task<string> GlobalSummaries(string community);
method GetTextMemory (line 20) | Task<SemanticTextMemory> GetTextMemory();
FILE: src/GraphRag.Net/Domain/Model/Graph/Graph.cs
class Graph (line 9) | public class Graph
method Graph (line 13) | public Graph()
method AddEdge (line 18) | public void AddEdge(string node1, string node2)
FILE: src/GraphRag.Net/Domain/Model/Graph/GraphModel.cs
class GraphModel (line 5) | public class GraphModel
FILE: src/GraphRag.Net/Domain/Model/Graph/GraphViewModel.cs
class GraphViewModel (line 3) | public class GraphViewModel
class NodesViewModel (line 9) | public class NodesViewModel
class NodesDataModel (line 18) | public class NodesDataModel
class LinesViewModel (line 23) | public class LinesViewModel
FILE: src/GraphRag.Net/Domain/Model/Graph/RelationShipModel.cs
class RelationShipModel (line 5) | public class RelationShipModel
FILE: src/GraphRag.Net/Domain/Model/Graph/TextMemModel.cs
class TextMemModel (line 3) | public class TextMemModel
FILE: src/GraphRag.Net/Domain/Model/PageList.cs
class PageList (line 3) | public class PageList<T>
FILE: src/GraphRag.Net/Domain/Service/CommunityDetectionService.cs
class CommunityDetectionService (line 7) | [ServiceDescription(typeof(ICommunityDetectionService), ServiceLifetime....
method FastLabelPropagationAlgorithm (line 16) | public Dictionary<string, string> FastLabelPropagationAlgorithm(Graph ...
FILE: src/GraphRag.Net/Domain/Service/GraphService.cs
class GraphService (line 15) | [ServiceDescription(typeof(IGraphService), ServiceLifetime.Scoped)]
method GetAllIndex (line 30) | public List<string> GetAllIndex()
method GetAllGraphs (line 40) | public GraphViewModel GetAllGraphs(string index)
method InsertTextChunkAsync (line 95) | public async Task InsertTextChunkAsync(string index, string input)
method CreateOverlappingChunks (line 119) | private List<string> CreateOverlappingChunks(List<string> paragraphs)
method InsertGraphDataAsync (line 169) | public async Task InsertGraphDataAsync(string index, string input)
method SearchGraphModel (line 346) | public async Task<GraphModel> SearchGraphModel(string index, string in...
method EstimateTokenCount (line 386) | private int EstimateTokenCount(GraphModel model)
method LimitGraphByTokenCount (line 422) | private GraphModel LimitGraphByTokenCount(GraphModel model, Dictionary...
method SearchGraphCommunityModel (line 477) | public async Task<GraphModel> SearchGraphCommunityModel(string index, ...
method SearchGraphAsync (line 531) | public async Task<string> SearchGraphAsync(string index, string input)
method SearchGraphStreamAsync (line 544) | public async IAsyncEnumerable<StreamingKernelContent> SearchGraphStrea...
method SearchGraphCommunityAsync (line 563) | public async Task<string> SearchGraphCommunityAsync(string index, stri...
method SearchGraphCommunityStreamAsync (line 589) | public async IAsyncEnumerable<StreamingKernelContent> SearchGraphCommu...
method GraphCommunitiesAsync (line 619) | public async Task GraphCommunitiesAsync(string index)
method GraphGlobalAsync (line 678) | public async Task GraphGlobalAsync(string index)
method EnhanceGraphRelationshipsAsync (line 698) | public async Task EnhanceGraphRelationshipsAsync(string index)
method ValidateAndOptimizeRelationshipsAsync (line 753) | public async Task ValidateAndOptimizeRelationshipsAsync(string index)
method DeleteGraph (line 815) | public async Task DeleteGraph(string index)
method ProcessOrphanNodesAsync (line 842) | private async Task ProcessOrphanNodesAsync(string index, List<Nodes> n...
method AttemptConnectOrphanNodeAsync (line 868) | private async Task<int> AttemptConnectOrphanNodeAsync(string index, No...
method RetrieveTextMemModelList (line 985) | private async Task<List<TextMemModel>> RetrieveTextMemModelList(string...
method GetGraphAllRecursion (line 1042) | private GraphModel GetGraphAllRecursion(string index, List<Nodes> init...
method GetGraphAllCommunitiesRecursion (line 1125) | private GraphModel GetGraphAllCommunitiesRecursion(string index, List<...
method GetEdges (line 1168) | private List<Edges> GetEdges(string index, List<Nodes> nodes)
method GetNodes (line 1182) | private List<Nodes> GetNodes(string index, List<Edges> edges)
method GetRelevantCommunities (line 1197) | private List<string> GetRelevantCommunities(string index, List<string>...
FILE: src/GraphRag.Net/Domain/Service/SemanticService.cs
class SemanticService (line 20) | [ServiceDescription(typeof(ISemanticService), ServiceLifetime.Scoped)]
method CreateGraphAsync (line 23) | public async Task<GraphModel> CreateGraphAsync(string input)
method GetGraphAnswerAsync (line 50) | public async Task<string> GetGraphAnswerAsync(string graph, string input)
method GetGraphAnswerStreamAsync (line 63) | public async IAsyncEnumerable<StreamingKernelContent> GetGraphAnswerSt...
method GetGraphCommunityAnswerAsync (line 79) | public async Task<string> GetGraphCommunityAnswerAsync(string graph, s...
method GetGraphCommunityAnswerStreamAsync (line 96) | public async IAsyncEnumerable<StreamingKernelContent> GetGraphCommunit...
method GetRelationship (line 115) | public async Task<RelationShipModel> GetRelationship(string node1, str...
method MergeDesc (line 144) | public async Task<string> MergeDesc(string desc1, string desc2)
method CommunitySummaries (line 157) | public async Task<string> CommunitySummaries(string nodes)
method GlobalSummaries (line 169) | public async Task<string> GlobalSummaries(string community)
method GetTextMemory (line 187) | public async Task<SemanticTextMemory> GetTextMemory()
FILE: src/GraphRag.Net/Extensions/ServiceCollectionExtensions.cs
class ServiceCollectionExtensions (line 14) | public static class ServiceCollectionExtensions
method AddGraphRagNet (line 21) | public static IServiceCollection AddGraphRagNet(this IServiceCollectio...
method InitSK (line 63) | static void InitSK(IServiceCollection services,Kernel _kernel = null)
method CodeFirst (line 92) | static void CodeFirst()
method TypeIsEntity (line 111) | static bool TypeIsEntity(Type type)
FILE: src/GraphRag.Net/Repositories/Base/IRepository.cs
type IRepository (line 8) | public interface IRepository<T>
method GetDB (line 10) | SqlSugarScope GetDB();
method GetList (line 11) | List<T> GetList();
method GetListAsync (line 12) | Task<List<T>> GetListAsync();
method GetList (line 13) | List<T> GetList(Expression<Func<T, bool>> whereExpression);
method GetListAsync (line 14) | Task<List<T>> GetListAsync(Expression<Func<T, bool>> whereExpression);
method Count (line 15) | int Count(Expression<Func<T, bool>> whereExpression);
method CountAsync (line 16) | Task<int> CountAsync(Expression<Func<T, bool>> whereExpression);
method GetPageList (line 17) | PageList<T> GetPageList(Expression<Func<T, bool>> whereExpression, Pag...
method GetPageListAsync (line 18) | Task<PageList<T>> GetPageListAsync(Expression<Func<T, bool>> whereExpr...
method GetPageList (line 20) | PageList<T> GetPageList(Expression<Func<T, bool>> whereExpression, Pag...
method GetPageListAsync (line 21) | Task<PageList<T>> GetPageListAsync(Expression<Func<T, bool>> whereExpr...
method GetPageList (line 23) | PageList<T> GetPageList(List<IConditionalModel> conditionalList, PageM...
method GetPageListAsync (line 24) | Task<PageList<T>> GetPageListAsync(List<IConditionalModel> conditional...
method GetPageList (line 25) | PageList<T> GetPageList(List<IConditionalModel> conditionalList, PageM...
method GetPageListAsync (line 26) | Task<PageList<T>> GetPageListAsync(List<IConditionalModel> conditional...
method GetById (line 27) | T GetById(dynamic id);
method GetByIdAsync (line 28) | Task<T> GetByIdAsync(dynamic id);
method GetSingle (line 29) | T GetSingle(Expression<Func<T, bool>> whereExpression);
method GetSingleAsync (line 30) | Task<T> GetSingleAsync(Expression<Func<T, bool>> whereExpression);
method GetFirst (line 31) | T GetFirst(Expression<Func<T, bool>> whereExpression);
method GetFirstAsync (line 32) | Task<T> GetFirstAsync(Expression<Func<T, bool>> whereExpression);
method Insert (line 33) | bool Insert(T obj);
method InsertAsync (line 34) | Task<bool> InsertAsync(T obj);
method InsertRange (line 35) | bool InsertRange(List<T> objs);
method InsertRangeAsync (line 36) | Task<bool> InsertRangeAsync(List<T> objs);
method InsertReturnIdentity (line 37) | int InsertReturnIdentity(T obj);
method InsertReturnIdentityAsync (line 38) | Task<int> InsertReturnIdentityAsync(T obj);
method InsertReturnBigIdentity (line 39) | long InsertReturnBigIdentity(T obj);
method InsertReturnBigIdentityAsync (line 40) | Task<long> InsertReturnBigIdentityAsync(T obj);
method DeleteByIds (line 41) | bool DeleteByIds(dynamic[] ids);
method DeleteByIdsAsync (line 42) | Task<bool> DeleteByIdsAsync(dynamic[] ids);
method Delete (line 43) | bool Delete(dynamic id);
method DeleteAsync (line 44) | Task<bool> DeleteAsync(dynamic id);
method Delete (line 45) | bool Delete(T obj);
method DeleteAsync (line 46) | Task<bool> DeleteAsync(T obj);
method Delete (line 47) | bool Delete(Expression<Func<T, bool>> whereExpression);
method DeleteAsync (line 48) | Task<bool> DeleteAsync(Expression<Func<T, bool>> whereExpression);
method Update (line 49) | bool Update(T obj);
method UpdateAsync (line 50) | Task<bool> UpdateAsync(T obj);
method UpdateRange (line 51) | bool UpdateRange(List<T> objs);
method InsertOrUpdate (line 52) | bool InsertOrUpdate(T obj);
method InsertOrUpdateAsync (line 53) | Task<bool> InsertOrUpdateAsync(T obj);
method UpdateRangeAsync (line 54) | Task<bool> UpdateRangeAsync(List<T> objs);
method IsAny (line 55) | bool IsAny(Expression<Func<T, bool>> whereExpression);
method IsAnyAsync (line 56) | Task<bool> IsAnyAsync(Expression<Func<T, bool>> whereExpression);
FILE: src/GraphRag.Net/Repositories/Base/Repository.cs
class Repository (line 8) | public class Repository<T> : SimpleClient<T> where T : class, new()
method Repository (line 11) | public Repository(ISqlSugarClient context = null) : base(context)//注意这...
method GetDB (line 28) | public virtual SqlSugarScope GetDB()
method GetList (line 37) | public virtual List<T> GetList()
method GetListAsync (line 46) | public virtual async Task<List<T>> GetListAsync()
method GetList (line 56) | public virtual List<T> GetList(Expression<Func<T, bool>> whereExpression)
method GetListAsync (line 66) | public virtual async Task<List<T>> GetListAsync(Expression<Func<T, boo...
method Count (line 76) | public virtual int Count(Expression<Func<T, bool>> whereExpression)
method CountAsync (line 86) | public virtual async Task<int> CountAsync(Expression<Func<T, bool>> wh...
method GetPageList (line 97) | public virtual PageList<T> GetPageList(Expression<Func<T, bool>> where...
method GetPageListAsync (line 113) | public virtual async Task<PageList<T>> GetPageListAsync(Expression<Fun...
method GetPageList (line 123) | public virtual PageList<T> GetPageList(Expression<Func<T, bool>> where...
method GetPageListAsync (line 133) | public virtual async Task<PageList<T>> GetPageListAsync(Expression<Fun...
method GetPageList (line 143) | public virtual PageList<T> GetPageList(List<IConditionalModel> conditi...
method GetPageListAsync (line 153) | public virtual async Task<PageList<T>> GetPageListAsync(List<IConditio...
method GetPageList (line 163) | public virtual PageList<T> GetPageList(List<IConditionalModel> conditi...
method GetPageListAsync (line 173) | public virtual async Task<PageList<T>> GetPageListAsync(List<IConditio...
method GetById (line 188) | public virtual T GetById(dynamic id)
method GetByIdAsync (line 198) | public virtual async Task<T> GetByIdAsync(dynamic id)
method GetSingle (line 208) | public virtual T GetSingle(Expression<Func<T, bool>> whereExpression)
method GetSingleAsync (line 218) | public virtual async Task<T> GetSingleAsync(Expression<Func<T, bool>> ...
method GetFirst (line 228) | public virtual T GetFirst(Expression<Func<T, bool>> whereExpression)
method GetFirstAsync (line 238) | public virtual async Task<T> GetFirstAsync(Expression<Func<T, bool>> w...
method Insert (line 248) | public virtual bool Insert(T obj)
method InsertAsync (line 258) | public virtual async Task<bool> InsertAsync(T obj)
method InsertRange (line 268) | public virtual bool InsertRange(List<T> objs)
method InsertRangeAsync (line 278) | public virtual async Task<bool> InsertRangeAsync(List<T> objs)
method InsertReturnIdentity (line 288) | public virtual int InsertReturnIdentity(T obj)
method InsertReturnIdentityAsync (line 298) | public virtual async Task<int> InsertReturnIdentityAsync(T obj)
method InsertReturnBigIdentity (line 308) | public virtual long InsertReturnBigIdentity(T obj)
method InsertReturnBigIdentityAsync (line 318) | public virtual async Task<long> InsertReturnBigIdentityAsync(T obj)
method DeleteByIds (line 328) | public virtual bool DeleteByIds(dynamic[] ids)
method DeleteByIdsAsync (line 338) | public virtual async Task<bool> DeleteByIdsAsync(dynamic[] ids)
method Delete (line 348) | public virtual bool Delete(dynamic id)
method DeleteAsync (line 358) | public virtual async Task<bool> DeleteAsync(dynamic id)
method Delete (line 368) | public virtual bool Delete(T obj)
method DeleteAsync (line 378) | public virtual async Task<bool> DeleteAsync(T obj)
method Delete (line 388) | public virtual bool Delete(Expression<Func<T, bool>> whereExpression)
method DeleteAsync (line 398) | public virtual async Task<bool> DeleteAsync(Expression<Func<T, bool>> ...
method Update (line 408) | public virtual bool Update(T obj)
method UpdateAsync (line 418) | public virtual async Task<bool> UpdateAsync(T obj)
method UpdateRange (line 428) | public virtual bool UpdateRange(List<T> objs)
method InsertOrUpdate (line 438) | public virtual bool InsertOrUpdate(T obj)
method InsertOrUpdateAsync (line 448) | public virtual async Task<bool> InsertOrUpdateAsync(T obj)
method UpdateRangeAsync (line 459) | public virtual async Task<bool> UpdateRangeAsync(List<T> objs)
method IsAny (line 469) | public virtual bool IsAny(Expression<Func<T, bool>> whereExpression)
method IsAnyAsync (line 479) | public virtual async Task<bool> IsAnyAsync(Expression<Func<T, bool>> w...
FILE: src/GraphRag.Net/Repositories/Base/SqlSugarHelper.cs
class SqlSugarHelper (line 7) | public class SqlSugarHelper()
method SqlScope (line 13) | public static SqlSugarScope SqlScope()
FILE: src/GraphRag.Net/Repositories/Graph/CommunitieNodes/CommunitieNodes.cs
class CommunitieNodes (line 8) | [SugarTable("CommunitieNodes")]
FILE: src/GraphRag.Net/Repositories/Graph/CommunitieNodes/CommunitieNodes_Repositories.cs
class CommunitieNodes_Repositories (line 6) | [ServiceDescription(typeof(ICommunitieNodes_Repositories), ServiceLifeti...
FILE: src/GraphRag.Net/Repositories/Graph/CommunitieNodes/ICommunitieNodes_Repositories.cs
type ICommunitieNodes_Repositories (line 5) | public interface ICommunitieNodes_Repositories : IRepository<CommunitieN...
FILE: src/GraphRag.Net/Repositories/Graph/Communities/Communities.cs
class Communities (line 8) | [SugarTable("Communities")]
FILE: src/GraphRag.Net/Repositories/Graph/Communities/Communities_Repositories.cs
class Communities_Repositories (line 6) | [ServiceDescription(typeof(ICommunities_Repositories), ServiceLifetime.S...
FILE: src/GraphRag.Net/Repositories/Graph/Communities/ICommunities_Repositories.cs
type ICommunities_Repositories (line 5) | public interface ICommunities_Repositories : IRepository<Communities>
FILE: src/GraphRag.Net/Repositories/Graph/Edges/Edges.cs
class Edges (line 8) | [SugarTable("Edges")]
FILE: src/GraphRag.Net/Repositories/Graph/Edges/Edges_Repositories.cs
class Edges_Repositories (line 6) | [ServiceDescription(typeof(IEdges_Repositories), ServiceLifetime.Scoped)]
FILE: src/GraphRag.Net/Repositories/Graph/Edges/IEdges_Repositories.cs
type IEdges_Repositories (line 5) | public interface IEdges_Repositories : IRepository<Edges>
FILE: src/GraphRag.Net/Repositories/Graph/Global/Globals.cs
class Globals (line 8) | [SugarTable("Globals")]
FILE: src/GraphRag.Net/Repositories/Graph/Global/Globals_Repositories.cs
class Globals_Repositories (line 6) | [ServiceDescription(typeof(IGlobals_Repositories), ServiceLifetime.Scoped)]
FILE: src/GraphRag.Net/Repositories/Graph/Global/IGlobals_Repositories.cs
type IGlobals_Repositories (line 5) | public interface IGlobals_Repositories : IRepository<Globals>
FILE: src/GraphRag.Net/Repositories/Graph/Nodes/INodes_Repositories.cs
type INodes_Repositories (line 5) | public interface INodes_Repositories : IRepository<Nodes>
FILE: src/GraphRag.Net/Repositories/Graph/Nodes/Nodes.cs
class Nodes (line 8) | [SugarTable("Nodes")]
FILE: src/GraphRag.Net/Repositories/Graph/Nodes/Nodes_Repositories.cs
class Nodes_Repositories (line 6) | [ServiceDescription(typeof(INodes_Repositories), ServiceLifetime.Scoped)]
FILE: src/GraphRag.Net/Utils/ConvertUtils.cs
class ConvertUtils (line 9) | internal static class ConvertUtils
method IsNull (line 16) | public static bool IsNull(this object data)
method IsNotNull (line 40) | public static bool IsNotNull(this object data)
method IsNull (line 64) | public static bool IsNull(string data)
method ConvertToString (line 88) | public static string ConvertToString(this object s)
method ConvertToInt32 (line 105) | public static Int32 ConvertToInt32(this object s)
method ConvertToInt64 (line 124) | public static Int64 ConvertToInt64(this object s)
method ConvertToDouble (line 143) | public static double ConvertToDouble(this object s)
method ConvertToDateTime (line 162) | public static DateTime ConvertToDateTime(this string s)
method ConvertToDateTime (line 179) | public static string ConvertToDateTime(this string s, string y)
method ConvertToDecimal (line 191) | public static decimal ConvertToDecimal(this object s)
method DecimalFraction (line 207) | public static decimal DecimalFraction(this decimal num)
method ReplaceHtml (line 217) | public static string ReplaceHtml(this string s)
method StreamToByte (line 227) | public static byte[] StreamToByte(this Stream stream)
method JsonToMarkDown (line 236) | public static string JsonToMarkDown(this string s)
method ToQueryString (line 246) | public static string ToQueryString(this Dictionary<string, string> par...
method ComparisonIgnoreCase (line 264) | public static bool ComparisonIgnoreCase(this string s, string value)
method GetDescription (line 269) | public static string GetDescription(this Enum value)
method IsStream (line 291) | public static bool IsStream(this string value)
method Unescape (line 306) | public static string Unescape(this string value)
FILE: src/GraphRag.Net/Utils/OpenAIHttpClientHandler.cs
class OpenAIHttpClientHandler (line 8) | internal class OpenAIHttpClientHandler : HttpClientHandler
method SendAsync (line 11) | protected override async Task<HttpResponseMessage> SendAsync(HttpReque...
FILE: src/GraphRag.Net/Utils/RepoUtils/AppException.cs
class AppException (line 5) | internal class AppException : Exception
method AppException (line 7) | public AppException() : base()
method AppException (line 11) | public AppException(string message) : base(message)
method AppException (line 15) | public AppException(string message, Exception innerException) : base(m...
FILE: src/GraphRag.Net/Utils/RepoUtils/ObjectExtensions.cs
class ObjectExtensions (line 5) | internal static class ObjectExtensions
method AsJson (line 9) | public static string AsJson(this object obj)
FILE: src/GraphRag.Net/Utils/RepoUtils/RepoFiles.cs
class RepoFiles (line 7) | internal static class RepoFiles
method SamplePluginsPath (line 13) | public static string SamplePluginsPath()
Condensed preview — 126 files, each showing path, character count, and a content snippet. Download the .json file or copy for the full structured content (746K chars).
[
{
"path": ".github/workflows/nuget-publish.yml",
"chars": 517,
"preview": "name: main\non:\n push:\n branches:\n - main \n paths: \n - 'Directory.Build.props'\n\njobs:\n deploy-nuget:\n "
},
{
"path": ".gitignore",
"chars": 5748,
"preview": "## Ignore Visual Studio temporary files, build results, and\n## files generated by popular Visual Studio add-ons.\n##\n## G"
},
{
"path": "Directory.Build.props",
"chars": 221,
"preview": "<Project>\n <!-- See https://aka.ms/dotnet/msbuild/customize for more details on customizing your build -->\n <PropertyG"
},
{
"path": "GraphRag.Net.sln",
"chars": 1953,
"preview": "\nMicrosoft Visual Studio Solution File, Format Version 12.00\n# Visual Studio Version 17\nVisualStudioVersion = 17.10.350"
},
{
"path": "LICENSE",
"chars": 11337,
"preview": " Apache License\n Version 2.0, January 2004\n "
},
{
"path": "README.en.md",
"chars": 15190,
"preview": "[简体中文](./README.md) | English\n\n## This is a simple implementation of dotnet referring to GraphRag\n\nBased on the implemen"
},
{
"path": "README.md",
"chars": 11041,
"preview": "简体中文 | [English](./README.en.md) \n\n## 这是一个参考GraphRag的dotnet简易实现\n\n基于微软在论文中提到的实现思路,执行过程GraphRAG主要实现了如下功能:\n- Source Documen"
},
{
"path": "src/GraphRag.Net/Common/Options/GraphDBConnectionOption.cs",
"chars": 647,
"preview": "namespace GraphRag.Net.Options\n{\n public class GraphDBConnectionOption\n {\n /// <summary>\n /// sqlit"
},
{
"path": "src/GraphRag.Net/Common/Options/GraphOpenAIOption.cs",
"chars": 296,
"preview": "namespace GraphRag.Net.Options\n{\n public class GraphOpenAIOption\n {\n public static string EndPoint { get; "
},
{
"path": "src/GraphRag.Net/Common/Options/GraphSearchOption.cs",
"chars": 850,
"preview": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nna"
},
{
"path": "src/GraphRag.Net/Common/Options/GraphSysOption.cs",
"chars": 323,
"preview": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nna"
},
{
"path": "src/GraphRag.Net/Common/Options/TextChunkerOption.cs",
"chars": 338,
"preview": "namespace GraphRag.Net.Options\n{\n public class TextChunkerOption\n {\n /// <summary>\n /// 行切片token\n "
},
{
"path": "src/GraphRag.Net/Common/ServiceDescriptionAttribute.cs",
"chars": 428,
"preview": "using Microsoft.Extensions.DependencyInjection;\n\nnamespace GraphRag.Net\n{\n public class ServiceDescriptionAttribute "
},
{
"path": "src/GraphRag.Net/Domain/Interface/ICommunityDetectionService.cs",
"chars": 361,
"preview": "using GraphRag.Net.Domain.Model.Graph;\nusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System."
},
{
"path": "src/GraphRag.Net/Domain/Interface/IGraphService.cs",
"chars": 3175,
"preview": "using GraphRag.Net.Domain.Model.Graph;\nusing Microsoft.SemanticKernel;\n\nnamespace GraphRag.Net.Domain.Interface\n{\n p"
},
{
"path": "src/GraphRag.Net/Domain/Interface/ISemanticService.cs",
"chars": 995,
"preview": "using GraphRag.Net.Domain.Model.Graph;\nusing Microsoft.SemanticKernel;\nusing Microsoft.SemanticKernel.Memory;\n\nnamespac"
},
{
"path": "src/GraphRag.Net/Domain/Model/Graph/Graph.cs",
"chars": 825,
"preview": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nna"
},
{
"path": "src/GraphRag.Net/Domain/Model/Graph/GraphModel.cs",
"chars": 215,
"preview": "using GraphRag.Net.Repositories;\n\nnamespace GraphRag.Net.Domain.Model.Graph\n{\n public class GraphModel\n {\n "
},
{
"path": "src/GraphRag.Net/Domain/Model/Graph/GraphViewModel.cs",
"chars": 861,
"preview": "namespace GraphRag.Net.Domain.Model.Graph\n{\n public class GraphViewModel\n {\n public string rootId { get; s"
},
{
"path": "src/GraphRag.Net/Domain/Model/Graph/RelationShipModel.cs",
"chars": 218,
"preview": "using GraphRag.Net.Repositories;\n\nnamespace GraphRag.Net.Domain.Model.Graph\n{\n public class RelationShipModel\n {\n"
},
{
"path": "src/GraphRag.Net/Domain/Model/Graph/TextMemModel.cs",
"chars": 215,
"preview": "namespace GraphRag.Net.Domain.Model.Graph\n{\n public class TextMemModel\n {\n public string Id { get; set; }\n"
},
{
"path": "src/GraphRag.Net/Domain/Model/PageList.cs",
"chars": 449,
"preview": "namespace GraphRag.Net.Model\n{\n public class PageList<T>\n {\n //查询结果\n public List<T> List { get; set"
},
{
"path": "src/GraphRag.Net/Domain/Service/CommunityDetectionService.cs",
"chars": 2108,
"preview": "using GraphRag.Net.Domain.Interface;\nusing GraphRag.Net.Domain.Model.Graph;\nusing Microsoft.Extensions.DependencyInject"
},
{
"path": "src/GraphRag.Net/Domain/Service/GraphService.cs",
"chars": 48073,
"preview": "using GraphRag.Net.Domain.Interface;\nusing GraphRag.Net.Domain.Model.Graph;\nusing GraphRag.Net.Options;\nusing GraphRag."
},
{
"path": "src/GraphRag.Net/Domain/Service/SemanticService.cs",
"chars": 8542,
"preview": "using Azure.AI.OpenAI;\nusing GraphRag.Net.Options;\nusing GraphRag.Net.Domain.Interface;\nusing GraphRag.Net.Utils;\nusing"
},
{
"path": "src/GraphRag.Net/Extensions/ServiceCollectionExtensions.cs",
"chars": 4118,
"preview": "using System.Reflection;\nusing GraphRag.Net;\nusing GraphRag.Net.Options;\nusing GraphRag.Net.Repositories;\nusing GraphRa"
},
{
"path": "src/GraphRag.Net/GraphRag.Net.csproj",
"chars": 2415,
"preview": "<Project Sdk=\"Microsoft.NET.Sdk\">\n\n <PropertyGroup>\n <TargetFrameworks>net6.0;net7.0;net8.0</TargetFrameworks>\n "
},
{
"path": "src/GraphRag.Net/Repositories/Base/IRepository.cs",
"chars": 3155,
"preview": "\nusing GraphRag.Net.Model;\nusing SqlSugar;\nusing System.Linq.Expressions;\n\nnamespace GraphRag.Net.Base\n{\n public int"
},
{
"path": "src/GraphRag.Net/Repositories/Base/Repository.cs",
"chars": 15368,
"preview": "using GraphRag.Net.Model;\nusing SqlSugar;\nusing System.Linq.Expressions;\n\n\nnamespace GraphRag.Net.Base\n{\n public cla"
},
{
"path": "src/GraphRag.Net/Repositories/Base/SqlSugarHelper.cs",
"chars": 1473,
"preview": "using GraphRag.Net.Options;\nusing SqlSugar;\nusing System.Reflection;\n\nnamespace GraphRag.Net.Base\n{\n public class Sq"
},
{
"path": "src/GraphRag.Net/Repositories/Graph/CommunitieNodes/CommunitieNodes.cs",
"chars": 808,
"preview": "using SqlSugar;\n\nnamespace GraphRag.Net.Repositories\n{\n /// <summary>\n /// 社区与节点关系\n /// </summary>\n [SugarT"
},
{
"path": "src/GraphRag.Net/Repositories/Graph/CommunitieNodes/CommunitieNodes_Repositories.cs",
"chars": 322,
"preview": "using GraphRag.Net.Base;\nusing Microsoft.Extensions.DependencyInjection;\n\nnamespace GraphRag.Net.Repositories\n{\n [Se"
},
{
"path": "src/GraphRag.Net/Repositories/Graph/CommunitieNodes/ICommunitieNodes_Repositories.cs",
"chars": 161,
"preview": "using GraphRag.Net.Base;\n\nnamespace GraphRag.Net.Repositories\n{\n public interface ICommunitieNodes_Repositories : IR"
},
{
"path": "src/GraphRag.Net/Repositories/Graph/Communities/Communities.cs",
"chars": 687,
"preview": "using SqlSugar;\n\nnamespace GraphRag.Net.Repositories\n{\n /// <summary>\n /// 社区\n /// </summary>\n [SugarTable("
},
{
"path": "src/GraphRag.Net/Repositories/Graph/Communities/Communities_Repositories.cs",
"chars": 306,
"preview": "using GraphRag.Net.Base;\nusing Microsoft.Extensions.DependencyInjection;\n\nnamespace GraphRag.Net.Repositories\n{\n [Se"
},
{
"path": "src/GraphRag.Net/Repositories/Graph/Communities/ICommunities_Repositories.cs",
"chars": 153,
"preview": "using GraphRag.Net.Base;\n\nnamespace GraphRag.Net.Repositories\n{\n public interface ICommunities_Repositories : IRepos"
},
{
"path": "src/GraphRag.Net/Repositories/Graph/Edges/Edges.cs",
"chars": 1007,
"preview": "using SqlSugar;\n\nnamespace GraphRag.Net.Repositories\n{\n /// <summary>\n /// 边\n /// </summary>\n [SugarTable(\""
},
{
"path": "src/GraphRag.Net/Repositories/Graph/Edges/Edges_Repositories.cs",
"chars": 282,
"preview": "using GraphRag.Net.Base;\nusing Microsoft.Extensions.DependencyInjection;\n\nnamespace GraphRag.Net.Repositories\n{\n [Se"
},
{
"path": "src/GraphRag.Net/Repositories/Graph/Edges/IEdges_Repositories.cs",
"chars": 141,
"preview": "using GraphRag.Net.Base;\n\nnamespace GraphRag.Net.Repositories\n{\n public interface IEdges_Repositories : IRepository<"
},
{
"path": "src/GraphRag.Net/Repositories/Graph/Global/Globals.cs",
"chars": 515,
"preview": "using SqlSugar;\n\nnamespace GraphRag.Net.Repositories\n{\n /// <summary>\n /// 社区\n /// </summary>\n [SugarTable("
},
{
"path": "src/GraphRag.Net/Repositories/Graph/Global/Globals_Repositories.cs",
"chars": 290,
"preview": "using GraphRag.Net.Base;\nusing Microsoft.Extensions.DependencyInjection;\n\nnamespace GraphRag.Net.Repositories\n{\n [Se"
},
{
"path": "src/GraphRag.Net/Repositories/Graph/Global/IGlobals_Repositories.cs",
"chars": 145,
"preview": "using GraphRag.Net.Base;\n\nnamespace GraphRag.Net.Repositories\n{\n public interface IGlobals_Repositories : IRepositor"
},
{
"path": "src/GraphRag.Net/Repositories/Graph/Nodes/INodes_Repositories.cs",
"chars": 141,
"preview": "using GraphRag.Net.Base;\n\nnamespace GraphRag.Net.Repositories\n{\n public interface INodes_Repositories : IRepository<"
},
{
"path": "src/GraphRag.Net/Repositories/Graph/Nodes/Nodes.cs",
"chars": 845,
"preview": "using SqlSugar;\n\nnamespace GraphRag.Net.Repositories\n{\n /// <summary>\n /// 节点\n /// </summary>\n [SugarTable("
},
{
"path": "src/GraphRag.Net/Repositories/Graph/Nodes/Nodes_Repositories.cs",
"chars": 282,
"preview": "using GraphRag.Net.Base;\nusing Microsoft.Extensions.DependencyInjection;\n\nnamespace GraphRag.Net.Repositories\n{\n [Se"
},
{
"path": "src/GraphRag.Net/Utils/ConvertUtils.cs",
"chars": 8692,
"preview": "using Newtonsoft.Json;\nusing System.ComponentModel;\nusing System.Reflection;\nusing System.Text.RegularExpressions;\nusin"
},
{
"path": "src/GraphRag.Net/Utils/OpenAIHttpClientHandler.cs",
"chars": 3169,
"preview": "using GraphRag.Net.Options;\nusing System.Text;\nusing System.Text.RegularExpressions;\n\n\nnamespace GraphRag.Net.Utils\n{\n "
},
{
"path": "src/GraphRag.Net/Utils/RepoUtils/AppException.cs",
"chars": 353,
"preview": "// Copyright (c) Microsoft. All rights reserved.\n\nnamespace GraphRag.Net.Utils;\n\ninternal class AppException : Exceptio"
},
{
"path": "src/GraphRag.Net/Utils/RepoUtils/ObjectExtensions.cs",
"chars": 365,
"preview": "using System.Text.Json;\n\nnamespace GraphRag.Net.Utils\n{\n internal static class ObjectExtensions\n {\n privat"
},
{
"path": "src/GraphRag.Net/Utils/RepoUtils/RepoFiles.cs",
"chars": 1557,
"preview": "// Copyright (c) Microsoft. All rights reserved.\n\nusing System.Reflection;\n\nnamespace GraphRag.Net.Utils;\n\ninternal sta"
},
{
"path": "src/GraphRag.Net.Web/.config/dotnet-tools.json",
"chars": 181,
"preview": "{\n \"version\": 1,\n \"isRoot\": true,\n \"tools\": {\n \"dotnet-ef\": {\n \"version\": \"8.0.8\",\n \"commands\": [\n "
},
{
"path": "src/GraphRag.Net.Web/App.razor",
"chars": 438,
"preview": "<Router AppAssembly=\"@typeof(Program).Assembly\">\n <Found Context=\"routeData\">\n <CascadingValue Value=\"routeDat"
},
{
"path": "src/GraphRag.Net.Web/Components/GlobalHeader/RightContent.razor",
"chars": 477,
"preview": "@namespace GraphRag.Net.Web.Components\n@inherits AntDomComponentBase\n\n<Space Class=\"@ClassMapper.Class\" Size=\"@(\"26\")\">"
},
{
"path": "src/GraphRag.Net.Web/Components/GlobalHeader/RightContent.razor.cs",
"chars": 3100,
"preview": "using AntDesign;\nusing AntDesign.ProLayout;\nusing GraphRag.Net.Web.Models;\nusing Microsoft.AspNetCore.Components;\n\nname"
},
{
"path": "src/GraphRag.Net.Web/Controllers/GraphController.cs",
"chars": 3938,
"preview": "using GraphRag.Net.Domain.Interface;\nusing GraphRag.Net.Domain.Model.Graph;\nusing Microsoft.AspNetCore.Mvc;\n\nnamespace G"
},
{
"path": "src/GraphRag.Net.Web/Extensions/DateTimeExtension.cs",
"chars": 1814,
"preview": "namespace GraphRag.Net.Web\n{\n public static class DateTimeExtension\n {\n private const int Second = 1;\n "
},
{
"path": "src/GraphRag.Net.Web/GraphRag.Net.Web.csproj",
"chars": 3617,
"preview": "<Project Sdk=\"Microsoft.NET.Sdk.Web\">\n\n <PropertyGroup>\n <TargetFrameworks>net6.0;net7.0;net8.0</TargetFrameworks>\n "
},
{
"path": "src/GraphRag.Net.Web/GraphRag.Net.Web.xml",
"chars": 2572,
"preview": "<?xml version=\"1.0\"?>\n<doc>\n <assembly>\n <name>GraphRag.Net.Web</name>\n </assembly>\n <members>\n <"
},
{
"path": "src/GraphRag.Net.Web/Layouts/BasicLayout.razor",
"chars": 1101,
"preview": "@namespace GraphRag.Net.Web\n@inherits LayoutComponentBase\n\n<AntDesign.ProLayout.BasicLayout \n Logo=\"@(\"https://gw.al"
},
{
"path": "src/GraphRag.Net.Web/Layouts/UserLayout.razor",
"chars": 896,
"preview": "@namespace GraphRag.Net.Web\n@using OneOf\n@inherits LayoutComponentBase\n\n<div class=\"container__b__0\">\n <div class=\"l"
},
{
"path": "src/GraphRag.Net.Web/Layouts/UserLayout.razor.css",
"chars": 1514,
"preview": "/* stylelint-disable at-rule-empty-line-before,at-rule-name-space-after,at-rule-no-unknown */\n/* stylelint-disable no-du"
},
{
"path": "src/GraphRag.Net.Web/Mock/MockChatCompletion.cs",
"chars": 1937,
"preview": "using Microsoft.SemanticKernel;\nusing Microsoft.SemanticKernel.ChatCompletion;\nusing System.Runtime.CompilerServices;\nu"
},
{
"path": "src/GraphRag.Net.Web/Mock/MockTextCompletion.cs",
"chars": 1820,
"preview": "using Microsoft.SemanticKernel;\nusing Microsoft.SemanticKernel.Services;\nusing Microsoft.SemanticKernel.TextGeneration;"
},
{
"path": "src/GraphRag.Net.Web/Mock/MockTextEmbeddingGeneratorService.cs",
"chars": 1272,
"preview": "using Microsoft.SemanticKernel;\nusing Microsoft.SemanticKernel.Embeddings;\nusing Microsoft.SemanticKernel.Services;\n\nna"
},
{
"path": "src/GraphRag.Net.Web/Models/ActivitiesType.cs",
"chars": 362,
"preview": "namespace GraphRag.Net.Web.Models\n{\n public class ActivitiesType\n {\n public string Id { get; set; }\n "
},
{
"path": "src/GraphRag.Net.Web/Models/ActivityGroup.cs",
"chars": 162,
"preview": "namespace GraphRag.Net.Web.Models\n{\n public class ActivityGroup\n {\n public string Name { get; set; }\n "
},
{
"path": "src/GraphRag.Net.Web/Models/ActivityProject.cs",
"chars": 164,
"preview": "namespace GraphRag.Net.Web.Models\n{\n public class ActivityProject\n {\n public string Name { get; set; }\n "
},
{
"path": "src/GraphRag.Net.Web/Models/ActivityUser.cs",
"chars": 163,
"preview": "namespace GraphRag.Net.Web.Models\n{\n public class ActivityUser\n {\n public string Name { get; set; }\n "
},
{
"path": "src/GraphRag.Net.Web/Models/AdvancedOperation.cs",
"chars": 337,
"preview": "namespace GraphRag.Net.Web.Models\n{\n public class AdvancedOperation\n {\n public string Key { get; set; }\n "
},
{
"path": "src/GraphRag.Net.Web/Models/AdvancedProfileData.cs",
"chars": 291,
"preview": "namespace GraphRag.Net.Web.Models\n{\n public class AdvancedProfileData\n {\n public AdvancedOperation[] Advan"
},
{
"path": "src/GraphRag.Net.Web/Models/BasicGood.cs",
"chars": 326,
"preview": "namespace GraphRag.Net.Web.Models\n{\n public class BasicGood\n {\n public string Id { get; set; }\n pub"
},
{
"path": "src/GraphRag.Net.Web/Models/BasicProfileDataType.cs",
"chars": 199,
"preview": "namespace GraphRag.Net.Web.Models\n{\n public class BasicProfileDataType\n {\n public BasicGood[] BasicGoods {"
},
{
"path": "src/GraphRag.Net.Web/Models/BasicProgress.cs",
"chars": 332,
"preview": "namespace GraphRag.Net.Web.Models\n{\n public class BasicProgress\n {\n public string Key { get; set; }\n "
},
{
"path": "src/GraphRag.Net.Web/Models/ChartData.cs",
"chars": 673,
"preview": "namespace GraphRag.Net.Web.Models\n{\n public class ChartData\n {\n public ChartDataItem[] VisitData { get; se"
},
{
"path": "src/GraphRag.Net.Web/Models/ChartDataItem.cs",
"chars": 154,
"preview": "namespace GraphRag.Net.Web.Models\n{\n public class ChartDataItem\n {\n public string X { get; set; }\n "
},
{
"path": "src/GraphRag.Net.Web/Models/ChatMessage.cs",
"chars": 80,
"preview": "namespace GraphRag.Net.Web.Models\n{\n public class ChatMessage\n {\n }\n}\n"
},
{
"path": "src/GraphRag.Net.Web/Models/CurrentUser.cs",
"chars": 1189,
"preview": "namespace GraphRag.Net.Web.Models\n{\n public class TagType\n {\n public string Key { get; set; }\n publ"
},
{
"path": "src/GraphRag.Net.Web/Models/FormItemLayout.cs",
"chars": 209,
"preview": "using AntDesign;\n\nnamespace GraphRag.Net.Web.Models\n{\n public class FormItemLayout\n {\n public ColLayoutPar"
},
{
"path": "src/GraphRag.Net.Web/Models/FormModel.cs",
"chars": 1538,
"preview": "namespace GraphRag.Net.Web.Models\n{\n public class StepFormModel\n {\n public string ReceiverAccountType { ge"
},
{
"path": "src/GraphRag.Net.Web/Models/LayoutModel.cs",
"chars": 1164,
"preview": "using AntDesign;\n\nnamespace GraphRag.Net.Web.Models\n{\n public class LayoutModel\n {\n public static FormItem"
},
{
"path": "src/GraphRag.Net.Web/Models/ListFormModel.cs",
"chars": 381,
"preview": "namespace GraphRag.Net.Web.Models\n{\n public class ListFormModel\n {\n public string Owner { get; set; } = \"w"
},
{
"path": "src/GraphRag.Net.Web/Models/ListItemDataType.cs",
"chars": 1330,
"preview": "using GraphRag.Net.Web.Utils;\nusing System.Text.Json.Serialization;\n\nnamespace GraphRag.Net.Web.Models\n{\n public clas"
},
{
"path": "src/GraphRag.Net.Web/Models/LoginParamsType.cs",
"chars": 423,
"preview": "using System.ComponentModel.DataAnnotations;\n\nnamespace GraphRag.Net.Web.Models\n{\n public class LoginParamsType\n "
},
{
"path": "src/GraphRag.Net.Web/Models/NoticeItem.cs",
"chars": 246,
"preview": "using AntDesign.ProLayout;\n\nnamespace GraphRag.Net.Web.Models\n{\n public class NoticeItem : NoticeIconData\n {\n "
},
{
"path": "src/GraphRag.Net.Web/Models/NoticeType.cs",
"chars": 424,
"preview": "namespace GraphRag.Net.Web.Models\n{\n public class NoticeType\n {\n public string Id { get; set; }\n pub"
},
{
"path": "src/GraphRag.Net.Web/Models/OfflineChartDataItem.cs",
"chars": 196,
"preview": "namespace GraphRag.Net.Web.Models\n{\n public class OfflineChartDataItem\n {\n public long X { get; set; }\n "
},
{
"path": "src/GraphRag.Net.Web/Models/OfflineDataItem.cs",
"chars": 163,
"preview": "namespace GraphRag.Net.Web.Models\n{\n public class OfflineDataItem\n {\n public string Name { get; set; }\n "
},
{
"path": "src/GraphRag.Net.Web/Models/RadarDataItem.cs",
"chars": 203,
"preview": "namespace GraphRag.Net.Web.Models\n{\n public class RadarDataItem\n {\n public string Name { get; set; }\n "
},
{
"path": "src/GraphRag.Net.Web/Models/SearchDataItem.cs",
"chars": 282,
"preview": "namespace GraphRag.Net.Web.Models\n{\n public class SearchDataItem\n {\n public int Index { get; set; }\n "
},
{
"path": "src/GraphRag.Net.Web/Pages/Graph/Chat.razor",
"chars": 10840,
"preview": "@namespace GraphRag.Net.Web.Pages.Graph\n@page \"/Chat\"\n@using GraphRag.Net.Domain.Interface\n\n<style>\n .chat-page {\n "
},
{
"path": "src/GraphRag.Net.Web/Pages/Graph/Chat.razor.cs",
"chars": 2614,
"preview": "using AntDesign;\nusing GraphRag.Net.Domain.Interface;\nusing Microsoft.AspNetCore.Components;\n\nnamespace GraphRag.Net.We"
},
{
"path": "src/GraphRag.Net.Web/Pages/Graph/Graph.razor",
"chars": 4195,
"preview": "@namespace GraphRag.Net.Web.Pages.Demo\n@page \"/Graph\"\n\n<div id=\"graph\">\n <div style=\"height:calc(100vh - 30px);width"
},
{
"path": "src/GraphRag.Net.Web/Pages/Index.razor",
"chars": 165,
"preview": "@namespace GraphRag.Net.Web.Pages\n@page \"/\"\n\n<h3>GraphRag.Net是一个可以快速导入文本、文档创建GraphRag示例进行测试体验的平台</h3>\n<h3>您也可以单独引用 Grap"
},
{
"path": "src/GraphRag.Net.Web/Pages/_Host.cshtml",
"chars": 1299,
"preview": "@page \"/\"\n@namespace GraphRag.Net.Web.Pages\n@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers\n@{\n Layout = null;\n"
},
{
"path": "src/GraphRag.Net.Web/Program.cs",
"chars": 2726,
"preview": "using AntDesign.ProLayout;\nusing GraphRag.Net;\nusing GraphRag.Net.Options;\nusing GraphRag.Net.Web.Mock;\nusing Microsoft."
},
{
"path": "src/GraphRag.Net.Web/Utils/LongToDateTimeConverter.cs",
"chars": 799,
"preview": "using System.Buffers.Text;\nusing System.Text.Json;\nusing System.Text.Json.Serialization;\n\nnamespace GraphRag.Net.Web.Ut"
},
{
"path": "src/GraphRag.Net.Web/_Imports.razor",
"chars": 337,
"preview": "@using AntDesign\n@using AntDesign.Charts\n@using AntDesign.ProLayout\n@using System.Net.Http\n@using System.Net.Http.Json\n"
},
{
"path": "src/GraphRag.Net.Web/appsettings.json",
"chars": 1209,
"preview": "{\n \"Logging\": {\n \"LogLevel\": {\n \"Default\": \"Information\",\n \"Microsoft.AspNetCore\": \"Warning\"\n }\n },\n "
},
{
"path": "src/GraphRag.Net.Web/graphPlugins/graph/community_search/config.json",
"chars": 127,
"preview": "{\n \"schema\": 1,\n \"description\": \"GraphRag问答\",\n \"execution_settings\": {\n \"default\": {\n \"temperature\": 0.3\n "
},
{
"path": "src/GraphRag.Net.Web/graphPlugins/graph/community_search/skprompt.txt",
"chars": 451,
"preview": "你是一个问答助手,需要根据图谱数据回答用户问题。\n\n<Graph>\n{{$graph}}\n</Graph>\n\n社区摘要如下:\n{{$community}}\n\n全局摘要如下:\n{{$global}}\n\n### 回答指南:\n1. 分析用户问题与"
},
{
"path": "src/GraphRag.Net.Web/graphPlugins/graph/community_summaries/config.json",
"chars": 119,
"preview": "{\n \"schema\": 1,\n \"description\": \"社区总结\",\n \"execution_settings\": {\n \"default\": {\n \"temperature\": 0\n }\n }\n}"
},
{
"path": "src/GraphRag.Net.Web/graphPlugins/graph/community_summaries/skprompt.txt",
"chars": 62,
"preview": "你是一个AI知识图谱生成助手,需要根据以下社区节点信息来生成社区摘要\n\n节点信息如下:\n{{$nodes}}\n\n社区摘要:\n"
},
{
"path": "src/GraphRag.Net.Web/graphPlugins/graph/create/config.json",
"chars": 176,
"preview": "{\n \"schema\": 1,\n \"description\": \"生成Graph数据\",\n \"execution_settings\": {\n \"default\": {\n \"temperature\": 0,\n "
},
{
"path": "src/GraphRag.Net.Web/graphPlugins/graph/create/skprompt.txt",
"chars": 4857,
"preview": "你是一个专业的AI知识图谱生成助手,专门负责从文本中精确提取实体和关系,并将其转化为结构化的知识图谱数据。\n\n### 背景知识:知识图谱基础结构\n知识图谱由节点(实体)和边(关系)组成:\n\n节点的数据结构:\n- Id: 唯一标识符,格式为\""
},
{
"path": "src/GraphRag.Net.Web/graphPlugins/graph/global_summaries/config.json",
"chars": 119,
"preview": "{\n \"schema\": 1,\n \"description\": \"全局总结\",\n \"execution_settings\": {\n \"default\": {\n \"temperature\": 0\n }\n }\n}"
},
{
"path": "src/GraphRag.Net.Web/graphPlugins/graph/global_summaries/skprompt.txt",
"chars": 68,
"preview": "你是一个AI知识图谱生成助手,需要根据以下社区摘要信息来生成全局摘要\n\n社区摘要信息如下:\n{{$community}}\n\n全局摘要:\n"
},
{
"path": "src/GraphRag.Net.Web/graphPlugins/graph/mergedesc/config.json",
"chars": 127,
"preview": "{\n \"schema\": 1,\n \"description\": \"GraphRag问答\",\n \"execution_settings\": {\n \"default\": {\n \"temperature\": 0.3\n "
},
{
"path": "src/GraphRag.Net.Web/graphPlugins/graph/mergedesc/skprompt.txt",
"chars": 283,
"preview": "以下2段内容均描述同一节点,将内容进行整合,考虑新旧关系,仅返回整合内容\n\n### 示例输入\n旧的描述:我喜欢吃苹果\n新的描述:我喜欢打篮球\n\n### 示例输出\n我喜欢吃苹果和打篮球\n\n---------------------------"
},
{
"path": "src/GraphRag.Net.Web/graphPlugins/graph/relationship/config.json",
"chars": 174,
"preview": "{\n \"schema\": 1,\n \"description\": \"判断节点相关性\",\n \"execution_settings\": {\n \"default\": {\n \"temperature\": 0,\n \"r"
},
{
"path": "src/GraphRag.Net.Web/graphPlugins/graph/relationship/skprompt.txt",
"chars": 412,
"preview": "你是一个AI知识图谱生成助手,给定2个节点的描述,你需要确定他们是否相关,输出json格式,不需要markdown格式。\n\n### 示例输入\nnode1:Name:苹果;Type:Fruit;Desc:一种水果\nnode2:Name:红色;"
},
{
"path": "src/GraphRag.Net.Web/graphPlugins/graph/search/config.json",
"chars": 127,
"preview": "{\n \"schema\": 1,\n \"description\": \"GraphRag问答\",\n \"execution_settings\": {\n \"default\": {\n \"temperature\": 0.3\n "
},
{
"path": "src/GraphRag.Net.Web/graphPlugins/graph/search/skprompt.txt",
"chars": 157,
"preview": "你是一个问答助手,需要根据图谱数据回答用户问题。\n\n<Graph>\n{{$graph}}\n</Graph>\n\n回答要求:\n- 如果你不清楚答案,你需要澄清\n- 避免提及你是从<Graph></Graph>获取的知识\n- 保持答案与<Grap"
},
{
"path": "src/GraphRag.Net.Web/wwwroot/appsettings.json",
"chars": 393,
"preview": "{\n \"ProSettings\": {\n \"NavTheme\": \"dark\",\n \"Layout\": \"side\",\n \"ContentWidth\": \"Fluid\",\n \"FixedHeader\": false"
},
{
"path": "src/GraphRag.Net.Web/wwwroot/css/site.css",
"chars": 1150,
"preview": "/* stylelint-disable at-rule-empty-line-before,at-rule-name-space-after,at-rule-no-unknown */\n/* stylelint-disable no-du"
},
{
"path": "src/GraphRag.Net.Web/wwwroot/data/activities.json",
"chars": 2664,
"preview": "[\n {\n \"id\": \"trend-1\",\n \"updatedAt\": \"2020-08-26T10:21:19.719Z\",\n \"user\": {\n \"name\": \"Qu Lili\",\n \"av"
},
{
"path": "src/GraphRag.Net.Web/wwwroot/data/advanced.json",
"chars": 1413,
"preview": "{\n \"advancedOperation1\": [\n {\n \"key\": \"op1\",\n \"type\": \"Ordering relationship takes effect\",\n \"name\": "
},
{
"path": "src/GraphRag.Net.Web/wwwroot/data/basic.json",
"chars": 1711,
"preview": "{\n \"basicGoods\": [\n {\n \"id\": \"1234561\",\n \"name\": \"Mineral Water 550ml\",\n \"barcode\": \"1242143214321432"
},
{
"path": "src/GraphRag.Net.Web/wwwroot/data/current_user.json",
"chars": 1101,
"preview": "{\n \"name\": \"Serati Ma\",\n \"avatar\": \"https://gw.alipayobjects.com/zos/antfincdn/XAosXuNZyF/BiazfanxmamNRoxxVxka.png\",\n "
},
{
"path": "src/GraphRag.Net.Web/wwwroot/data/fake_chart_data.json",
"chars": 12569,
"preview": "{\n \"visitData\": [\n {\n \"x\": \"2020-08-25\",\n \"y\": 7\n },\n {\n \"x\": \"2020-08-26\",\n \"y\": 5\n },"
},
{
"path": "src/GraphRag.Net.Web/wwwroot/data/fake_list.json",
"chars": 37300,
"preview": "[\n {\n \"id\": \"fake-list-0\",\n \"owner\": \"Fu Xiaoxiao\",\n \"title\": \"Alipay\",\n \"avatar\": \"https://gw.alipayobjec"
},
{
"path": "src/GraphRag.Net.Web/wwwroot/data/menu.json",
"chars": 94,
"preview": "[\n {\n \"path\": \"/chat\",\n \"name\": \"导入与对话\",\n \"key\": \"chat\",\n \"icon\": \"wechat\"\n }\n]"
},
{
"path": "src/GraphRag.Net.Web/wwwroot/data/notice.json",
"chars": 2044,
"preview": "[\n {\n \"id\": \"xxx1\",\n \"title\": \"Alipay\",\n \"logo\": \"https://gw.alipayobjects.com/zos/rmsportal/WdGqmHpayyMjiEhcK"
},
{
"path": "src/GraphRag.Net.Web/wwwroot/data/notices.json",
"chars": 3619,
"preview": "[\n {\n \"id\": \"000000001\",\n \"avatar\": \"https://gw.alipayobjects.com/zos/rmsportal/ThXAXghbEsBCCSDihZxY.pn"
},
{
"path": "src/GraphRag.Net.Web/wwwroot/index.html",
"chars": 7538,
"preview": "<!DOCTYPE html>\n<html lang=\"en\">\n\n<head>\n <meta charset=\"UTF-8\" />\n <meta http-equiv=\"X-UA-Compatible\" content=\"IE=ed"
},
{
"path": "src/GraphRag.Net.Web/wwwroot/js/relation-graph.umd.js",
"chars": 289652,
"preview": "(function(){ try {var elementStyle = document.createElement('style'); elementStyle.appendChild(document.createTextNode(\""
},
{
"path": "src/GraphRag.Net.Web/wwwroot/js/vue2.js",
"chars": 107679,
"preview": "/*!\n * Vue.js v2.7.16\n * (c) 2014-2023 Evan You\n * Released under the MIT License.\n */\n/*!\n * Vue.js v2.7.16\n * (c) 2014"
}
]
About this extraction
This page contains the full source code of the AIDotNet/GraphRag.Net GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 126 files (681.4 KB), approximately 216.7k tokens, and a symbol index with 1214 extracted functions, classes, methods, constants, and types. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.
Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.