- {{ msg.content }}
+ {{ msg.attributes.content }}
- {{ msg.timestamp | date:'shortTime' }}
+ {{ msg.attributes.createdAt | date:'shortTime' }}
}
diff --git a/frontend/src/app/chat/chat.store.ts b/frontend/src/app/chat/chat.store.ts
index d47020c..eca5060 100644
--- a/frontend/src/app/chat/chat.store.ts
+++ b/frontend/src/app/chat/chat.store.ts
@@ -1,18 +1,23 @@
-import { signalStore, withState, withMethods, patchState } from '@ngrx/signals';
+import { patchState, signalStore, withMethods, withState } from '@ngrx/signals';
import { inject } from '@angular/core';
import { HttpErrorResponse } from '@angular/common/http';
import { ChatService } from './chat-service';
-import { ChatState, Message } from './chat.types';
+import { ChatState, Message, MessageResponse } from './chat.types';
import { lastValueFrom } from 'rxjs';
import { Router } from '@angular/router';
+import { JsonApiResource } from '../core/types/api';
const initialState: ChatState = {
messages: [
{
- id: 'welcome',
- role: 'ai',
- content: "What's you want to post today?",
- timestamp: new Date(),
+ id: 'null',
+ type: 'messages',
+ attributes: {
+ role: 'assistant',
+ content: "What's you want to post today?",
+ attachments: [],
+ createdAt: new Date(),
+ },
},
],
isLoading: false,
@@ -39,6 +44,21 @@ export const ChatStore = signalStore(
throw error;
}
};
+ const setErrorMessage = (message: string, role: 'assistant' | 'user' = 'user') => {
+ const errorMessage: JsonApiResource