From 35302191233a69ed5a57e9137de352ddfec6f9a7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=B9=9B=E5=85=AE?= Date: Tue, 27 Oct 2026 18:56:24 +0800 Subject: [PATCH] =?UTF-8?q?feat(users):=20=E4=BD=BF=E7=94=A8=E7=8B=AC?= =?UTF-8?q?=E7=AB=8B=E8=B4=A6=E5=8F=B7=E5=B9=B6=E7=AE=80=E5=8C=96=E9=80=89?= =?UTF-8?q?=E6=8B=A9=E6=A0=B7=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - login: 改为独立 C 端账号文案与身份类型 - digital: 世界书和风格改用平面选择列表,保留键盘焦点 - README: 同步独立登录与历史迁移说明 --- README.md | 11 ++++- src/app/(auth)/login/page.tsx | 6 +-- src/components/digital-home.tsx | 3 -- src/components/digital.css | 74 ++++++++++++++------------------- src/components/login-form.tsx | 4 +- src/lib/types.ts | 3 +- 6 files changed, 48 insertions(+), 53 deletions(-) diff --git a/README.md b/README.md index ab00af0..ba2d7b1 100644 --- a/README.md +++ b/README.md @@ -34,7 +34,7 @@ PORT=3210 HOSTNAME=0.0.0.0 ``` -`ACCESS_MANAGE_API_BASE_URL` 指向 `access-manage` 服务端 API 根路径。数字人登录调用后端 `POST /api/auth/digital/login`,接受现有超级管理员或员工账号,登录成功后只把 JWT 写入 Next.js 服务端 HttpOnly Cookie,不写入 `localStorage`。 +`ACCESS_MANAGE_API_BASE_URL` 指向 `access-manage` 服务端 API 根路径。数字人登录调用后端 `POST /api/auth/digital/login`,仅接受后台开通的独立 C 端账号,登录成功后只把 JWT 写入 Next.js 服务端 HttpOnly Cookie,不写入 `localStorage`。 环境标识按 `APP_ENV` 区分: @@ -122,7 +122,7 @@ pnpm start:prod ## 数字人空间 -- `/discover` 为默认入口,复用原登录账户和 HttpOnly Cookie。 +- `/discover` 为默认入口,使用独立 C 端账号和 HttpOnly Cookie。 - `src/components/digital-home.tsx`、`digital.css`:深色双 UI、移动/桌面适配、探索、流式对话、停止、重生成、分支、固定记忆、世界书与用户身份。 - `src/lib/digital.ts`:前台协议、请求和 SSE 解码。 - `src/app/api/digital/[...path]/route.ts`:白名单 BFF,只转发前台接口,禁止访问后台实验管理,写入校验同源。 @@ -150,3 +150,10 @@ pnpm start:prod 聊天输入区“继续”让 NPC 基于上一段内容继续说话,不发送或清空输入框草稿,也不插入用户气泡;可连续点击生成多段,生成时沿用停止按钮。角色尚无可接续内容时按钮不可用。 NPC 尚未出字就停止或失败时,“继续”仍可接续此前已完成的角色内容,输入草稿保持不变。 + + +### 独立 C 端登录 + +前台通过 `/api/auth/digital/login` 使用独立 C 端账号,由后台「用户管理」开通;不再使用管理员/员工身份。已有数字人业务账号由迁移复制密码哈希并保留会话,之后两套账号密码和状态独立。登录令牌保存在 HttpOnly Cookie,密码重置/账号停用会撤销旧登录状态。 + +对话设置的世界书与叙事风格使用平面列表;选中只保留轻底色和一个勾选标记,键盘焦点仍显示明确轮廓。 diff --git a/src/app/(auth)/login/page.tsx b/src/app/(auth)/login/page.tsx index 32bf924..4b0552e 100644 --- a/src/app/(auth)/login/page.tsx +++ b/src/app/(auth)/login/page.tsx @@ -1,4 +1,4 @@ -/** 星港登录页,沿用既有账号,无公开注册。 */ +/** 星港登录页,使用独立用户账号,无公开注册。 */ import Link from "next/link"; import { LoginForm } from "@/components/login-form"; import "@/components/digital-login.css"; @@ -31,9 +31,9 @@ export default function LoginPage() {
✧

欢迎回到星港

-

使用你的现有账号,继续未完的故事。

+

使用你的星港账号,继续未完的故事。

- 私人数字人空间 · 不开放公开注册 + 账号由管理员开通 · 与后台账号独立
); diff --git a/src/components/digital-home.tsx b/src/components/digital-home.tsx index 56fe0b2..db391f6 100644 --- a/src/components/digital-home.tsx +++ b/src/components/digital-home.tsx @@ -982,9 +982,6 @@ export function DigitalHome({ onChange={() => onChange(p.id || undefined)} /> - {p.name} {p.description || "以这套风格继续你们的故事。"} diff --git a/src/components/digital.css b/src/components/digital.css index d71e907..58c8ba2 100644 --- a/src/components/digital.css +++ b/src/components/digital.css @@ -1179,8 +1179,8 @@ } .dh-style-options { display: grid; - grid-template-columns: repeat(2, minmax(0, 1fr)); - gap: 10px; + grid-template-columns: minmax(0, 1fr); + gap: 0; } .dh-style-option { position: relative; @@ -1188,10 +1188,6 @@ cursor: pointer; -webkit-tap-highlight-color: transparent; } -.dh-style-option:first-child, -.dh-style-option:last-child:nth-child(even) { - grid-column: 1 / -1; -} .dh-style-option > input { position: absolute; width: 1px; @@ -1205,41 +1201,26 @@ display: flex; align-items: flex-start; gap: 10px; - height: 100%; - min-height: 88px; - padding: 15px 13px; - border: 1px solid #ffffff17; - border-radius: 13px; - background: color-mix(in srgb, var(--dh-soft) 60%, var(--dh-panel)); + min-height: 72px; + padding: 14px 10px; + border: 0; + border-bottom: 1px solid var(--dh-line); + border-radius: 0; + background: transparent; transition: border-color 160ms, background 160ms; } .dh-style-option:hover .dh-style-card { - border-color: color-mix(in srgb, var(--dh-accent) 55%, transparent); + background: #ffffff04; } .dh-style-option > input:checked + .dh-style-card { - border-color: var(--dh-accent); - background: color-mix(in srgb, var(--dh-accent) 9%, var(--dh-panel)); + background: color-mix(in srgb, var(--dh-accent) 7%, transparent); } .dh-style-option > input:focus-visible + .dh-style-card { outline: 2px solid var(--dh-accent); outline-offset: 3px; } -.dh-style-symbol { - display: grid; - flex: none; - place-items: center; - width: 29px; - height: 29px; - color: var(--dh-accent); - background: color-mix(in srgb, var(--dh-accent) 10%, transparent); - border-radius: 9px; -} -.dh-style-symbol svg { - width: 15px; - height: 15px; -} .dh-style-copy { flex: 1; min-width: 0; @@ -1266,8 +1247,7 @@ height: 17px; margin-top: 2px; color: transparent; - border: 1px solid #ffffff30; - border-radius: 50%; + border: 0; } .dh-style-check svg { width: 11px; @@ -1275,9 +1255,8 @@ stroke-width: 3; } .dh-style-option > input:checked + .dh-style-card .dh-style-check { - color: var(--dh-accent-ink); - background: var(--dh-accent); - border-color: var(--dh-accent); + color: var(--dh-accent); + background: transparent; } @media (width <= 600px) { .dh-style-options { @@ -1367,18 +1346,18 @@ border: 0; } .dh-selection-sheet .dh-checkbox { - min-height: 74px; - padding: 14px; - margin: 0 0 10px; - border: 1px solid #ffffff17; - border-radius: 13px; + min-height: 70px; + padding: 14px 10px; + margin: 0; + border: 0; + border-bottom: 1px solid var(--dh-line); + border-radius: 0; cursor: pointer; } .dh-selection-sheet .dh-checkbox.is-selected { - background: color-mix(in srgb, var(--dh-accent) 9%, var(--dh-panel)); - border-color: var(--dh-accent); + background: color-mix(in srgb, var(--dh-accent) 7%, transparent); } -.dh-selection-sheet .dh-checkbox:focus-within { +.dh-selection-sheet .dh-checkbox:has(input:focus-visible) { outline: 2px solid var(--dh-accent); outline-offset: 2px; } @@ -2333,3 +2312,14 @@ body:has(.dh-app) .environment-badge { overflow-x: hidden; overflow-wrap: anywhere; } + +/* 世界书与风格统一使用平面列表,选中只保留轻底色和一个勾选标记。 */ +.dh-settings .dh-book-picker { + border: 0; + padding: 0; +} +.dh-checkbox input { + flex: none; + width: 16px; + height: 16px; +} diff --git a/src/components/login-form.tsx b/src/components/login-form.tsx index 4bda152..0a0e5bd 100644 --- a/src/components/login-form.tsx +++ b/src/components/login-form.tsx @@ -1,11 +1,11 @@ "use client"; -/** 复用原有账号登录,成功后进入数字人空间。 */ +/** 独立星港用户账号登录,成功后进入数字人空间。 */ import { useRouter } from "next/navigation"; import { Eye, EyeOff, LockKeyhole, Smartphone } from "lucide-react"; import { FormEvent, useState } from "react"; -/** 现有账号的登录表单,不保存明文密码。 */ +/** 独立用户的登录表单,不保存明文密码。 */ export function LoginForm() { const router = useRouter(); const [error, setError] = useState(""); diff --git a/src/lib/types.ts b/src/lib/types.ts index 89784d7..656a02f 100644 --- a/src/lib/types.ts +++ b/src/lib/types.ts @@ -1,4 +1,5 @@ -export type AccountType = "SUPER_ADMIN" | "EMPLOYEE"; +/** 前台身份与业务协议,数字人账号使用独立 DIGITAL_USER 类型。 */ +export type AccountType = "SUPER_ADMIN" | "EMPLOYEE" | "DIGITAL_USER"; export type Role = { id: number; -- 2.52.0