Compare commits
8 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 51c6600904 | |||
| 34737e4acd | |||
| 418783069b | |||
| 098ecee594 | |||
| 6a8407da48 | |||
| b87b2cad73 | |||
| 6a420983f7 | |||
| 30b52b5d73 |
@@ -277,5 +277,3 @@ pnpm build
|
||||
`src/api/access.ts` 定义 C 端用户、会话和消息响应类型。消息记录第1页为最新内容,每页按发送顺序展示,支持刷新、分页和生成状态查看。原实验账号页面 `/digital/experiment-users` 更名为「实验用户分组」,只针对 C 端用户配置实验。
|
||||
|
||||
用户列表展示账号的 NSFW 开关;创建用户默认开启,编辑用户可单独开启或关闭。与前台「我的」读取和修改同一份服务端账号偏好,不覆盖收藏、称呼或身份背景。已有账号未保存该字段时默认开启,游客的登录限制不变;需与 `access-manage` 配套发布。
|
||||
|
||||
聊天历史中的“前台已删除”显示删除时间,管理员可在会话详情通过“恢复给用户”恢复可见性。接口校验用户归属并记录审计,原消息不重写。
|
||||
|
||||
+1
-2
@@ -1239,10 +1239,9 @@ export type DigitalUser = {
|
||||
conversations: number;
|
||||
messages: number;
|
||||
};
|
||||
/** 用户所属会话的只读摘要,包含前台已删除但后台保留的记录。 */
|
||||
/** 用户所属会话的只读摘要。 */
|
||||
export type UserConversation = {
|
||||
id: string;
|
||||
deletedAt: string | null;
|
||||
title: string;
|
||||
characterId: string;
|
||||
characterName: string;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<script setup lang="ts">
|
||||
/** 独立 C 端用户管理:开户、内容偏好、停用、改密与区分对白/叙述的持久化聊天记录。 */
|
||||
import { onMounted, ref } from "vue";
|
||||
import { ElMessage, ElMessageBox } from "element-plus";
|
||||
import { ElMessage } from "element-plus";
|
||||
import DigitalMessageText from "@/components/DigitalMessageText.vue";
|
||||
import {
|
||||
digital,
|
||||
@@ -171,40 +171,6 @@ async function loadConversations() {
|
||||
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) {
|
||||
active.value = c;
|
||||
messagePage.value = 1;
|
||||
@@ -467,11 +433,7 @@ onMounted(load);
|
||||
@click="chooseConversation(c)"
|
||||
>
|
||||
<strong>{{ c.characterName }}</strong
|
||||
><span
|
||||
>{{ c.title
|
||||
}}<el-tag v-if="c.deletedAt" size="small" type="info"
|
||||
>前台已删除 · {{ time(c.deletedAt) }}</el-tag
|
||||
></span
|
||||
><span>{{ c.title }}</span
|
||||
><small
|
||||
>{{ c.messages }} 条消息 · {{ time(c.updatedAt) }}</small
|
||||
></button
|
||||
@@ -488,12 +450,6 @@ onMounted(load);
|
||||
<template v-if="active"
|
||||
><header>
|
||||
<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
|
||||
>
|
||||
|
||||
Reference in New Issue
Block a user