merge(nsfw): 发布登录账号成人内容偏好
合入已验证的 NSFW 账号偏好改动,游客登录限制保持不变。
This commit is contained in:
@@ -253,3 +253,5 @@ pnpm build
|
|||||||
`src/views/digital/users.vue` 对应 `/digital/users`,用于创建独立 C 端账号、搜索用户、修改昵称/状态、重置密码,以及按用户查看数字人会话和原始消息。账号由后台开通,无公开注册;与管理员/员工账号分别鉴权,重置 C 端密码不影响后台。停用保留聊天记录。
|
`src/views/digital/users.vue` 对应 `/digital/users`,用于创建独立 C 端账号、搜索用户、修改昵称/状态、重置密码,以及按用户查看数字人会话和原始消息。账号由后台开通,无公开注册;与管理员/员工账号分别鉴权,重置 C 端密码不影响后台。停用保留聊天记录。
|
||||||
|
|
||||||
`src/api/access.ts` 定义 C 端用户、会话和消息响应类型。消息记录第1页为最新内容,每页按发送顺序展示,支持刷新、分页和生成状态查看。原实验账号页面 `/digital/experiment-users` 更名为「实验用户分组」,只针对 C 端用户配置实验。
|
`src/api/access.ts` 定义 C 端用户、会话和消息响应类型。消息记录第1页为最新内容,每页按发送顺序展示,支持刷新、分页和生成状态查看。原实验账号页面 `/digital/experiment-users` 更名为「实验用户分组」,只针对 C 端用户配置实验。
|
||||||
|
|
||||||
|
用户列表展示账号的 NSFW 开关;创建用户默认开启,编辑用户可单独开启或关闭。与前台「我的」读取和修改同一份服务端账号偏好,不覆盖收藏、称呼或身份背景。已有账号未保存该字段时默认开启,游客的登录限制不变;需与 `access-manage` 配套发布。
|
||||||
|
|||||||
@@ -1232,6 +1232,8 @@ export type DigitalUser = {
|
|||||||
username: string;
|
username: string;
|
||||||
displayName: string;
|
displayName: string;
|
||||||
status: "ACTIVE" | "INACTIVE";
|
status: "ACTIVE" | "INACTIVE";
|
||||||
|
/** 账号未保存内容偏好时默认开启,后端在生成时读取实际值。 */
|
||||||
|
nsfwEnabled?: boolean;
|
||||||
createdAt: string;
|
createdAt: string;
|
||||||
lastLoginAt: string | null;
|
lastLoginAt: string | null;
|
||||||
conversations: number;
|
conversations: number;
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
<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 } from "element-plus";
|
||||||
import {
|
import {
|
||||||
@@ -16,9 +16,14 @@ const q = ref(""),
|
|||||||
users = ref<DigitalUser[]>([]);
|
users = ref<DigitalUser[]>([]);
|
||||||
const creating = ref(false),
|
const creating = ref(false),
|
||||||
saving = ref(false),
|
saving = ref(false),
|
||||||
createForm = ref({ username: "", displayName: "", password: "" });
|
createForm = ref({
|
||||||
|
username: "",
|
||||||
|
displayName: "",
|
||||||
|
password: "",
|
||||||
|
nsfwEnabled: true
|
||||||
|
});
|
||||||
const editing = ref<DigitalUser | null>(null),
|
const editing = ref<DigitalUser | null>(null),
|
||||||
editForm = ref({ displayName: "", status: "ACTIVE" });
|
editForm = ref({ displayName: "", status: "ACTIVE", nsfwEnabled: true });
|
||||||
const resetTarget = ref<DigitalUser | null>(null),
|
const resetTarget = ref<DigitalUser | null>(null),
|
||||||
newPassword = ref("");
|
newPassword = ref("");
|
||||||
const selected = ref<DigitalUser | null>(null),
|
const selected = ref<DigitalUser | null>(null),
|
||||||
@@ -83,7 +88,12 @@ async function create() {
|
|||||||
try {
|
try {
|
||||||
await digital("users", "post", createForm.value);
|
await digital("users", "post", createForm.value);
|
||||||
creating.value = false;
|
creating.value = false;
|
||||||
createForm.value = { username: "", displayName: "", password: "" };
|
createForm.value = {
|
||||||
|
username: "",
|
||||||
|
displayName: "",
|
||||||
|
password: "",
|
||||||
|
nsfwEnabled: true
|
||||||
|
};
|
||||||
search();
|
search();
|
||||||
ElMessage.success("C 端账号已创建,可在星港前台登录");
|
ElMessage.success("C 端账号已创建,可在星港前台登录");
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
@@ -94,7 +104,11 @@ async function create() {
|
|||||||
}
|
}
|
||||||
function edit(user: DigitalUser) {
|
function edit(user: DigitalUser) {
|
||||||
editing.value = user;
|
editing.value = user;
|
||||||
editForm.value = { displayName: user.displayName, status: user.status };
|
editForm.value = {
|
||||||
|
displayName: user.displayName,
|
||||||
|
status: user.status,
|
||||||
|
nsfwEnabled: user.nsfwEnabled ?? true
|
||||||
|
};
|
||||||
}
|
}
|
||||||
async function saveEdit() {
|
async function saveEdit() {
|
||||||
if (!editing.value) return;
|
if (!editing.value) return;
|
||||||
@@ -200,7 +214,12 @@ onMounted(load);
|
|||||||
<el-button
|
<el-button
|
||||||
type="primary"
|
type="primary"
|
||||||
@click="
|
@click="
|
||||||
createForm = { username: '', displayName: '', password: '' };
|
createForm = {
|
||||||
|
username: '',
|
||||||
|
displayName: '',
|
||||||
|
password: '',
|
||||||
|
nsfwEnabled: true
|
||||||
|
};
|
||||||
creating = true;
|
creating = true;
|
||||||
"
|
"
|
||||||
>创建 C 端用户</el-button
|
>创建 C 端用户</el-button
|
||||||
@@ -241,6 +260,12 @@ onMounted(load);
|
|||||||
row.status === "ACTIVE" ? "正常" : "已停用"
|
row.status === "ACTIVE" ? "正常" : "已停用"
|
||||||
}}</el-tag></template
|
}}</el-tag></template
|
||||||
></el-table-column
|
></el-table-column
|
||||||
|
><el-table-column label="NSFW" width="100"
|
||||||
|
><template #default="{ row }"
|
||||||
|
><el-tag :type="row.nsfwEnabled === false ? 'info' : 'success'">{{
|
||||||
|
row.nsfwEnabled === false ? "已关闭" : "已开启"
|
||||||
|
}}</el-tag></template
|
||||||
|
></el-table-column
|
||||||
><el-table-column
|
><el-table-column
|
||||||
prop="conversations"
|
prop="conversations"
|
||||||
label="会话数"
|
label="会话数"
|
||||||
@@ -305,7 +330,17 @@ onMounted(load);
|
|||||||
show-password
|
show-password
|
||||||
maxlength="128"
|
maxlength="128"
|
||||||
placeholder="至少8位"
|
placeholder="至少8位"
|
||||||
autocomplete="new-password" /></el-form-item></el-form
|
autocomplete="new-password" /></el-form-item
|
||||||
|
><el-form-item label="NSFW 成人内容"
|
||||||
|
><el-switch
|
||||||
|
v-model="createForm.nsfwEnabled"
|
||||||
|
active-text="开启"
|
||||||
|
inactive-text="关闭"
|
||||||
|
/>
|
||||||
|
<p class="secondary">
|
||||||
|
登录账号默认开启,用户可在前台保存自己的选择。
|
||||||
|
</p>
|
||||||
|
</el-form-item></el-form
|
||||||
><template #footer
|
><template #footer
|
||||||
><el-button @click="creating = false">取消</el-button
|
><el-button @click="creating = false">取消</el-button
|
||||||
><el-button type="primary" :loading="saving" @click="create"
|
><el-button type="primary" :loading="saving" @click="create"
|
||||||
@@ -329,7 +364,14 @@ onMounted(load);
|
|||||||
><el-radio value="ACTIVE">正常</el-radio
|
><el-radio value="ACTIVE">正常</el-radio
|
||||||
><el-radio value="INACTIVE">停用</el-radio></el-radio-group
|
><el-radio value="INACTIVE">停用</el-radio></el-radio-group
|
||||||
></el-form-item
|
></el-form-item
|
||||||
></el-form
|
><el-form-item label="NSFW 成人内容"
|
||||||
|
><el-switch
|
||||||
|
v-model="editForm.nsfwEnabled"
|
||||||
|
active-text="开启"
|
||||||
|
inactive-text="关闭"
|
||||||
|
/>
|
||||||
|
<p class="secondary">保存后用于该账号的后续回复。</p>
|
||||||
|
</el-form-item></el-form
|
||||||
><el-alert
|
><el-alert
|
||||||
title="停用后用户无法登录,已有会话记录仍保留。"
|
title="停用后用户无法登录,已有会话记录仍保留。"
|
||||||
:closable="false"
|
:closable="false"
|
||||||
|
|||||||
Reference in New Issue
Block a user