Skip to content

Commit 24ad5e8

Browse files
committed
fix lint
1 parent 882a86f commit 24ad5e8

File tree

3 files changed

+31
-102
lines changed

3 files changed

+31
-102
lines changed

apps/client/app/components/sections/Messages.tsx

Lines changed: 28 additions & 77 deletions
Original file line numberDiff line numberDiff line change
@@ -13,67 +13,22 @@ interface MessagesProps {
1313

1414
const Messages: React.FC<MessagesProps> = ({ messages }) => {
1515
const messagesEndRef = useRef<HTMLDivElement | null>(null);
16-
16+
1717
useEffect(() => {
1818
messagesEndRef.current?.scrollIntoView({ behavior: 'smooth' });
1919
}, [messages]);
2020

21-
const formatJSONResponse = (jsonString: string) => {
22-
try {
23-
const parsed = JSON.parse(jsonString);
24-
if (Array.isArray(parsed)) {
25-
// Format array of responses
26-
return parsed.map(item => (
27-
<div className="mb-2">
28-
{item.reasoning && (
29-
<div className="text-gray-500 text-sm italic mb-1">
30-
{item.reasoning}
31-
</div>
32-
)}
33-
<div className="font-medium">
34-
{typeof item.response === 'object'
35-
? <pre className="bg-gray-50 rounded-md p-3 text-sm overflow-x-auto">
36-
{JSON.stringify(item.response, null, 2)}
37-
</pre>
38-
: <div className="text-base">{item.response}</div>
39-
}
40-
</div>
41-
</div>
42-
));
43-
}
44-
// Format single response object
45-
return (
46-
<div>
47-
{parsed.reasoning && (
48-
<div className="text-gray-500 text-sm italic mb-1">
49-
{parsed.reasoning}
50-
</div>
51-
)}
52-
<div className="font-medium">
53-
{typeof parsed.response === 'object'
54-
? <pre className="bg-gray-50 rounded-md p-3 text-sm overflow-x-auto">
55-
{JSON.stringify(parsed.response, null, 2)}
56-
</pre>
57-
: <div className="text-base">{parsed.response}</div>
58-
}
59-
</div>
60-
</div>
61-
);
62-
} catch (error) {
63-
return jsonString;
64-
}
65-
};
66-
6721
const processedMessages = messages.map((message) => {
6822
try {
23+
// Only try to parse AI responses
6924
if (message.sender === 'ai') {
7025
const parsed = JSON.parse(message.message);
7126
if (parsed && typeof parsed === 'object') {
72-
return {
73-
...message,
74-
message: message.message, // Keep original JSON for formatting
75-
isHTML: true
76-
};
27+
// Extract the actual response content from the JSON structure
28+
const content = Array.isArray(parsed)
29+
? parsed[0]?.response || message.message
30+
: parsed.response || message.message;
31+
return { ...message, message: content, isHTML: false };
7732
}
7833
}
7934
} catch (error) {
@@ -83,34 +38,30 @@ const Messages: React.FC<MessagesProps> = ({ messages }) => {
8338
});
8439

8540
return (
86-
<div className="flex flex-col h-full overflow-hidden">
87-
<div className="flex-1 overflow-y-auto px-4 py-2 space-y-4">
88-
{processedMessages.map((message, index) => (
41+
<div className="flex flex-col h-full overflow-y-auto px-4 py-2">
42+
{processedMessages.map((message, index) => (
43+
<div
44+
key={index}
45+
className={`flex ${message.sender === 'user' ? 'justify-end' : 'justify-start'} mb-4`}
46+
>
8947
<div
90-
key={index}
91-
className={`flex ${message.sender === 'user' ? 'justify-end' : 'justify-start'}`}
48+
className={`relative p-4 rounded-lg max-w-[80%] md:max-w-[60%] break-words ${
49+
message.sender === 'user' ? 'bg-blue-500 text-white' : 'bg-gray-100 text-black'
50+
}`}
9251
>
93-
<div
94-
className={`relative p-4 rounded-lg max-w-[85%] md:max-w-[70%] ${
95-
message.sender === 'user'
96-
? 'bg-blue-500 text-white'
97-
: 'bg-gray-100 text-black'
98-
}`}
99-
>
100-
{message.isHTML ? (
101-
<div className="text-sm">
102-
{formatJSONResponse(message.message)}
103-
</div>
104-
) : (
105-
<div className="whitespace-pre-wrap break-words text-base">
106-
{message.message}
107-
</div>
108-
)}
109-
</div>
52+
{message.isHTML ? (
53+
<div
54+
dangerouslySetInnerHTML={{
55+
__html: JSONFormatter.format(message.message)
56+
}}
57+
/>
58+
) : (
59+
<div className="whitespace-pre-wrap">{message.message}</div>
60+
)}
11061
</div>
111-
))}
112-
<div ref={messagesEndRef} />
113-
</div>
62+
</div>
63+
))}
64+
<div ref={messagesEndRef} />
11465
</div>
11566
);
11667
};

apps/client/tailwind.config.js

Lines changed: 1 addition & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -12,29 +12,7 @@ module.exports = {
1212
'gradient-conic':
1313
'conic-gradient(from 180deg at 50% 50%, var(--tw-gradient-stops))',
1414
},
15-
typography: {
16-
DEFAULT: {
17-
css: {
18-
pre: {
19-
backgroundColor: '#f3f4f6',
20-
padding: '0.5rem',
21-
borderRadius: '0.375rem',
22-
fontSize: '0.875rem',
23-
overflowX: 'auto',
24-
color: '#1f2937'
25-
},
26-
code: {
27-
backgroundColor: '#f3f4f6',
28-
padding: '0.25rem',
29-
borderRadius: '0.25rem',
30-
fontSize: '0.875rem'
31-
}
32-
}
33-
}
34-
}
3515
},
3616
},
37-
plugins: [
38-
require('@tailwindcss/typography'),
39-
],
17+
plugins: [],
4018
}

packages/sui-agent/src/protocols/aftermath/tools.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ class AftermathTools {
2121
// Price Tools
2222
tools.registerTool(
2323
'get_coin_price on Aftermath',
24-
'Get the price of a single coin on Aftermath',
24+
'Get the price of a single coin like SUI, AFSUI or any other coin on Aftermath or SUI Blockchain. You can use this tool to get the price of any coin.',
2525
[
2626
{
2727
name: 'coin',
@@ -35,7 +35,7 @@ class AftermathTools {
3535

3636
tools.registerTool(
3737
'get_coins_to_price on Aftermath',
38-
'Get the price of multiple coins on Aftermath',
38+
'Get the price of multiple coins on Aftermath and or SUI Blockchain. You can use this tool to get the price of any coin.',
3939
[
4040
{
4141
name: 'coins',

0 commit comments

Comments
 (0)