Skip to content

Commit 80b04b4

Browse files
authored
Merge pull request #254 from AIDotNet/feature/web-spa
Feature/web spa
2 parents 3ccc0f4 + 6924ae2 commit 80b04b4

File tree

416 files changed

+46497
-50615
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

416 files changed

+46497
-50615
lines changed

.github/workflows/docker-image.yml

Lines changed: 36 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,32 @@ on:
55
branches: [ main ]
66
jobs:
77
build:
8-
strategy:
9-
matrix:
10-
image: [
11-
{ name: 'koala-wiki', type: 'backend', dockerfile: 'src/KoalaWiki/Dockerfile', context: '.' },
12-
{ name: 'koala-wiki-web', type: 'frontend', dockerfile: 'web/Dockerfile', context: 'web' }
13-
]
14-
fail-fast: false
158
runs-on: ubuntu-latest
169
steps:
1710
- uses: actions/checkout@v4
1811

12+
- name: Set up Node.js
13+
uses: actions/setup-node@v4
14+
with:
15+
node-version: '20'
16+
cache: 'npm'
17+
cache-dependency-path: 'web-site/package.json'
18+
19+
- name: Install frontend dependencies
20+
run: |
21+
cd web-site
22+
npm ci
23+
24+
- name: Build frontend
25+
run: |
26+
cd web-site
27+
npm run build
28+
29+
- name: Copy frontend build to backend wwwroot
30+
run: |
31+
rm -rf src/KoalaWiki/wwwroot/*
32+
cp -r web-site/dist/* src/KoalaWiki/wwwroot/
33+
1934
- name: Set up Docker Buildx
2035
uses: docker/setup-buildx-action@v3
2136

@@ -26,11 +41,21 @@ jobs:
2641
username: ${{ secrets.DOCKER_USERNAME }}
2742
password: ${{ secrets.DOCKER_PASSWORD }}
2843

29-
- name: Build and push ${{ matrix.image.name }}
44+
- name: Extract version from Directory.Packages.props
45+
id: version
46+
run: |
47+
$versionSuffix = (Select-Xml -Path "Directory.Packages.props" -XPath "//VersionSuffix").Node.InnerText
48+
$version = "0.7.$versionSuffix"
49+
echo "version=$version" >> $env:GITHUB_OUTPUT
50+
echo "Version: $version"
51+
52+
- name: Build and push koala-wiki
3053
uses: docker/build-push-action@v5
3154
with:
32-
context: ${{ matrix.image.context }}
33-
file: ${{ matrix.image.dockerfile }}
55+
context: .
56+
file: src/KoalaWiki/Dockerfile
3457
platforms: linux/arm64,linux/amd64
3558
push: true
36-
tags: crpi-j9ha7sxwhatgtvj4.cn-shenzhen.personal.cr.aliyuncs.com/koala-ai/${{ matrix.image.name }}${{ matrix.image.tag || '' }}
59+
tags: |
60+
crpi-j9ha7sxwhatgtvj4.cn-shenzhen.personal.cr.aliyuncs.com/koala-ai/koala-wiki:latest
61+
crpi-j9ha7sxwhatgtvj4.cn-shenzhen.personal.cr.aliyuncs.com/koala-ai/koala-wiki:${{ steps.version.outputs.version }}

.github/workflows/release.yml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -229,9 +229,11 @@ jobs:
229229
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
230230
echo "version=${{ github.event.inputs.version }}" >> $GITHUB_OUTPUT
231231
else
232-
# 从标签名称中提取版本号
233-
echo "version=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT
232+
# 从Directory.Packages.props文件中提取版本号
233+
version=$(powershell -Command "[xml]\$xml = Get-Content 'Directory.Packages.props'; \$xml.Project.PropertyGroup.Version")
234+
echo "version=v$version" >> $GITHUB_OUTPUT
234235
fi
236+
shell: bash
235237

236238
- name: 生成Release说明
237239
id: release_notes
@@ -301,4 +303,4 @@ jobs:
301303
artifacts/backend-macos-arm64/koala-wiki-backend-macos-arm64.tar.gz
302304
artifacts/frontend/koala-wiki-frontend.tar.gz
303305
env:
304-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
306+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -482,7 +482,7 @@ $RECYCLE.BIN/
482482

483483
# Vim temporary swap files
484484
*.swp
485-
/web/.next
485+
*/.next
486486
/src/KoalaWiki/repositories
487487
/src/KoalaWiki/KoalaWiki.db
488488
/src/KoalaWiki/KoalaWiki.db-*
@@ -492,3 +492,4 @@ $RECYCLE.BIN/
492492
/history
493493
/repositories/aidotnet/Thor
494494
*lock.json
495+
seo-web

Directory.Packages.props

Lines changed: 18 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
44
<VersionSuffix>0</VersionSuffix>
55
<TimeStamp>$([System.DateTime]::UtcNow.ToString("yyyyMMdd"))</TimeStamp>
6-
<Version>0.5.$(VersionSuffix)</Version>
6+
<Version>0.9.$(VersionSuffix)</Version>
77
<!-- 项目信息 -->
88
<Product>OpenDeepWiki</Product>
99
<Title>OpenDeepWiki - AI驱动的代码知识库</Title>
@@ -20,7 +20,6 @@
2020
<PackageLicenseExpression>MIT</PackageLicenseExpression>
2121
<!-- 项目标签 -->
2222
<PackageTags>AI;CodeAnalysis;Documentation;SemanticKernel;Knowledge;Wiki;OpenSource;dotnet9;csharp</PackageTags>
23-
<!-- 技术信息 -->
2423
<TargetFramework>net9.0</TargetFramework>
2524
<LangVersion>latest</LangVersion>
2625
<Nullable>enable</Nullable>
@@ -32,14 +31,15 @@
3231
</PropertyGroup>
3332
<ItemGroup>
3433
<!-- Web API 和 框架包 -->
35-
<PackageVersion Include="AngleSharp" Version="1.3.0" />
34+
<PackageVersion Include="AngleSharp" Version="1.3.1-beta.491" />
3635
<PackageVersion Include="Microsoft.AspNetCore.OpenApi" Version="9.0.7" />
3736
<PackageVersion Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="9.0.7" />
38-
<PackageVersion Include="MySql.EntityFrameworkCore" Version="9.0.3" />
39-
<PackageVersion Include="Scalar.AspNetCore" Version="2.6.5" />
37+
<PackageVersion Include="MySql.EntityFrameworkCore" Version="9.0.6" />
38+
<PackageVersion Include="Scalar.AspNetCore" Version="2.8.3" />
4039
<!-- Entity Framework Core -->
4140
<PackageVersion Include="Microsoft.EntityFrameworkCore" Version="9.0.7" />
4241
<PackageVersion Include="Microsoft.EntityFrameworkCore.Abstractions" Version="9.0.7" />
42+
<PackageVersion Include="Microsoft.EntityFrameworkCore.Relational" Version="9.0.7" />
4343
<PackageVersion Include="Microsoft.EntityFrameworkCore.Design" Version="9.0.7">
4444
<PrivateAssets>all</PrivateAssets>
4545
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
@@ -48,7 +48,6 @@
4848
<PrivateAssets>all</PrivateAssets>
4949
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
5050
</PackageVersion>
51-
<PackageVersion Include="Microsoft.EntityFrameworkCore.Relational" Version="9.0.7" />
5251
<PackageVersion Include="Microsoft.EntityFrameworkCore.Sqlite" Version="9.0.7" />
5352
<PackageVersion Include="Microsoft.EntityFrameworkCore.SqlServer" Version="9.0.6" />
5453
<!-- 数据库提供程序 -->
@@ -57,9 +56,9 @@
5756
<PackageVersion Include="Microsoft.Extensions.Caching.Memory" Version="9.0.7" />
5857
<PackageVersion Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="9.0.7" />
5958
<!-- AI 和 机器学习 -->
60-
<PackageVersion Include="Microsoft.SemanticKernel" Version="1.62.0" />
61-
<PackageVersion Include="Microsoft.SemanticKernel.Connectors.AzureOpenAI" Version="1.62.0" />
62-
<PackageVersion Include="Microsoft.SemanticKernel.Connectors.OpenAI" Version="1.62.0" />
59+
<PackageVersion Include="Microsoft.SemanticKernel" Version="1.65.0" />
60+
<PackageVersion Include="Microsoft.SemanticKernel.Connectors.AzureOpenAI" Version="1.65.0" />
61+
<PackageVersion Include="Microsoft.SemanticKernel.Connectors.OpenAI" Version="1.65.0" />
6362
<PackageVersion Include="Lost.SemanticKernel.Connectors.Anthropic" Version="1.25.0-alpha3" />
6463
<PackageVersion Include="Mem0.NET" Version="1.1.3" />
6564
<!-- AWS SDK - 解决版本冲突 -->
@@ -73,20 +72,20 @@
7372
<!-- JSON 和 序列化 -->
7473
<PackageVersion Include="Newtonsoft.Json" Version="13.0.3" />
7574
<!-- 映射和对象转换 -->
76-
<PackageVersion Include="Mapster.DependencyInjection" Version="1.0.1" />
75+
<PackageVersion Include="Mapster.DependencyInjection" Version="1.0.3-pre02" />
7776
<!-- 日志记录 -->
7877
<PackageVersion Include="Serilog" Version="4.3.0" />
7978
<PackageVersion Include="Serilog.AspNetCore" Version="9.0.0" />
8079
<PackageVersion Include="Serilog.Extensions.Logging" Version="9.0.2" />
8180
<PackageVersion Include="Serilog.Sinks.Console" Version="6.0.0" />
8281
<PackageVersion Include="Serilog.Sinks.File" Version="7.0.0" />
8382
<!-- 弹性和重试 -->
84-
<PackageVersion Include="Polly" Version="8.6.2" />
83+
<PackageVersion Include="Polly" Version="8.6.3" />
8584
<!-- 服务和分析 -->
8685
<PackageVersion Include="FastService" Version="0.2.2" />
8786
<PackageVersion Include="FastService.Analyzers" Version="0.2.2" />
8887
<!-- 协议支持 -->
89-
<PackageVersion Include="ModelContextProtocol.AspNetCore" Version="0.3.0-preview.3" />
88+
<PackageVersion Include="ModelContextProtocol.AspNetCore" Version="0.3.0-preview.4" />
9089
<PackageVersion Include="SharpToken" Version="2.0.4" />
9190
<!-- Thor 框架相关包 (来自子模块) -->
9291
<PackageVersion Include="System.IdentityModel.Tokens.Jwt" Version="8.6.1" />
@@ -101,13 +100,13 @@
101100
<PackageVersion Include="StackExchange.Redis" Version="2.8.31" />
102101
<PackageVersion Include="Microsoft.Extensions.Http.Resilience" Version="9.0.0" />
103102
<PackageVersion Include="Microsoft.Extensions.ServiceDiscovery" Version="9.0.0" />
104-
<PackageVersion Include="OpenTelemetry.Exporter.OpenTelemetryProtocol" Version="1.9.0" />
105-
<PackageVersion Include="OpenTelemetry.Extensions.Hosting" Version="1.9.0" />
106-
<PackageVersion Include="OpenTelemetry.Instrumentation.AspNetCore" Version="1.9.0" />
107-
<PackageVersion Include="OpenTelemetry.Instrumentation.Http" Version="1.9.0" />
108-
<PackageVersion Include="OpenTelemetry.Instrumentation.Runtime" Version="1.9.0" />
109-
<PackageVersion Include="Aspire.Hosting.AppHost" Version="9.0.0" />
110-
<PackageVersion Include="Aspire.Hosting.NodeJs" Version="9.0.0" />
103+
<PackageVersion Include="OpenTelemetry.Exporter.OpenTelemetryProtocol" Version="1.12.0" />
104+
<PackageVersion Include="OpenTelemetry.Extensions.Hosting" Version="1.12.0" />
105+
<PackageVersion Include="OpenTelemetry.Instrumentation.AspNetCore" Version="1.12.0" />
106+
<PackageVersion Include="OpenTelemetry.Instrumentation.Http" Version="1.12.0" />
107+
<PackageVersion Include="OpenTelemetry.Instrumentation.Runtime" Version="1.12.0" />
108+
<PackageVersion Include="Aspire.Hosting.AppHost" Version="9.4.2" />
109+
<PackageVersion Include="Aspire.Hosting.NodeJs" Version="9.4.2" />
111110
<!-- 测试框架 -->
112111
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.12.0" />
113112
<PackageVersion Include="xunit" Version="2.9.2" />

KoalaWiki.Core/DataAccess/IKoalaWikiContext.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,8 @@ public interface IKoalaWikiContext
5252

5353
public DbSet<WarehouseInRole> WarehouseInRoles { get; set; }
5454

55+
public DbSet<WarehouseSyncRecord> WarehouseSyncRecords { get; set; }
56+
5557
public DbSet<AccessRecord> AccessRecords { get; set; }
5658

5759
public DbSet<DailyStatistics> DailyStatistics { get; set; }

KoalaWiki.Core/DataAccess/KoalaWikiContext.cs

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,8 @@ public class KoalaWikiContext<TContext>(DbContextOptions<TContext> options)
5050

5151
public DbSet<WarehouseInRole> WarehouseInRoles { get; set; }
5252

53+
public DbSet<WarehouseSyncRecord> WarehouseSyncRecords { get; set; }
54+
5355
public DbSet<AccessRecord> AccessRecords { get; set; }
5456

5557
public DbSet<DailyStatistics> DailyStatistics { get; set; }
@@ -475,5 +477,34 @@ protected override void OnModelCreating(ModelBuilder modelBuilder)
475477
options.HasIndex(x => x.WarehouseId);
476478
options.HasComment("小地图表");
477479
});
480+
481+
modelBuilder.Entity<WarehouseSyncRecord>(options =>
482+
{
483+
options.HasKey(x => x.Id);
484+
options.Property(x => x.Id).HasComment("主键Id");
485+
options.Property(x => x.WarehouseId).IsRequired().HasComment("仓库Id");
486+
options.Property(x => x.Status).IsRequired().HasComment("同步状态");
487+
options.Property(x => x.StartTime).IsRequired().HasComment("同步开始时间");
488+
options.Property(x => x.EndTime).HasComment("同步结束时间");
489+
options.Property(x => x.FromVersion).HasComment("同步前的版本");
490+
options.Property(x => x.ToVersion).HasComment("同步后的版本");
491+
options.Property(x => x.ErrorMessage).HasComment("错误信息");
492+
options.Property(x => x.FileCount).HasComment("同步的文件数量");
493+
options.Property(x => x.UpdatedFileCount).HasComment("更新的文件数量");
494+
options.Property(x => x.AddedFileCount).HasComment("新增的文件数量");
495+
options.Property(x => x.DeletedFileCount).HasComment("删除的文件数量");
496+
options.Property(x => x.Trigger).IsRequired().HasComment("同步触发方式");
497+
options.Property(x => x.CreatedAt).IsRequired().HasComment("创建时间");
498+
options.HasIndex(x => x.WarehouseId);
499+
options.HasIndex(x => x.Status);
500+
options.HasIndex(x => x.StartTime);
501+
options.HasIndex(x => x.Trigger);
502+
options.HasIndex(x => x.CreatedAt);
503+
options.HasOne(x => x.Warehouse)
504+
.WithMany()
505+
.HasForeignKey(x => x.WarehouseId)
506+
.OnDelete(DeleteBehavior.Cascade);
507+
options.HasComment("仓库同步记录表");
508+
});
478509
}
479510
}

KoalaWiki.Domains/Users/User.cs

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,5 +42,25 @@ public class User : Entity<string>
4242
/// <summary>
4343
/// 用户最后登录IP
4444
/// </summary>
45-
public string? LastLoginIp { get; set; }
45+
public string? LastLoginIp { get; set; }
46+
47+
/// <summary>
48+
/// 用户简介
49+
/// </summary>
50+
public string? Bio { get; set; }
51+
52+
/// <summary>
53+
/// 用户位置
54+
/// </summary>
55+
public string? Location { get; set; }
56+
57+
/// <summary>
58+
/// 用户个人网站
59+
/// </summary>
60+
public string? Website { get; set; }
61+
62+
/// <summary>
63+
/// 用户公司
64+
/// </summary>
65+
public string? Company { get; set; }
4666
}

KoalaWiki.Domains/Warehouse/Warehouse.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,4 +112,9 @@ public class Warehouse : Entity<string>
112112
/// 创建用户id
113113
/// </summary>
114114
public string? UserId { get; set; }
115+
116+
/// <summary>
117+
/// 是否启用同步
118+
/// </summary>
119+
public bool EnableSync { get; set; }
115120
}
Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
using System;
2+
using KoalaWiki.Entities;
3+
4+
namespace KoalaWiki.Domains.Warehouse;
5+
6+
/// <summary>
7+
/// 仓库同步记录
8+
/// </summary>
9+
public class WarehouseSyncRecord : Entity<string>
10+
{
11+
/// <summary>
12+
/// 仓库ID
13+
/// </summary>
14+
public string WarehouseId { get; set; } = string.Empty;
15+
16+
/// <summary>
17+
/// 同步状态 (Success, Failed, InProgress)
18+
/// </summary>
19+
public WarehouseSyncStatus Status { get; set; }
20+
21+
/// <summary>
22+
/// 同步开始时间
23+
/// </summary>
24+
public DateTime StartTime { get; set; }
25+
26+
/// <summary>
27+
/// 同步结束时间
28+
/// </summary>
29+
public DateTime? EndTime { get; set; }
30+
31+
/// <summary>
32+
/// 同步前的版本
33+
/// </summary>
34+
public string? FromVersion { get; set; }
35+
36+
/// <summary>
37+
/// 同步后的版本
38+
/// </summary>
39+
public string? ToVersion { get; set; }
40+
41+
/// <summary>
42+
/// 错误信息
43+
/// </summary>
44+
public string? ErrorMessage { get; set; }
45+
46+
/// <summary>
47+
/// 同步的文件数量
48+
/// </summary>
49+
public int FileCount { get; set; }
50+
51+
/// <summary>
52+
/// 更新的文件数量
53+
/// </summary>
54+
public int UpdatedFileCount { get; set; }
55+
56+
/// <summary>
57+
/// 新增的文件数量
58+
/// </summary>
59+
public int AddedFileCount { get; set; }
60+
61+
/// <summary>
62+
/// 删除的文件数量
63+
/// </summary>
64+
public int DeletedFileCount { get; set; }
65+
66+
/// <summary>
67+
/// 同步触发方式 (Auto, Manual)
68+
/// </summary>
69+
public WarehouseSyncTrigger Trigger { get; set; }
70+
71+
/// <summary>
72+
/// 关联的仓库
73+
/// </summary>
74+
public virtual Warehouse? Warehouse { get; set; }
75+
}
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
namespace KoalaWiki.Domains.Warehouse;
2+
3+
/// <summary>
4+
/// 仓库同步状态
5+
/// </summary>
6+
public enum WarehouseSyncStatus
7+
{
8+
/// <summary>
9+
/// 同步中
10+
/// </summary>
11+
InProgress = 0,
12+
13+
/// <summary>
14+
/// 同步成功
15+
/// </summary>
16+
Success = 1,
17+
18+
/// <summary>
19+
/// 同步失败
20+
/// </summary>
21+
Failed = 2
22+
}

0 commit comments

Comments
 (0)