This commit is contained in:
xuhd committed 2026-06-10 11:27:48 +08:00
1 parent e54f42c0eb
commit b8d3a549df
3 files changed
+74 -6

No files matched your search

@@ -256,6 +256,10 @@ export function AIWritingProvider({ children }: { children: ReactNode }) {
const stream = streamRef.current;
if (!stream) return;
try {
// 所见即所得:用户在表单选了什么 materialSource,前端就原样传过去。
// 三个合法值:knowledge_base / skill / notebook,后端 state.py 接受任意 str。
// 与 material_source 独立的 notebook_search_space_id / notebook_source_ids
// 控制是否真的去笔记后端拉素材(仅当用户选了"我的笔记"模式时由表单填充)。
await stream.submit(
{
user_intent: request.userIntent,
@@ -266,7 +270,9 @@ export function AIWritingProvider({ children }: { children: ReactNode }) {
word_count_target: request.wordCountTarget,
keyword_count: Math.max(1, Math.min(10, request.keywordCount)),
writing_mode: request.writingMode === 'strict' ? 'strict' : 'loose',
material_source: request.materialSource === 'skill' ? 'skill' : 'knowledge_base',
material_source: request.materialSource,
notebook_search_space_id: request.noteSearchSpaceId ?? null,
notebook_source_ids: request.noteSourceIds ?? null,
revision_count: 0,
max_revisions: 3,
status: 'researching',
@@ -291,6 +291,17 @@ export default function StudioNotebookDetailPage() {
await send(text, selectedSourceIds);
};
// Clarification 卡片的「发送」按钮回调。MessageList 内部把用户选中的选项 +
// 自由文本合并成一段 answer 传过来,这里走和普通发送同一条 send() 链路,
// 把当前选中的来源也一并带上,保持上下文一致。
const handleClarificationSubmit = useCallback(
async (answer: string) => {
if (isStreaming) return;
await send(answer, selectedSourceIds);
},
[send, selectedSourceIds, isStreaming],
);
const handleBackToList = () => {
setActiveThreadId(null);
setThreadId(undefined);
@@ -655,6 +666,7 @@ export default function StudioNotebookDetailPage() {
thread={thread}
paddingBottom={120}
extraRehypePlugins={citationRehypePlugins}
onClarificationSubmit={handleClarificationSubmit}
/>
</div>
)}