refactor(studio): 文案“我的笔记/笔记本”统一改为“我的空间”

涉及空间详情页、AI 写作表单/上下文/类型、researcher 注释及 env 注释。

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
xuhdandClaude Opus 4.8 committed 2026-06-11 11:45:35 +08:00
1 parent 5ed636bce4
commit b0e48b6bda
6 files changed
+17 -17

No files matched your search

+1 -1
View File
@@ -21,7 +21,7 @@ VITE_AIPI_KNOWLEDGE_IFRAME_SKIN=red
VITE_AIPI_MOPECHAT_URL=https://ch1.b.uat.4.cn/likun_b1_mope
# 工作室/空间后端接口(侧边栏“工作室”列表、空间详情等都走这里,不是 VITE_NOTE_API_BASE_URL)
VITE_AIPI_BACKENP_URL=https://knowledgetoolserver.b.uat.4.cn
# 我的笔记前端
# 我的空间前端
VITE_AIPI_FRONTEND_URL= xxx
VITE_AIPI_CONSUMER_URL=https://ch1.b.uat.4.cn/consumer
# A 系统跳转地址(人物/组织/事件等列表项打开链接)
@@ -22,7 +22,7 @@ interface AIWritingFormProps {
disabled?: boolean;
/** workspace 入口:隐藏严格模式、目标读者 */
hideAdvancedFields?: boolean;
/** 预选空间 ID(传入时自动切换素材来源为「我的笔记」) */
/** 预选空间 ID(传入时自动切换素材来源为「我的空间」) */
initialNotebookId?: number;
/** 预选文档 ID 列表 */
initialDocumentIds?: number[];
@@ -45,7 +45,7 @@ const MAX_INTENT_LENGTH = 500;
const MATERIAL_SOURCE_OPTIONS: Array<{ value: MaterialSource; label: string; desc: string }> = [
{ value: 'knowledge_base', label: '知识库', desc: '默认 web/intranet 检索' },
{ value: 'skill', label: '技能检索', desc: '用已启用的技能编排检索' },
{ value: 'notebook', label: '我的笔记', desc: '从空间中检索素材' },
{ value: 'notebook', label: '我的空间', desc: '从空间中检索素材' },
];
const FIELD_LABEL_CLASS = 'text-[16px] font-semibold leading-none text-[#222]';
@@ -168,7 +168,7 @@ export function AIWritingForm({
writingMode: hideAdvancedFields ? 'loose' : strictMode ? 'strict' : 'loose',
materialSource: materialSource,
modelName: selectedModel?.name || modelName || undefined,
// 只有选了"我的笔记"才传笔记参数
// 只有选了"我的空间"才传笔记参数
noteSearchSpaceId: materialSource === 'notebook' ? (selectedNotebookId ?? undefined) : undefined,
noteSourceIds: materialSource === 'notebook' && selectedNotebookId != null ? selectedDocumentIds : undefined,
});
@@ -296,7 +296,7 @@ export function AIWritingForm({
</SelectContent>
</Select>
{/* 选了"我的笔记"才展示空间 / 文档选择器 */}
{/* 选了"我的空间"才展示空间 / 文档选择器 */}
{materialSource === 'notebook' && (
<div className="mt-2 space-y-2">
{/* studioToken 模式:空间已锁定,不展示选择器 */}
@@ -246,7 +246,7 @@ export function AIWritingProvider({ children }: { children: ReactNode }) {
saveAIWritingTranscript(state.sessionId, {
progressEvents: state.progressEvents,
completedInterventions: state.completedInterventions,
}).catch(() => {});
}).catch(() => { });
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [state.status, state.sessionId]);
@@ -259,7 +259,7 @@ export function AIWritingProvider({ children }: { children: ReactNode }) {
// 所见即所得:用户在表单选了什么 materialSource,前端就原样传过去。
// 三个合法值:knowledge_base / skill / notebook,后端 state.py 接受任意 str。
// 与 material_source 独立的 notebook_search_space_id / notebook_source_ids
// 控制是否真的去笔记后端拉素材(仅当用户选了"我的笔记"模式时由表单填充)。
// 控制是否真的去笔记后端拉素材(仅当用户选了"我的空间"模式时由表单填充)。
await stream.submit(
{
user_intent: request.userIntent,
@@ -374,8 +374,8 @@ export function AIWritingProvider({ children }: { children: ReactNode }) {
dispatch({ type: 'set_error', message: err instanceof Error ? err.message : String(err) });
}
}, [state.sessionId, state.currentPause, state.materials, state.outline,
state.currentDraftTitle, state.currentDraftMarkdown, state.reviewResult,
state.status]);
state.currentDraftTitle, state.currentDraftMarkdown, state.reviewResult,
state.status]);
const pauseWriting = useCallback(() => {
void streamRef.current?.stop();
@@ -246,7 +246,7 @@ export interface AIWritingRequest {
keywordCount: number;
/** 写作模式:strict=严格依据素材 / loose=可结合通用知识(默认 loose) */
writingMode: "strict" | "loose";
/** 素材来源:knowledge_base=知识库 / skill=技能检索 / notebook=我的笔记 */
/** 素材来源:knowledge_base=知识库 / skill=技能检索 / notebook=我的空间 */
materialSource: "knowledge_base" | "skill" | "notebook";
/** 笔记来源(可选):空间 search_space_id */
noteSearchSpaceId?: number;
@@ -83,10 +83,10 @@ function SourceCard({
onToggle(item.id);
}}
className={`group relative flex h-32 w-full flex-col justify-between rounded-2xl p-4 ring-1 transition-colors ${isFailed
? "cursor-default bg-destructive/5 ring-destructive/40"
: selected
? "cursor-pointer bg-primary/10 ring-primary"
: "cursor-pointer bg-muted ring-border/50 hover:bg-muted/70"
? "cursor-default bg-destructive/5 ring-destructive/40"
: selected
? "cursor-pointer bg-primary/10 ring-primary"
: "cursor-pointer bg-muted ring-border/50 hover:bg-muted/70"
}`}
>
{/* 删除按钮 - 右上角始终显示,悬停时高亮 */}
@@ -502,7 +502,7 @@ export default function StudioNotebookDetailPage() {
className="flex items-center gap-1.5 rounded-full bg-muted px-3 py-1 text-xs text-muted-foreground transition-colors hover:bg-muted/70"
>
<BookOpen className="size-3" />
<span>我的笔记</span>
<span>我的空间</span>
</a>
<button
onClick={() => setSourcesOpen(true)}
@@ -526,7 +526,7 @@ export default function StudioNotebookDetailPage() {
className="absolute right-6 top-4 z-10 flex items-center gap-1.5 rounded-full bg-muted/70 px-3 py-1.5 text-xs text-muted-foreground backdrop-blur transition-colors hover:bg-muted"
>
<BookOpen className="size-3.5" />
<span>我的笔记</span>
<span>我的空间</span>
</a>
{/* 垂直居中主区域:图标 → 标题 → 来源 → 输入框 → 空状态/历史 */}
@@ -414,7 +414,7 @@ async def researcher_node(state: AIWritingState, config: RunnableConfig) -> dict
# 把已收集到的素材挂在 raw_materials_pre,下方合并阶段直接挪过去
elif material_source == "notebook" and notebook_search_space_id:
# ── 纯笔记模式 ──
# 用户在表单选了「我的笔记」作为素材来源 → 跳过 web/intranet 检索,
# 用户在表单选了「我的空间」作为素材来源 → 跳过 web/intranet 检索,
# 仅使用 Step 1.5 已拉取的 notebook_materials。
# 与 UI 文案"从空间中检索素材"对齐。
_emit(f"仅使用笔记素材,跳过 web/intranet 检索({len(notebook_materials)} 条)")