Skip to content

Commit d13a3b4

Browse files
authored
Prettier run (#425)
* Add prettier gh action * Add build check * rm prettierignore * Prettier run * prettier * use npm ci instead * rename * rm lockfiles * npm run prettier-fix
1 parent 82b3ba1 commit d13a3b4

File tree

7 files changed

+96
-78
lines changed

7 files changed

+96
-78
lines changed

.github/workflows/lint.yml

Lines changed: 21 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,39 @@
1-
name: Lint and Build Check
1+
name: Prettier and Build Check
22

33
on:
44
pull_request:
5-
branches: [ main ]
5+
branches: [main]
66
push:
7-
branches: [ main ]
7+
branches: [main]
88

99
jobs:
10-
lint-and-build:
10+
prettier-and-build:
1111
runs-on: ubuntu-latest
12-
12+
1313
steps:
1414
- name: Checkout code
1515
uses: actions/checkout@v4
1616

1717
- name: Setup Node.js
1818
uses: actions/setup-node@v4
1919
with:
20-
node-version: '18'
21-
cache: 'npm'
20+
node-version: "18"
21+
cache: "npm"
2222

2323
- name: Install dependencies
24-
run: npm install
24+
run: |
25+
# Clean npm cache
26+
npm cache clean --force
27+
28+
# Remove lock files and node_modules to fix rollup binary issues
29+
rm -rf package-lock.json node_modules
30+
rm -rf client/package-lock.json client/node_modules
31+
rm -rf server/package-lock.json server/node_modules
32+
33+
# Install dependencies
34+
npm install
35+
cd client && npm install
36+
cd ../server && npm install
2537
2638
- name: Check Prettier formatting
2739
run: |
@@ -41,4 +53,4 @@ jobs:
4153
run: |
4254
echo "🏗️ Building project..."
4355
npm run build
44-
echo "✅ Build completed successfully!"
56+
echo "✅ Build completed successfully!"

client/src/components/connection/ServerConnectionCard.tsx

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,9 @@ export function ServerConnectionCard({
177177

178178
<div className="flex items-center gap-2">
179179
<div className="flex items-center gap-2 pr-2 text-xs text-muted-foreground leading-none">
180-
<span className="leading-none">{server.enabled === false ? "Disabled" : "Enabled"}</span>
180+
<span className="leading-none">
181+
{server.enabled === false ? "Disabled" : "Enabled"}
182+
</span>
181183
<Switch
182184
checked={server.enabled !== false}
183185
onCheckedChange={(checked) => {
@@ -227,7 +229,11 @@ export function ServerConnectionCard({
227229
<Separator />
228230
<DropdownMenuItem
229231
className="text-destructive text-xs cursor-pointer"
230-
onClick={() => (onRemove ? onRemove(server.name) : onDisconnect(server.name))}
232+
onClick={() =>
233+
onRemove
234+
? onRemove(server.name)
235+
: onDisconnect(server.name)
236+
}
231237
>
232238
<Link2Off className="h-3 w-3 mr-2" />
233239
Remove server

client/src/hooks/use-chat.ts

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ export function useChat(options: UseChatOptions = {}) {
7272
id: modelName,
7373
name: modelName,
7474
provider: "ollama" as const,
75-
})
75+
}),
7676
);
7777

7878
setOllamaModels(ollamaModelDefinitions);
@@ -93,15 +93,15 @@ export function useChat(options: UseChatOptions = {}) {
9393
setModel(ollamaModels[0]);
9494
} else if (hasToken("anthropic")) {
9595
const claudeModel = SUPPORTED_MODELS.find(
96-
(m) => m.id === Model.CLAUDE_3_5_SONNET_LATEST
96+
(m) => m.id === Model.CLAUDE_3_5_SONNET_LATEST,
9797
);
9898
if (claudeModel) setModel(claudeModel);
9999
} else if (hasToken("openai")) {
100100
const gptModel = SUPPORTED_MODELS.find((m) => m.id === Model.GPT_4O);
101101
if (gptModel) setModel(gptModel);
102102
} else if (hasToken("deepseek")) {
103103
const deepseekModel = SUPPORTED_MODELS.find(
104-
(m) => m.id === Model.DEEPSEEK_CHAT
104+
(m) => m.id === Model.DEEPSEEK_CHAT,
105105
);
106106
if (deepseekModel) setModel(deepseekModel);
107107
} else {
@@ -116,7 +116,7 @@ export function useChat(options: UseChatOptions = {}) {
116116
// For Ollama, return "local" if it's running and the model is available
117117
return isOllamaRunning &&
118118
ollamaModels.some(
119-
(om) => om.id === model.id || om.id.startsWith(`${model.id}:`)
119+
(om) => om.id === model.id || om.id.startsWith(`${model.id}:`),
120120
)
121121
? "local"
122122
: "";
@@ -133,7 +133,7 @@ export function useChat(options: UseChatOptions = {}) {
133133
onModelChange(newModel);
134134
}
135135
},
136-
[onModelChange]
136+
[onModelChange],
137137
);
138138

139139
// Available models with API keys or local Ollama models
@@ -165,7 +165,7 @@ export function useChat(options: UseChatOptions = {}) {
165165
assistantMessage: ChatMessage,
166166
assistantContent: { current: string },
167167
toolCalls: { current: any[] },
168-
toolResults: { current: any[] }
168+
toolResults: { current: any[] },
169169
) => {
170170
// Handle text content
171171
if (
@@ -178,7 +178,7 @@ export function useChat(options: UseChatOptions = {}) {
178178
messages: prev.messages.map((msg) =>
179179
msg.id === assistantMessage.id
180180
? { ...msg, content: assistantContent.current }
181-
: msg
181+
: msg,
182182
),
183183
}));
184184
return;
@@ -196,7 +196,7 @@ export function useChat(options: UseChatOptions = {}) {
196196
messages: prev.messages.map((msg) =>
197197
msg.id === assistantMessage.id
198198
? { ...msg, toolCalls: [...toolCalls.current] }
199-
: msg
199+
: msg,
200200
),
201201
}));
202202
return;
@@ -218,7 +218,7 @@ export function useChat(options: UseChatOptions = {}) {
218218
...tc,
219219
status: toolResult.error ? "error" : "completed",
220220
}
221-
: tc
221+
: tc,
222222
);
223223

224224
setState((prev) => ({
@@ -230,7 +230,7 @@ export function useChat(options: UseChatOptions = {}) {
230230
toolCalls: [...toolCalls.current],
231231
toolResults: [...toolResults.current],
232232
}
233-
: msg
233+
: msg,
234234
),
235235
}));
236236
return;
@@ -261,14 +261,14 @@ export function useChat(options: UseChatOptions = {}) {
261261
throw new Error(parsed.error);
262262
}
263263
},
264-
[]
264+
[],
265265
);
266266

267267
const sendChatRequest = useCallback(
268268
async (userMessage: ChatMessage) => {
269269
if (!serverConfigs || !model || !currentApiKey) {
270270
throw new Error(
271-
"Missing required configuration: serverConfig, model, and apiKey are required"
271+
"Missing required configuration: serverConfig, model, and apiKey are required",
272272
);
273273
}
274274

@@ -349,7 +349,7 @@ export function useChat(options: UseChatOptions = {}) {
349349
assistantMessage,
350350
assistantContent,
351351
toolCalls,
352-
toolResults
352+
toolResults,
353353
);
354354
} catch (parseError) {
355355
console.warn("Failed to parse SSE data:", data, parseError);
@@ -388,7 +388,7 @@ export function useChat(options: UseChatOptions = {}) {
388388
onMessageReceived,
389389
handleStreamingEvent,
390390
getOllamaBaseUrl,
391-
]
391+
],
392392
);
393393

394394
const sendMessage = useCallback(
@@ -429,7 +429,7 @@ export function useChat(options: UseChatOptions = {}) {
429429
}
430430
}
431431
},
432-
[state.isLoading, onMessageSent, sendChatRequest, onError]
432+
[state.isLoading, onMessageSent, sendChatRequest, onError],
433433
);
434434

435435
const stopGeneration = useCallback(() => {
@@ -480,7 +480,7 @@ export function useChat(options: UseChatOptions = {}) {
480480
}
481481
}
482482
},
483-
[sendChatRequest, onError]
483+
[sendChatRequest, onError],
484484
);
485485

486486
const deleteMessage = useCallback((messageId: string) => {
@@ -502,7 +502,7 @@ export function useChat(options: UseChatOptions = {}) {
502502
const handleElicitationResponse = useCallback(
503503
async (
504504
action: "accept" | "decline" | "cancel",
505-
parameters?: Record<string, any>
505+
parameters?: Record<string, any>,
506506
) => {
507507
if (!elicitationRequest) {
508508
console.warn("Cannot handle elicitation response: no active request");
@@ -554,7 +554,7 @@ export function useChat(options: UseChatOptions = {}) {
554554
setElicitationLoading(false);
555555
}
556556
},
557-
[elicitationRequest, onError]
557+
[elicitationRequest, onError],
558558
);
559559

560560
// Cleanup on unmount

client/src/lib/chat-utils.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ export function formatMessageDate(date: Date): string {
4646
export function createMessage(
4747
role: "user" | "assistant",
4848
content: string,
49-
attachments?: any[]
49+
attachments?: any[],
5050
): ChatMessage {
5151
return {
5252
id: generateId(),
@@ -103,7 +103,7 @@ export function scrollToBottom(element?: Element | null) {
103103

104104
export function debounce<T extends (...args: any[]) => any>(
105105
func: T,
106-
wait: number
106+
wait: number,
107107
): (...args: Parameters<T>) => void {
108108
let timeout: NodeJS.Timeout;
109109
return (...args: Parameters<T>) => {

0 commit comments

Comments
 (0)