ai写作
This commit is contained in:
1 parent
7efedc7b44
commit
b257963551
6 files changed
+44
-15
No files matched your search
@@ -30,7 +30,7 @@ function DraftWaitingPlaceholder() {
|
||||
|
||||
export function AIWritingDraftPanel() {
|
||||
const { artifact } = useCanvasGraphContext();
|
||||
const { isDraftStreaming, draftStreamingMarkdown } = useCanvasUIContext();
|
||||
const { isDraftStreaming, draftStreamingMarkdown, isDraftEditable } = useCanvasUIContext();
|
||||
|
||||
// 流式生成中:只读流式预览,数据走独立通道(不依赖全局 artifact),全程不挂载编辑器,
|
||||
// 彻底隔绝高频内容刷新触发的编辑器更新风暴。
|
||||
@@ -61,6 +61,7 @@ export function AIWritingDraftPanel() {
|
||||
}
|
||||
|
||||
const content = getCurrentArtifactContent(artifact);
|
||||
const isText = content && !isCodeArtifact(content);
|
||||
|
||||
return (
|
||||
<div className="h-full flex flex-col overflow-hidden border-l">
|
||||
@@ -73,9 +74,14 @@ export function AIWritingDraftPanel() {
|
||||
</div>
|
||||
|
||||
<div className="flex-1 overflow-hidden">
|
||||
{/* 生成完成:带编辑器的渲染器,开放润色 / 滑词等编辑能力 */}
|
||||
{content && !isCodeArtifact(content) ? (
|
||||
<TextArtifactRenderer content={content as CanvasArtifactText} />
|
||||
{isText ? (
|
||||
// 仅"生成完成的稳定态"挂载带编辑器的渲染器(润色 / 滑词);
|
||||
// 审核中等其它进行中状态用只读预览,避免编辑器在活跃流中挂载导致更新风暴。
|
||||
isDraftEditable ? (
|
||||
<TextArtifactRenderer content={content as CanvasArtifactText} />
|
||||
) : (
|
||||
<DraftStreamingPreview markdown={(content as CanvasArtifactText).fullMarkdown} showCursor={false} />
|
||||
)
|
||||
) : null}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in new issue
Block a user