Compare commits

...

14 Commits

Author SHA1 Message Date
zhanxi c2f1e5492d merge(chat): 同步会话恢复生产版本到测试分支 2026-10-28 11:23:40 +00:00
zhanxi ad13b76475 merge(chat): 支持恢复用户已删除会话 2026-10-28 11:21:28 +00:00
湛兮 8dba72591a feat(users): 支持恢复用户已删除会话
- 用户会话:展示删除时间并提供居中确认恢复
- 异步状态:避免切换用户后迟到结果覆盖详情
- README:说明历史会话恢复能力
2026-10-28 19:19:58 +08:00
zhanxi 54a1e537c3 merge(master): 同步移动键盘优化与会话软删除到测试分支 2026-10-28 08:12:15 +00:00
zhanxi 60bef7436b merge(chat): 标记前台已删除的历史会话 2026-10-28 08:10:13 +00:00
湛兮 6d3f6a0a8e fix(users): 标记前台已删除的历史会话
- 会话摘要增加软删除时间字段
- 后台聊天列表显示前台已删除状态并保留消息查看入口
2026-10-28 16:08:40 +08:00
zhanxi 51c6600904 merge(master): 同步通知教程与通用 Skill 2026-10-28 04:07:06 +00:00
zhanxi 34737e4acd merge(master): 同步对白与叙述排版发布到测试分支 2026-10-27 14:27:10 +00:00
zhanxi 418783069b Merge pull request 'chore: 同步独立用户与聊天管理到测试分支' (#19) from master into develop 2026-10-27 11:02:56 +00:00
zhanxi 098ecee594 Merge pull request 'chore: 同步继续功能与阅读体验发布到测试分支' (#17) from master into develop 2026-10-27 10:16:50 +00:00
zhanxi 6a8407da48 Merge pull request 'chore: 同步用户分组管理发布到测试分支' (#15) from master into develop 2026-10-27 09:15:37 +00:00
zhanxi b87b2cad73 Merge pull request 'chore: 同步完整实验教程发布到测试分支' (#13) from master into develop 2026-10-27 08:15:23 +00:00
zhanxi 6a420983f7 Merge pull request 'chore: 同步多组实验发布到测试分支' (#11) from master into develop 2026-10-27 07:16:30 +00:00
zhanxi 30b52b5d73 Merge pull request 'chore: 同步空白实验配置发布到测试分支' (#9) from master into develop 2026-10-27 06:44:16 +00:00
3 changed files with 50 additions and 3 deletions
+2
View File
@@ -277,3 +277,5 @@ pnpm build
`src/api/access.ts` 定义 C 端用户、会话和消息响应类型。消息记录第1页为最新内容,每页按发送顺序展示,支持刷新、分页和生成状态查看。原实验账号页面 `/digital/experiment-users` 更名为「实验用户分组」,只针对 C 端用户配置实验。 `src/api/access.ts` 定义 C 端用户、会话和消息响应类型。消息记录第1页为最新内容,每页按发送顺序展示,支持刷新、分页和生成状态查看。原实验账号页面 `/digital/experiment-users` 更名为「实验用户分组」,只针对 C 端用户配置实验。
用户列表展示账号的 NSFW 开关;创建用户默认开启,编辑用户可单独开启或关闭。与前台「我的」读取和修改同一份服务端账号偏好,不覆盖收藏、称呼或身份背景。已有账号未保存该字段时默认开启,游客的登录限制不变;需与 `access-manage` 配套发布。 用户列表展示账号的 NSFW 开关;创建用户默认开启,编辑用户可单独开启或关闭。与前台「我的」读取和修改同一份服务端账号偏好,不覆盖收藏、称呼或身份背景。已有账号未保存该字段时默认开启,游客的登录限制不变;需与 `access-manage` 配套发布。
聊天历史中的“前台已删除”显示删除时间,管理员可在会话详情通过“恢复给用户”恢复可见性。接口校验用户归属并记录审计,原消息不重写。
+2 -1
View File
@@ -1239,9 +1239,10 @@ export type DigitalUser = {
conversations: number; conversations: number;
messages: number; messages: number;
}; };
/** 用户所属会话的只读摘要。 */ /** 用户所属会话的只读摘要,包含前台已删除但后台保留的记录。 */
export type UserConversation = { export type UserConversation = {
id: string; id: string;
deletedAt: string | null;
title: string; title: string;
characterId: string; characterId: string;
characterName: string; characterName: string;
+46 -2
View File
@@ -1,7 +1,7 @@
<script setup lang="ts"> <script setup lang="ts">
/** 独立 C 端用户管理:开户、内容偏好、停用、改密与区分对白/叙述的持久化聊天记录。 */ /** 独立 C 端用户管理:开户、内容偏好、停用、改密与区分对白/叙述的持久化聊天记录。 */
import { onMounted, ref } from "vue"; import { onMounted, ref } from "vue";
import { ElMessage } from "element-plus"; import { ElMessage, ElMessageBox } from "element-plus";
import DigitalMessageText from "@/components/DigitalMessageText.vue"; import DigitalMessageText from "@/components/DigitalMessageText.vue";
import { import {
digital, digital,
@@ -171,6 +171,40 @@ async function loadConversations() {
if (version === chatVersion) conversationLoading.value = false; if (version === chatVersion) conversationLoading.value = false;
} }
} }
const restoring = ref(false);
/** 恢复仅作用于选中的用户和会话,切换用户后的迟到结果不能覆盖当前详情。 */
async function restoreChat() {
if (!selected.value || !active.value?.deletedAt || restoring.value) return;
const user = selected.value.id,
conversation = active.value.id;
try {
await ElMessageBox.confirm(
"恢复后用户可在前台继续查看这段对话,原消息不会改变。",
"恢复会话",
{ type: "info" }
);
} catch {
return;
}
restoring.value = true;
try {
await digital(
`users/${user}/conversations/${conversation}/restore`,
"post",
{}
);
if (selected.value?.id === user) {
if (active.value?.id === conversation)
active.value = { ...active.value, deletedAt: null };
await loadConversations();
}
ElMessage.success("会话已恢复");
} catch (e) {
ElMessage.error(e instanceof Error ? e.message : "恢复失败");
} finally {
restoring.value = false;
}
}
async function chooseConversation(c: UserConversation) { async function chooseConversation(c: UserConversation) {
active.value = c; active.value = c;
messagePage.value = 1; messagePage.value = 1;
@@ -433,7 +467,11 @@ onMounted(load);
@click="chooseConversation(c)" @click="chooseConversation(c)"
> >
<strong>{{ c.characterName }}</strong <strong>{{ c.characterName }}</strong
><span>{{ c.title }}</span ><span
>{{ c.title
}}<el-tag v-if="c.deletedAt" size="small" type="info"
>前台已删除 · {{ time(c.deletedAt) }}</el-tag
></span
><small ><small
>{{ c.messages }} 条消息 · {{ time(c.updatedAt) }}</small >{{ c.messages }} 条消息 · {{ time(c.updatedAt) }}</small
></button ></button
@@ -450,6 +488,12 @@ onMounted(load);
<template v-if="active" <template v-if="active"
><header> ><header>
<strong>{{ active.characterName }} · {{ active.title }}</strong <strong>{{ active.characterName }} · {{ active.title }}</strong
><el-button
v-if="active.deletedAt"
size="small"
:loading="restoring"
@click="restoreChat"
>恢复给用户</el-button
><el-button size="small" @click="loadMessages" ><el-button size="small" @click="loadMessages"
>刷新记录</el-button >刷新记录</el-button
> >