Skip to content

Commit 8226e7b

Browse files
authored
fix(copilot-cleanup): support azure blob upload in copilot, remove dead code & consolidate other copilot files (#1147)
* cleanup * support azure blob image upload * imports cleanup * PR comments * ack PR comments * fix key validation
1 parent b177b29 commit 8226e7b

File tree

25 files changed

+495
-677
lines changed

25 files changed

+495
-677
lines changed

apps/sim/app/api/chat/subdomains/validate/route.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ export async function GET(request: Request) {
4545
'support',
4646
'admin',
4747
'qa',
48+
'agent',
4849
]
4950
if (reservedSubdomains.includes(subdomain)) {
5051
return NextResponse.json(

apps/sim/app/api/copilot/api-keys/generate/route.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,10 @@ export async function POST(req: NextRequest) {
1919

2020
const res = await fetch(`${SIM_AGENT_API_URL}/api/validate-key/generate`, {
2121
method: 'POST',
22-
headers: { 'Content-Type': 'application/json' },
22+
headers: {
23+
'Content-Type': 'application/json',
24+
...(env.COPILOT_API_KEY ? { 'x-api-key': env.COPILOT_API_KEY } : {}),
25+
},
2326
body: JSON.stringify({ userId }),
2427
})
2528

apps/sim/app/api/copilot/chat/route.test.ts

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,6 @@ describe('Copilot Chat API Route', () => {
225225
streamToolCalls: true,
226226
mode: 'agent',
227227
depth: 0,
228-
origin: 'http://localhost:3000',
229228
}),
230229
})
231230
)
@@ -288,7 +287,6 @@ describe('Copilot Chat API Route', () => {
288287
streamToolCalls: true,
289288
mode: 'agent',
290289
depth: 0,
291-
origin: 'http://localhost:3000',
292290
}),
293291
})
294292
)
@@ -298,7 +296,6 @@ describe('Copilot Chat API Route', () => {
298296
const authMocks = mockAuth()
299297
authMocks.setAuthenticated()
300298

301-
// Mock new chat creation
302299
const newChat = {
303300
id: 'chat-123',
304301
userId: 'user-123',
@@ -307,8 +304,6 @@ describe('Copilot Chat API Route', () => {
307304
}
308305
mockReturning.mockResolvedValue([newChat])
309306

310-
// Mock sim agent response
311-
312307
;(global.fetch as any).mockResolvedValue({
313308
ok: true,
314309
body: new ReadableStream({
@@ -343,7 +338,6 @@ describe('Copilot Chat API Route', () => {
343338
streamToolCalls: true,
344339
mode: 'agent',
345340
depth: 0,
346-
origin: 'http://localhost:3000',
347341
}),
348342
})
349343
)
@@ -353,11 +347,8 @@ describe('Copilot Chat API Route', () => {
353347
const authMocks = mockAuth()
354348
authMocks.setAuthenticated()
355349

356-
// Mock new chat creation
357350
mockReturning.mockResolvedValue([{ id: 'chat-123', messages: [] }])
358351

359-
// Mock sim agent error
360-
361352
;(global.fetch as any).mockResolvedValue({
362353
ok: false,
363354
status: 500,
@@ -403,11 +394,8 @@ describe('Copilot Chat API Route', () => {
403394
const authMocks = mockAuth()
404395
authMocks.setAuthenticated()
405396

406-
// Mock new chat creation
407397
mockReturning.mockResolvedValue([{ id: 'chat-123', messages: [] }])
408398

409-
// Mock sim agent response
410-
411399
;(global.fetch as any).mockResolvedValue({
412400
ok: true,
413401
body: new ReadableStream({
@@ -438,7 +426,6 @@ describe('Copilot Chat API Route', () => {
438426
streamToolCalls: true,
439427
mode: 'ask',
440428
depth: 0,
441-
origin: 'http://localhost:3000',
442429
}),
443430
})
444431
)

0 commit comments

Comments
 (0)