Skip to content

Commit

Permalink
feat(annotaions): refactor after code review
Browse files Browse the repository at this point in the history
  • Loading branch information
sebastianmusial committed Jun 13, 2024
1 parent 7fb65e4 commit 45055cc
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,7 @@ describe('ChatAnnotationComponent', () => {

beforeEach(async () => {
await TestBed.configureTestingModule({
imports: [
ChatAnnotationComponent,
HttpClientTestingModule,
],
imports: [ChatAnnotationComponent, HttpClientTestingModule],
}).compileComponents();

fixture = TestBed.createComponent(ChatAnnotationComponent);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
@if (message && message.type === 'text' && message.text.annotations.length) {
<div class="title">Annotations:</div>
<div class="content">
@for (annotation of message.text.annotations; track annotation.text) {
@for (
annotation of message.text.annotations;
track annotation.text + $index
) {
<ai-chat-annotation [annotation]="annotation" [index]="$index + 1">
[{{ $index + 1 }}]
</ai-chat-annotation>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
}

<div class="chat-message">
@for (msg of message.content; track msg) {
@for (msg of message.content; track $index) {
@if (msg.type === 'text') {
<span markdown [data]="msg | annotation"></span>
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<div class="messages">
@for (message of initialMessages.concat(messages); track message) {
@for (message of initialMessages.concat(messages); track message.id) {
<span #item>
<ai-chat-message [message]="message"></ai-chat-message>
</span>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
@for (tip of tips; track tip) {
<ai-chat-tip (click)="tipSelected$.emit(tip)">
{{ tip }}
</ai-chat-tip>
@for (tip of tips; track $index) {
<ai-chat-tip (click)="tipSelected$.emit(tip)">
{{ tip }}
</ai-chat-tip>
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ export class MessageContentService {
constructor(private readonly chatClientService: ChatClientService) {}

add(files: FileList) {
const updatedFiles = [
...this.data$.value,
...Object.keys(files).map(key => files[key as unknown as number]),
];
const convertedFiles = Object.keys(files).map(
key => files[key as unknown as number],
);
const updatedFiles = [...this.data$.value, ...convertedFiles];
this.data$.next(updatedFiles);
}

Expand Down

0 comments on commit 45055cc

Please sign in to comment.