@@ -39,6 +39,7 @@ import UpdateSkillActivationCommand from '@cardstack/host/commands/update-skill-
39
39
import { Message } from ' @cardstack/host/lib/matrix-classes/message' ;
40
40
import type { StackItem } from ' @cardstack/host/lib/stack-item' ;
41
41
import { getAutoAttachment } from ' @cardstack/host/resources/auto-attached-card' ;
42
+ import { RoomResource } from ' @cardstack/host/resources/room' ;
42
43
43
44
import type CardService from ' @cardstack/host/services/card-service' ;
44
45
import type CommandService from ' @cardstack/host/services/command-service' ;
@@ -66,6 +67,7 @@ import type { Skill } from '../ai-assistant/skill-menu';
66
67
interface Signature {
67
68
Args: {
68
69
roomId: string ;
70
+ roomResource: RoomResource ;
69
71
monacoSDK: MonacoSDK ;
70
72
};
71
73
}
@@ -77,7 +79,7 @@ export default class Room extends Component<Signature> {
77
79
class =' room'
78
80
data-room-settled ={{this .doWhenRoomChanges.isIdle }}
79
81
data-test-room-settled ={{this .doWhenRoomChanges.isIdle }}
80
- data-test-room-name ={{this . roomResource.name }}
82
+ data-test-room-name ={{@ roomResource.name }}
81
83
data-test-room ={{@ roomId }}
82
84
>
83
85
<AiAssistantConversation
@@ -147,15 +149,12 @@ export default class Room extends Component<Signature> {
147
149
@ autoAttachedFile ={{this .autoAttachedFile }}
148
150
@ filesToAttach ={{this .filesToAttach }}
149
151
/>
150
-
151
- {{#if this . roomResource }}
152
- <LLMSelect
153
- @ selected ={{this .roomResource.activeLLM }}
154
- @ onChange ={{this .roomResource.activateLLM }}
155
- @ options ={{this .supportedLLMs }}
156
- @ disabled ={{this .roomResource.isActivatingLLM }}
157
- />
158
- {{/if }}
152
+ <LLMSelect
153
+ @ selected ={{@ roomResource.activeLLM }}
154
+ @ onChange ={{@ roomResource.activateLLM }}
155
+ @ options ={{this .supportedLLMs }}
156
+ @ disabled ={{@ roomResource.isActivatingLLM }}
157
+ />
159
158
</div >
160
159
</div >
161
160
</footer >
@@ -217,10 +216,6 @@ export default class Room extends Component<Signature> {
217
216
@service private declare operatorModeStateService: OperatorModeStateService ;
218
217
@service private declare loaderService: LoaderService ;
219
218
220
- private get roomResource() {
221
- return this .matrixService .roomResources .get (this .args .roomId );
222
- }
223
-
224
219
private autoAttachmentResource = getAutoAttachment (
225
220
this ,
226
221
() => this .topMostStackItems ,
@@ -519,25 +514,25 @@ export default class Room extends Component<Signature> {
519
514
};
520
515
521
516
private isDisplayingCode = (message : Message ) => {
522
- return !! this .roomResource ? .isDisplayingCode (message );
517
+ return this .args . roomResource .isDisplayingCode (message );
523
518
};
524
519
525
520
private toggleViewCode = (message : Message ) => {
526
- this .roomResource ? .toggleViewCode (message );
521
+ this .args . roomResource .toggleViewCode (message );
527
522
};
528
523
529
524
private doMatrixEventFlush = restartableTask (async () => {
530
525
await this .matrixService .flushMembership ;
531
526
await this .matrixService .flushTimeline ;
532
- await this .roomResource ? .loading ;
527
+ await this .args . roomResource .loading ;
533
528
});
534
529
535
530
private get messages() {
536
- return this .roomResource ? .messages ?? [] ;
531
+ return this .args . roomResource .messages ;
537
532
}
538
533
539
- private get skills() {
540
- return this .roomResource ? .skills ?? [] ;
534
+ private get skills(): Skill [] {
535
+ return this .args . roomResource .skills ;
541
536
}
542
537
543
538
private get supportedLLMs(): string [] {
@@ -555,7 +550,7 @@ export default class Room extends Component<Signature> {
555
550
}
556
551
557
552
private get room() {
558
- let room = this .roomResource ? .matrixRoom ;
553
+ let room = this .args . roomResource .matrixRoom ;
559
554
return room ;
560
555
}
561
556
0 commit comments