diff --git a/frontend/src/app/llm-workspace/llm-workspace.component.ts b/frontend/src/app/llm-workspace/llm-workspace.component.ts index 9866649..636804f 100644 --- a/frontend/src/app/llm-workspace/llm-workspace.component.ts +++ b/frontend/src/app/llm-workspace/llm-workspace.component.ts @@ -275,12 +275,20 @@ export class LlmWorkspaceComponent implements OnInit, OnDestroy { private destroy$ = new Subject(); ngOnInit(): void { - this.siteId = this.route.snapshot.paramMap.get('siteId'); - const existingPrompt = this.session.currentPrompt; - if (existingPrompt) { - this.prompt = existingPrompt; - } - this.loadVersions(); + this.route.paramMap + .pipe(takeUntil(this.destroy$)) + .subscribe(params => { + const siteId = params.get('siteId'); + if (siteId !== this.siteId) { + this.siteId = siteId; + this.prompt = ''; + this.refinePrompt = ''; + this.showRefine = false; + this.versions = []; + this.session.clearHistory(); + this.loadVersions(); + } + }); } private loadVersions(): void {