Skip to content

Commit 39fb3aa

Browse files
committed
lint
1 parent 04b8ddd commit 39fb3aa

File tree

1 file changed

+18
-18
lines changed

1 file changed

+18
-18
lines changed

src/dashboard/Data/Agent/Agent.react.js

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ import { CurrentApp } from 'context/currentApp';
2222
@withRouter
2323
class Agent extends DashboardView {
2424
static contextType = CurrentApp;
25-
25+
2626
constructor(props) {
2727
super(props);
2828
this.section = 'Core';
@@ -50,24 +50,24 @@ class Agent extends DashboardView {
5050
getStoredChatState() {
5151
try {
5252
const appSlug = this.context ? this.context.slug : null;
53-
if (!appSlug) return null;
54-
53+
if (!appSlug) {return null;}
54+
5555
const stored = localStorage.getItem(`agentChat_${appSlug}`);
56-
if (!stored) return null;
57-
56+
if (!stored) {return null;}
57+
5858
const parsedState = JSON.parse(stored);
59-
59+
6060
// Validate the structure
61-
if (!parsedState || typeof parsedState !== 'object') return null;
62-
if (!Array.isArray(parsedState.messages)) return null;
63-
61+
if (!parsedState || typeof parsedState !== 'object') {return null;}
62+
if (!Array.isArray(parsedState.messages)) {return null;}
63+
6464
// Check if the data is too old (optional: 24 hours expiry)
6565
const ONE_DAY = 24 * 60 * 60 * 1000;
6666
if (parsedState.timestamp && (Date.now() - parsedState.timestamp > ONE_DAY)) {
6767
localStorage.removeItem(`agentChat_${appSlug}`);
6868
return null;
6969
}
70-
70+
7171
return parsedState;
7272
} catch (error) {
7373
console.warn('Failed to parse stored chat state:', error);
@@ -78,7 +78,7 @@ class Agent extends DashboardView {
7878
saveChatState() {
7979
try {
8080
const appSlug = this.context ? this.context.slug : null;
81-
if (!appSlug) return;
81+
if (!appSlug) {return;}
8282

8383
const chatState = {
8484
messages: this.state.messages,
@@ -98,7 +98,7 @@ class Agent extends DashboardView {
9898
}
9999

100100
this.setDefaultModel();
101-
101+
102102
// Load saved chat state after component mounts when context is available
103103
this.loadSavedChatState();
104104
}
@@ -111,7 +111,7 @@ class Agent extends DashboardView {
111111
...message,
112112
timestamp: new Date(message.timestamp)
113113
}));
114-
114+
115115
this.setState({
116116
messages: messagesWithDateTimestamps,
117117
conversationId: savedChatState.conversationId || null,
@@ -180,7 +180,7 @@ class Agent extends DashboardView {
180180
messages: [],
181181
conversationId: null, // Reset conversation to start fresh
182182
});
183-
183+
184184
// Clear saved chat state from localStorage
185185
try {
186186
const appSlug = this.context ? this.context.slug : null;
@@ -190,7 +190,7 @@ class Agent extends DashboardView {
190190
} catch (error) {
191191
console.warn('Failed to clear saved chat state:', error);
192192
}
193-
193+
194194
// Close the menu by simulating an external click
195195
if (this.browserMenuRef.current) {
196196
this.browserMenuRef.current.setState({ open: false });
@@ -240,7 +240,7 @@ class Agent extends DashboardView {
240240

241241
// Add warning message if this is the first message in the conversation
242242
const isFirstMessage = messages.length === 0;
243-
let messagesToAdd = [];
243+
const messagesToAdd = [];
244244

245245
if (isFirstMessage) {
246246
const warningMessage = {
@@ -411,8 +411,8 @@ class Agent extends DashboardView {
411411
{message.type === 'agent' ? this.formatMessageContent(message.content) : message.content}
412412
</div>
413413
<div className={styles.messageTime}>
414-
{message.timestamp instanceof Date ?
415-
message.timestamp.toLocaleTimeString() :
414+
{message.timestamp instanceof Date ?
415+
message.timestamp.toLocaleTimeString() :
416416
new Date(message.timestamp).toLocaleTimeString()
417417
}
418418
</div>

0 commit comments

Comments
 (0)