Skip to content

Commit

Permalink
删除next版本的chat
Browse files Browse the repository at this point in the history
改成ThorChat版本
  • Loading branch information
239573049 committed Jul 13, 2024
1 parent 1548208 commit b3b20a6
Show file tree
Hide file tree
Showing 1,434 changed files with 99,338 additions and 32,485 deletions.
9 changes: 9 additions & 0 deletions src/Service/FastWiki.Service/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,14 @@ USER app
WORKDIR /app
EXPOSE 8080

FROM node as builder
WORKDIR /src
COPY web .
RUN yarn config set strict-ssl false
RUN npm config set registry https://registry.npmmirror.com
RUN npm i
RUN npm run build

FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build
ARG BUILD_CONFIGURATION=Release
WORKDIR /src
Expand All @@ -25,4 +33,5 @@ RUN dotnet publish "./FastWiki.Service.csproj" -c $BUILD_CONFIGURATION -o /app/p
FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
COPY --from=builder /src/dist ./wwwroot
ENTRYPOINT ["dotnet", "FastWiki.Service.dll"]
22 changes: 22 additions & 0 deletions src/Service/FastWiki.Service/Options/WebOptions.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
namespace FastWiki.Service.Options;

public class WebOptions
{
public static void Init(IConfiguration configuration)
{
DEFAULT_MODEL = Environment.GetEnvironmentVariable("DEFAULT_MODEL") ?? configuration["Thor:DefaultModel"];
DEFAULT_AVATAR = Environment.GetEnvironmentVariable("DEFAULT_AVATAR") ?? configuration["Thor:DefaultAvatar"];
DEFAULT_USER_AVATAR = Environment.GetEnvironmentVariable("DEFAULT_USER_AVATAR") ??
configuration["Thor:DefaultUserAvatar"];
DEFAULT_INBOX_AVATAR = Environment.GetEnvironmentVariable("DEFAULT_INBOX_AVATAR") ??
configuration["Thor:DefaultInboxAvatar"];
}

public static string DEFAULT_MODEL { get; set; } = "gpt-3.5-turbo";

public static string DEFAULT_AVATAR { get; set; } = "🤖";

public static string DEFAULT_USER_AVATAR { get; set; } = "😀";

public static string DEFAULT_INBOX_AVATAR { get; set; } = "🤯";
}
18 changes: 17 additions & 1 deletion src/Service/FastWiki.Service/Program.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
using System.Text.Json;
using AspNetCoreRateLimit;
using FastWiki.Service;
using FastWiki.Service.Backgrounds;
using FastWiki.Service.Options;
using FastWiki.Service.Service;
using Masa.Contrib.Authentication.Identity;
using Microsoft.AspNetCore.StaticFiles;
Expand All @@ -11,7 +13,7 @@
AppContext.SetSwitch("Npgsql.DisableDateTimeInfinityConversions", true);

var builder = WebApplication.CreateBuilder(args);

WebOptions.Init(builder.Configuration);
Logger logger;
if (builder.Environment.IsDevelopment())
{
Expand Down Expand Up @@ -201,6 +203,20 @@
app.UseAuthentication();
app.UseAuthorization();

app.MapGet("/js/env.js", () =>
{
var webEnv = new
{
WebOptions.DEFAULT_AVATAR,
WebOptions.DEFAULT_USER_AVATAR,
WebOptions.DEFAULT_INBOX_AVATAR,
WebOptions.DEFAULT_MODEL,
};

// 返回js
return Results.Text($"window.thor = {JsonSerializer.Serialize(webEnv)};", "application/javascript");
});

app.MapPost("/v1/chat/completions", OpenAIService.Completions)
.WithTags("OpenAI")
.WithGroupName("OpenAI")
Expand Down
2 changes: 1 addition & 1 deletion src/Service/FastWiki.Service/Service/WikiMemoryService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ public MemoryServerless CreateMemoryServerless(SearchClientConfig searchClientCo
/// <returns></returns>
public MemoryServerless CreateMemoryServerless(string? model = null)
{
if (ConnectionStringsOptions.DefaultConnection.IsNullOrEmpty())
if (ConnectionStringsOptions.WikiType == "disk")
{
return new KernelMemoryBuilder()
.WithSimpleVectorDb(new SimpleVectorDbConfig
Expand Down
3 changes: 0 additions & 3 deletions web/.bunfig.toml

This file was deleted.

1 change: 0 additions & 1 deletion web/.changelogrc.js

This file was deleted.

1 change: 0 additions & 1 deletion web/.commitlintrc.js

This file was deleted.

11 changes: 0 additions & 11 deletions web/.dockerignore

This file was deleted.

1 change: 0 additions & 1 deletion web/.env.example

This file was deleted.

1 change: 1 addition & 0 deletions web/.env.samples
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
VITE_API_URL="http://localhost:5269"
32 changes: 0 additions & 32 deletions web/.eslintignore

This file was deleted.

18 changes: 18 additions & 0 deletions web/.eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
module.exports = {
root: true,
env: { browser: true, es2020: true },
extends: [
'eslint:recommended',
'plugin:@typescript-eslint/recommended',
'plugin:react-hooks/recommended',
],
ignorePatterns: ['dist', '.eslintrc.cjs'],
parser: '@typescript-eslint/parser',
plugins: ['react-refresh'],
rules: {
'react-refresh/only-export-components': [
'warn',
{ allowConstantExport: true },
],
},
}
5 changes: 0 additions & 5 deletions web/.eslintrc.js

This file was deleted.

78 changes: 20 additions & 58 deletions web/.gitignore
Original file line number Diff line number Diff line change
@@ -1,62 +1,24 @@
# Gitignore for AIDotNet
################################################################

# general
.DS_Store
.idea
.vscode
.history
.temp
.env.local
venv
temp
tmp

# dependencies
node_modules
# Logs
logs
*.log
*.lock
package-lock.json

# ci
coverage
.coverage
.eslintcache
.stylelintcache
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
lerna-debug.log*

# production
node_modules
dist
es
lib
logs
test-output
dist-ssr
*.local

# umi
.umi
.umi-production
.umi-test
.dumi/tmp*

# husky
.husky/prepare-commit-msg

# misc
# add other ignore file below

# local env files
.env*.local

# vercel
.vercel

# typescript
*.tsbuildinfo
next-env.d.ts
.next
.env
public/*.js
bun.lockb
sitemap*.xml
robots.txt

*.patch
# Editor directories and files
.vscode/*
!.vscode/extensions.json
.idea
.DS_Store
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?
33 changes: 0 additions & 33 deletions web/.i18nrc.js

This file was deleted.

18 changes: 0 additions & 18 deletions web/.npmrc

This file was deleted.

1 change: 0 additions & 1 deletion web/.nvmrc

This file was deleted.

63 changes: 0 additions & 63 deletions web/.prettierignore

This file was deleted.

1 change: 0 additions & 1 deletion web/.prettierrc.js

This file was deleted.

1 change: 0 additions & 1 deletion web/.releaserc.js

This file was deleted.

1 change: 0 additions & 1 deletion web/.remarkrc.js

This file was deleted.

9 changes: 0 additions & 9 deletions web/.seorc.cjs

This file was deleted.

Loading

0 comments on commit b3b20a6

Please sign in to comment.