Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/chat span #21

Merged
merged 105 commits into from
Jan 1, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
105 commits
Select commit Hold shift + click to select a range
ec18a48
chat-span db migration
sdcb Dec 17, 2024
72a92e5
fix UserChatsController
sdcb Dec 17, 2024
54e299b
fix all compilation error
sdcb Dec 17, 2024
5bf9f9f
Merge branch 'dev' into feature/chat-span
sdcb Dec 18, 2024
bd105e7
Merge branch 'dev' of private:sdcb/chats into feature/chat-span
greywen Dec 18, 2024
5ceec85
add select multiple model
greywen Dec 18, 2024
085dddd
merge code
greywen Dec 18, 2024
93f7f18
fix merge compilation error
sdcb Dec 18, 2024
6a7e4ee
fast fix frontend issues
sdcb Dec 18, 2024
8f86818
add spanid in message
sdcb Dec 18, 2024
8f26380
Merge branch 'dev' into feature/chat-span
sdcb Dec 18, 2024
2edc260
fix new chat issue
sdcb Dec 18, 2024
ce9fd89
add CUD support for chat span
sdcb Dec 18, 2024
bf3fa97
Merge branch 'feature/chat-span' of private:sdcb/chats into feature/c…
greywen Dec 18, 2024
b7f3e8f
chat span be
sdcb Dec 18, 2024
f10252b
spanid nullable in message
sdcb Dec 18, 2024
3d7e442
Merge branch 'wip/feature/chat-span-be' into feature/chat-span
sdcb Dec 19, 2024
65cea15
new chat response
sdcb Dec 19, 2024
8dbc66f
db updates
sdcb Dec 19, 2024
51b04e3
try find available span id
sdcb Dec 19, 2024
75bfba5
fix fe build error
greywen Dec 19, 2024
6766fc8
on the road to multi chat
sdcb Dec 19, 2024
4811044
can chat now
sdcb Dec 19, 2024
5fa41bd
Merge branch 'feature/chat-span' of private:sdcb/chats into feature/c…
greywen Dec 19, 2024
1dcd8af
fix openai timestamp compilation issue
sdcb Dec 19, 2024
3b04dcf
don't need to speicify model id because it's retrived in span
sdcb Dec 19, 2024
9270f14
use enum role
sdcb Dec 19, 2024
eddcc32
remove useless code
sdcb Dec 19, 2024
8261efa
Merge branch 'dev' into feature/chat-span
sdcb Dec 20, 2024
02e9ae8
Merge branch 'dev' into feature/chat-span
sdcb Dec 20, 2024
e3b5564
multiple model chat ui
greywen Dec 20, 2024
543e8b7
Merge branch 'feature/chat-span' of private:sdcb/chats into feature/c…
greywen Dec 20, 2024
3f62c9e
Merge pull request #18 from sdcb/dev
sdcb Dec 21, 2024
1efa00a
Merge branch 'dev' into feature/chat-span
sdcb Dec 23, 2024
fd0ac0d
fix fe build error
greywen Dec 23, 2024
89b93b9
multiple models chat
greywen Dec 23, 2024
11dc3c5
multiple models chat
greywen Dec 23, 2024
0286b4c
Merge branch 'feature/chat-span' of private:sdcb/chats into feature/c…
greywen Dec 23, 2024
e1bd7fb
rename into system prompt
sdcb Dec 23, 2024
e3e02cd
return badrequest when modelstate invalid
sdcb Dec 23, 2024
906292c
Merge branch 'feature/chat-span' of private:sdcb/chats into feature/c…
greywen Dec 23, 2024
0466419
save span after chat complete
sdcb Dec 23, 2024
7a81d5f
fix the issue cannot create chat
sdcb Dec 23, 2024
ae04337
it should can create chat now
sdcb Dec 23, 2024
642671f
fix chat issue
sdcb Dec 23, 2024
2815586
Merge branch 'feature/chat-span' of private:sdcb/chats into feature/c…
greywen Dec 23, 2024
fc0a40d
fix missing user message issue
sdcb Dec 23, 2024
0036b4e
fix issue causing parent not set
sdcb Dec 23, 2024
f040183
Merge branch 'feature/chat-span' of https://github.com/sdcb/chats int…
sdcb Dec 23, 2024
2827991
multiple models chat
greywen Dec 24, 2024
d69e56e
update document
sdcb Dec 24, 2024
07b05f7
parent message is not necessary a user message
sdcb Dec 24, 2024
38bb66c
Merge branch 'main' into feature/chat-span
sdcb Dec 24, 2024
204b150
ensure only one of parent and parent id will be set
sdcb Dec 24, 2024
a5d20c6
Merge branch 'feature/chat-span' of private:sdcb/chats into feature/c…
greywen Dec 24, 2024
d996d53
fix yield title issue
sdcb Dec 24, 2024
9b958ff
fix re-chat issue
sdcb Dec 24, 2024
178f528
multiple models chat
greywen Dec 24, 2024
33d73bd
Merge branch 'feature/chat-span' of private:sdcb/chats into feature/c…
greywen Dec 24, 2024
7026e1e
3 new chat api
sdcb Dec 24, 2024
062f72b
update model names
sdcb Dec 24, 2024
989c9fc
correct span request
sdcb Dec 24, 2024
db0e33e
add json annotation to chatspanrequest
sdcb Dec 24, 2024
037e643
fix parent id issue
sdcb Dec 24, 2024
aa96423
Merge branch 'feature/chat-span' of https://github.com/sdcb/chats int…
sdcb Dec 24, 2024
02a8046
basic multiple model chat done
greywen Dec 25, 2024
88fac71
multiple model chat done
greywen Dec 25, 2024
169b8d5
Merge branch 'feature/chat-span' of private:sdcb/chats into feature/c…
greywen Dec 25, 2024
23a7805
remove logs/adjust ui
greywen Dec 25, 2024
9969cd2
Merge branch 'feature/chat-span' of private:sdcb/chats into feature/c…
greywen Dec 25, 2024
f1cc34d
adjust ui
greywen Dec 25, 2024
c92f58a
add leaf message id
sdcb Dec 25, 2024
bf7f01c
Merge branch 'feature/chat-span' of https://github.com/sdcb/chats int…
sdcb Dec 25, 2024
2ff0fe7
adjust temperature slider ui
greywen Dec 26, 2024
2369b24
model setting done
greywen Dec 26, 2024
90969cd
add chat params
greywen Dec 26, 2024
1076191
can delete span with messages
sdcb Dec 26, 2024
d269c4a
don't always find span id from 0
sdcb Dec 26, 2024
ef06e95
optimize chat
greywen Dec 26, 2024
b1def27
Merge branch 'feature/chat-span' of private:sdcb/chats into feature/c…
greywen Dec 26, 2024
c06739d
add chat icon
greywen Dec 26, 2024
d56ea00
async end
sdcb Dec 26, 2024
b7f188d
add model provider in response
sdcb Dec 26, 2024
086eb1d
Merge branch 'feature/chat-span' of https://github.com/sdcb/chats int…
sdcb Dec 26, 2024
402d1d3
don't yield user message 2 times
sdcb Dec 26, 2024
8efd50b
fix can't add the 3rd span issue
sdcb Dec 26, 2024
0b0e3fb
Merge branch 'feature/chat-span' of https://github.com/sdcb/chats int…
sdcb Dec 26, 2024
f709e2a
save leafmessageid
greywen Dec 27, 2024
67a5cee
optimize chat
greywen Dec 27, 2024
1edb477
move chat private into private
sdcb Dec 27, 2024
e7ed7e8
add upload default api
sdcb Dec 27, 2024
bdc24f6
Merge branch 'feature/chat-span' of private:sdcb/chats into feature/c…
greywen Dec 27, 2024
da310a6
extract ChatMessage component
greywen Dec 27, 2024
35f24c5
fix build error
greywen Dec 27, 2024
527c8b1
fix prompt create issues
greywen Dec 27, 2024
7604efa
remove useless code
greywen Dec 27, 2024
fae47ce
adjust error message location
greywen Dec 27, 2024
c271e6c
fix first access show error
greywen Dec 27, 2024
3b54aac
no data display
greywen Dec 30, 2024
2326903
fix build error
greywen Dec 30, 2024
bf6433e
adjust icon size
greywen Dec 30, 2024
db3c044
adjust ModelHeader ui component
greywen Dec 30, 2024
5ae906e
fix chat no prompt
greywen Dec 31, 2024
4f58d92
Merge branch 'dev' into feature/chat-span
sdcb Jan 1, 2025
8d6cbe0
supports backend transform
sdcb Jan 1, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 22 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,17 +80,17 @@ Chats提供了以下几个镜像:

对于不便使用 Docker 部署的环境,Chats 提供了 8 种操作系统或架构的直接部署选项。可从以下链接获取相应的编译包:

| 平台 | Github下载链接 | 替代下载链接 |
| 平台 | Github下载链接 | 国内下载链接 |
| ---------------- | --------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------ |
| Windows 64位 | [chats-win-x64.zip](https://github.com/sdcb/chats/releases/latest/download/chats-win-x64.zip) | [chats-win-x64.zip](https://io.starworks.cc:88/chats/latest/chats-win-x64.zip) |
| Linux 64位 | [chats-linux-x64.zip](https://github.com/sdcb/chats/releases/latest/download/chats-linux-x64.zip) | [chats-linux-x64.zip](https://io.starworks.cc:88/chats/latest/chats-linux-x64.zip) |
| Linux ARM64 | [chats-linux-arm64.zip](https://github.com/sdcb/chats/releases/latest/download/chats-linux-arm64.zip) | [chats-linux-arm64.zip](https://io.starworks.cc:88/chats/latest/chats-linux-arm64.zip) |
| Linux musl x64 | [chats-linux-musl-x64.zip](https://github.com/sdcb/chats/releases/latest/download/chats-linux-musl-x64.zip) | [chats-linux-musl-x64.zip](https://io.starworks.cc:88/chats/latest/chats-linux-musl-x64.zip) |
| Linux musl ARM64 | [chats-linux-musl-arm64.zip](https://github.com/sdcb/chats/releases/latest/download/chats-linux-musl-arm64.zip) | [chats-linux-musl-arm64.zip](https://io.starworks.cc:88/chats/latest/chats-linux-musl-arm64.zip) |
| macOS ARM64 | [chats-osx-arm64.zip](https://github.com/sdcb/chats/releases/latest/download/chats-osx-arm64.zip) | [chats-osx-arm64.zip](https://io.starworks.cc:88/chats/latest/chats-osx-arm64.zip) |
| macOS x64 | [chats-osx-x64.zip](https://github.com/sdcb/chats/releases/latest/download/chats-osx-x64.zip) | [chats-osx-x64.zip](https://io.starworks.cc:88/chats/latest/chats-osx-x64.zip) |
| 依赖.NET的通用包 | [chats.zip](https://github.com/sdcb/chats/releases/latest/download/chats.zip) | [chats.zip](https://io.starworks.cc:88/chats/latest/chats.zip) |
| 纯前端文件 | [chats-fe.zip](https://github.com/sdcb/chats/releases/latest/download/chats-fe.zip) | [chats-fe.zip](https://io.starworks.cc:88/chats/latest/chats-fe.zip) |
| Windows 64位 | [chats-win-x64.zip](https://github.com/sdcb/chats/releases/latest/download/chats-win-x64.zip) | [chats-win-x64.7z](https://io.starworks.cc:88/chats/latest/chats-win-x64.7z) |
| Linux 64位 | [chats-linux-x64.zip](https://github.com/sdcb/chats/releases/latest/download/chats-linux-x64.zip) | [chats-linux-x64.7z](https://io.starworks.cc:88/chats/latest/chats-linux-x64.7z) |
| Linux ARM64 | [chats-linux-arm64.zip](https://github.com/sdcb/chats/releases/latest/download/chats-linux-arm64.zip) | [chats-linux-arm64.7z](https://io.starworks.cc:88/chats/latest/chats-linux-arm64.7z) |
| Linux musl x64 | [chats-linux-musl-x64.zip](https://github.com/sdcb/chats/releases/latest/download/chats-linux-musl-x64.zip) | [chats-linux-musl-x64.7z](https://io.starworks.cc:88/chats/latest/chats-linux-musl-x64.7z) |
| Linux musl ARM64 | [chats-linux-musl-arm64.zip](https://github.com/sdcb/chats/releases/latest/download/chats-linux-musl-arm64.zip) | [chats-linux-musl-arm64.7z](https://io.starworks.cc:88/chats/latest/chats-linux-musl-arm64.7z) |
| macOS ARM64 | [chats-osx-arm64.zip](https://github.com/sdcb/chats/releases/latest/download/chats-osx-arm64.zip) | [chats-osx-arm64.7z](https://io.starworks.cc:88/chats/latest/chats-osx-arm64.7z) |
| macOS x64 | [chats-osx-x64.zip](https://github.com/sdcb/chats/releases/latest/download/chats-osx-x64.zip) | [chats-osx-x64.7z](https://io.starworks.cc:88/chats/latest/chats-osx-x64.7z) |
| 依赖.NET的通用包 | [chats.zip](https://github.com/sdcb/chats/releases/latest/download/chats.zip) | [chats.7z](https://io.starworks.cc:88/chats/latest/chats.7z) |
| 纯前端文件 | [chats-fe.zip](https://github.com/sdcb/chats/releases/latest/download/chats-fe.zip) | [chats-fe.7z](https://io.starworks.cc:88/chats/latest/chats-fe.7z) |

### 版本和下载说明

Expand All @@ -107,7 +107,7 @@ Chats提供了以下几个镜像:
```
- 例如,通过替代下载直接获取最新的 Windows 64-bit 版:
```
https://io.starworks.cc:88/chats/latest/chats-win-x64.zip
https://io.starworks.cc:88/chats/latest/chats-win-x64.7z
```

### 执行文件目录结构和运行说明
Expand Down Expand Up @@ -141,12 +141,16 @@ C:\Users\ZhouJie\Downloads\chats-win-x64>dir

- 对于下载的 `chats.zip`,将需要.NET SDK支持。安装.NET运行时后,使用 `dotnet Chats.BE.dll` 启动程序。

### 支持的大模型
### 支持的大模型服务

- OpenAI OpenAI
- Azure(或兼容OpenAI协议的API,如ollama)
- 通义千问(Dashscope)
- Azure OpenAI
- 腾讯混元(HunYuan)
- 零一万物(01.ai)
- 月之暗面(Moonshot)
- 文心一言(Wenxin Qianfan)
- 智谱清言(Zhipu AI)
- ...
- OpenAI(或兼容OpenAI协议的API,如ollama)
- 文心千帆(Wenxin Qianfan)
- 阿里灵积大模型平台(Aliyun DashScope)
- 讯飞星火(Xunfei Sparkdesk)
- DeepSeek
- x.AI
- Github Models
38 changes: 21 additions & 17 deletions README_EN.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,15 +80,15 @@ For environments where using Docker is inconvenient, Chats provides direct deplo

| Platform | GitHub Download Link | Alternative Download Link |
| --------------------- | ---------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------- |
| Windows 64-bit | [chats-win-x64.zip](https://github.com/sdcb/chats/releases/latest/download/chats-win-x64.zip) | [chats-win-x64.zip](https://io.starworks.cc:88/chats/latest/chats-win-x64.zip) |
| Linux 64-bit | [chats-linux-x64.zip](https://github.com/sdcb/chats/releases/latest/download/chats-linux-x64.zip) | [chats-linux-x64.zip](https://io.starworks.cc:88/chats/latest/chats-linux-x64.zip) |
| Linux ARM64 | [chats-linux-arm64.zip](https://github.com/sdcb/chats/releases/latest/download/chats-linux-arm64.zip) | [chats-linux-arm64.zip](https://io.starworks.cc:88/chats/latest/chats-linux-arm64.zip) |
| Linux musl x64 | [chats-linux-musl-x64.zip](https://github.com/sdcb/chats/releases/latest/download/chats-linux-musl-x64.zip) | [chats-linux-musl-x64.zip](https://io.starworks.cc:88/chats/latest/chats-linux-musl-x64.zip) |
| Linux musl ARM64 | [chats-linux-musl-arm64.zip](https://github.com/sdcb/chats/releases/latest/download/chats-linux-musl-arm64.zip) | [chats-linux-musl-arm64.zip](https://io.starworks.cc:88/chats/latest/chats-linux-musl-arm64.zip) |
| macOS ARM64 | [chats-osx-arm64.zip](https://github.com/sdcb/chats/releases/latest/download/chats-osx-arm64.zip) | [chats-osx-arm64.zip](https://io.starworks.cc:88/chats/latest/chats-osx-arm64.zip) |
| macOS x64 | [chats-osx-x64.zip](https://github.com/sdcb/chats/releases/latest/download/chats-osx-x64.zip) | [chats-osx-x64.zip](https://io.starworks.cc:88/chats/latest/chats-osx-x64.zip) |
| Generic package dependent on .NET | [chats.zip](https://github.com/sdcb/chats/releases/latest/download/chats.zip) | [chats.zip](https://io.starworks.cc:88/chats/latest/chats.zip) |
| Pure front-end files | [chats-fe.zip](https://github.com/sdcb/chats/releases/latest/download/chats-fe.zip) | [chats-fe.zip](https://io.starworks.cc:88/chats/latest/chats-fe.zip) |
| Windows 64-bit | [chats-win-x64.zip](https://github.com/sdcb/chats/releases/latest/download/chats-win-x64.zip) | [chats-win-x64.7z](https://io.starworks.cc:88/chats/latest/chats-win-x64.7z) |
| Linux 64-bit | [chats-linux-x64.zip](https://github.com/sdcb/chats/releases/latest/download/chats-linux-x64.zip) | [chats-linux-x64.7z](https://io.starworks.cc:88/chats/latest/chats-linux-x64.7z) |
| Linux ARM64 | [chats-linux-arm64.zip](https://github.com/sdcb/chats/releases/latest/download/chats-linux-arm64.zip) | [chats-linux-arm64.7z](https://io.starworks.cc:88/chats/latest/chats-linux-arm64.7z) |
| Linux musl x64 | [chats-linux-musl-x64.zip](https://github.com/sdcb/chats/releases/latest/download/chats-linux-musl-x64.zip) | [chats-linux-musl-x64.7z](https://io.starworks.cc:88/chats/latest/chats-linux-musl-x64.7z) |
| Linux musl ARM64 | [chats-linux-musl-arm64.zip](https://github.com/sdcb/chats/releases/latest/download/chats-linux-musl-arm64.zip) | [chats-linux-musl-arm64.7z](https://io.starworks.cc:88/chats/latest/chats-linux-musl-arm64.7z) |
| macOS ARM64 | [chats-osx-arm64.zip](https://github.com/sdcb/chats/releases/latest/download/chats-osx-arm64.zip) | [chats-osx-arm64.7z](https://io.starworks.cc:88/chats/latest/chats-osx-arm64.7z) |
| macOS x64 | [chats-osx-x64.zip](https://github.com/sdcb/chats/releases/latest/download/chats-osx-x64.zip) | [chats-osx-x64.7z](https://io.starworks.cc:88/chats/latest/chats-osx-x64.7z) |
| Generic package dependent on .NET | [chats.zip](https://github.com/sdcb/chats/releases/latest/download/chats.zip) | [chats.7z](https://io.starworks.cc:88/chats/latest/chats.7z) |
| Pure front-end files | [chats-fe.zip](https://github.com/sdcb/chats/releases/latest/download/chats-fe.zip) | [chats-fe.7z](https://io.starworks.cc:88/chats/latest/chats-fe.7z) |

### Version and Download Instructions

Expand All @@ -105,7 +105,7 @@ For environments where using Docker is inconvenient, Chats provides direct deplo
```
- For example, to directly download the latest Windows 64-bit version via the alternative download:
```
https://io.starworks.cc:88/chats/latest/chats-win-x64.zip
https://io.starworks.cc:88/chats/latest/chats-win-x64.7z
```

### Executable Directory Structure and Running Instructions
Expand Down Expand Up @@ -141,10 +141,14 @@ C:\Users\ZhouJie\Downloads\chats-win-x64>dir

### Supported LLMs

- OpenAI OpenAI
- Azure(or OpenAI API compatible APIs, like ollama)
- Aliyun Dashscope(通义千问)
- Moonshot(月之暗面)
- Wenxin Qianfan(文心千帆大模型平台)
- Zhipu AI(智谱清言)
- ...
- Azure OpenAI
- Tencent HunYuan
- 01.ai
- Moonshot
- OpenAI (or OpenAI API compatible APIs, like ollama)
- Wenxin Qianfan
- Aliyun DashScope
- Xunfei Sparkdesk
- DeepSeek
- x.AI
- GitHub Models
47 changes: 28 additions & 19 deletions src/BE/Controllers/Admin/AdminMessage/AdminMessageController.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using Chats.BE.Controllers.Admin.AdminMessage.Dtos;
using Chats.BE.Controllers.Admin.Common;
using Chats.BE.Controllers.Chats.Chats.Dtos;
using Chats.BE.Controllers.Chats.UserChats.Dtos;
using Chats.BE.Controllers.Common.Dtos;
using Chats.BE.DB;
using Chats.BE.DB.Enums;
Expand All @@ -24,27 +25,29 @@ public async Task<ActionResult<PagedResult<AdminChatsDto>>> GetMessages([FromQue
.Where(x => x.User.Role != "admin" || x.UserId == currentUser.Id);
if (!string.IsNullOrEmpty(req.Query))
{
chats = chats.Where(x => x.User.Username == req.Query);
chats = chats.Where(x => x.User.UserName == req.Query);
}

return await PagedResult.FromTempQuery(chats
return await PagedResult.FromQuery(chats
.OrderByDescending(x => x.CreatedAt)
.Select(x => new AdminChatsDtoTemp
.Select(x => new AdminChatsDto
{
Id = x.Id,
Id = idEncryption.EncryptChatId(x.Id),
CreatedAt = x.CreatedAt,
IsDeleted = x.IsDeleted,
IsShared = x.IsShared,
ModelName = x.Model.Name,
Title = x.Title,
UserName = x.User.Username,
//Cost = x.Messages.Select(x => x.Usage).Sum(x => x.InputCost + x.OutputCost)
JsonUserModelConfig = new JsonUserModelConfig()
UserName = x.User.UserName,
Spans = x.ChatSpans.Select(s => new ChatSpanDto
{
Temperature = x.Temperature,
EnableSearch = x.EnableSearch,
},
}), req, x => x.ToDto(), cancellationToken);
SpanId = s.SpanId,
ModelId = s.ModelId,
ModelName = s.Model.Name,
ModelProviderId = s.Model.ModelKey.ModelProviderId,
Temperature = s.Temperature,
EnableSearch = s.EnableSearch,
}).ToArray(),
}), req, cancellationToken);
}

[HttpGet("message-details")]
Expand All @@ -55,19 +58,25 @@ public async Task<ActionResult<AdminMessageRoot>> GetAdminMessage(int chatId,
return await GetAdminMessageInternal(db, chatId, idEncryption, fup, cancellationToken);
}

internal static async Task<ActionResult<AdminMessageRoot>> GetAdminMessageInternal(ChatsDB db, int conversationId,
internal static async Task<ActionResult<AdminMessageRoot>> GetAdminMessageInternal(ChatsDB db, int chatId,
IUrlEncryptionService urlEncryption,
FileUrlProvider fup,
CancellationToken cancellationToken)
{
AdminMessageDtoTemp? adminMessageTemp = await db.Chats
.Where(x => x.Id == conversationId)
.Where(x => x.Id == chatId)
.Select(x => new AdminMessageDtoTemp()
{
Name = x.Title,
ModelName = x.Model.Name,
Temperature = x.Temperature,
DeploymentName = x.Model.DeploymentName,
Spans = x.ChatSpans.Select(s => new ChatSpanDto
{
SpanId = s.SpanId,
ModelId = s.ModelId,
ModelName = s.Model.Name,
ModelProviderId = s.Model.ModelKey.ModelProviderId,
Temperature = s.Temperature,
EnableSearch = s.EnableSearch,
}).ToArray()
})
.SingleOrDefaultAsync(cancellationToken);
if (adminMessageTemp == null) return new NotFoundResult();
Expand All @@ -76,7 +85,7 @@ internal static async Task<ActionResult<AdminMessageRoot>> GetAdminMessageIntern
.Include(x => x.MessageContents).ThenInclude(x => x.MessageContentBlob)
.Include(x => x.MessageContents).ThenInclude(x => x.MessageContentFile).ThenInclude(x => x!.File).ThenInclude(x => x.FileService)
.Include(x => x.MessageContents).ThenInclude(x => x.MessageContentText)
.Where(x => x.ChatId == conversationId)
.Where(x => x.ChatId == chatId)
.Select(x => new AdminMessageItemTemp
{
Id = x.Id,
Expand All @@ -98,7 +107,7 @@ internal static async Task<ActionResult<AdminMessageRoot>> GetAdminMessageIntern
.ToArrayAsync(cancellationToken);

AdminMessageBasicItem[] items = AdminMessageItemTemp.ToDtos(messagesTemp, urlEncryption, fup);
AdminMessageRoot dto = adminMessageTemp.ToDto(items);
AdminMessageRoot dto = adminMessageTemp.Combine(items);

return new OkObjectResult(dto);
}
Expand Down
43 changes: 3 additions & 40 deletions src/BE/Controllers/Admin/AdminMessage/Dtos/AdminChatsDto.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using Chats.BE.DB.Jsons;
using Chats.BE.Controllers.Chats.UserChats.Dtos;
using System.Text.Json.Serialization;

namespace Chats.BE.Controllers.Admin.AdminMessage.Dtos;
Expand All @@ -14,52 +14,15 @@ public record AdminChatsDto
[JsonPropertyName("title")]
public required string Title { get; init; }

[JsonPropertyName("modelName")]
public required string ModelName { get; init; }

[JsonPropertyName("isDeleted")]
public required bool IsDeleted { get; init; }

[JsonPropertyName("isShared")]
public required bool IsShared { get; init; }

[JsonPropertyName("userModelConfig")]
public required JsonUserModelConfig UserModelConfig { get; init; }
[JsonPropertyName("spans")]
public required ChatSpanDto[] Spans { get; init; }

[JsonPropertyName("createdAt")]
public required DateTime CreatedAt { get; init; }
}

public record AdminChatsDtoTemp
{
public required int Id { get; init; }

public required string UserName { get; init; }

public required string Title { get; init; }

public required string ModelName { get; init; }

public required bool IsDeleted { get; init; }

public required bool IsShared { get; init; }

public required JsonUserModelConfig JsonUserModelConfig { get; init; }

public required DateTime CreatedAt { get; init; }

public AdminChatsDto ToDto()
{
return new AdminChatsDto
{
Id = Id.ToString(),
UserName = UserName,
Title = Title,
ModelName = ModelName,
IsDeleted = IsDeleted,
IsShared = IsShared,
UserModelConfig = JsonUserModelConfig,
CreatedAt = CreatedAt
};
}
}
Loading
Loading