-
-
Notifications
You must be signed in to change notification settings - Fork 10k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
π fix: fix
OpenAI
deployment restrictions (#3206)
* β‘ perf(route): Optimize `OpenAI` deployment restrictions * π fix(route): incorrect use of `hkg1` * π fix(route): Incorrect use of `hkg1`
- Loading branch information
Showing
11 changed files
with
118 additions
and
83 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
// @vitest-environment edge-runtime | ||
import { describe, expect, it, vi } from 'vitest'; | ||
|
||
import { POST as UniverseRoute } from '../[provider]/route'; | ||
import { POST, preferredRegion, runtime } from './route'; | ||
|
||
// 樑ζ '../[provider]/route' | ||
vi.mock('../[provider]/route', () => ({ | ||
POST: vi.fn().mockResolvedValue('mocked response'), | ||
})); | ||
|
||
describe('Configuration tests', () => { | ||
it('should have runtime set to "edge"', () => { | ||
expect(runtime).toBe('edge'); | ||
}); | ||
|
||
it('should contain specific regions in preferredRegion', () => { | ||
expect(preferredRegion).not.contain(['hkg1']); | ||
}); | ||
}); | ||
|
||
describe('OpenAI POST function tests', () => { | ||
it('should call UniverseRoute with correct parameters', async () => { | ||
const mockRequest = new Request('https://example.com', { method: 'POST' }); | ||
await POST(mockRequest); | ||
expect(UniverseRoute).toHaveBeenCalledWith(mockRequest, { params: { provider: 'openai' } }); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import { POST as UniverseRoute } from '../[provider]/route'; | ||
|
||
export const runtime = 'edge'; | ||
|
||
export const preferredRegion = [ | ||
'arn1', | ||
'bom1', | ||
'cdg1', | ||
'cle1', | ||
'cpt1', | ||
'dub1', | ||
'fra1', | ||
'gru1', | ||
'hnd1', | ||
'iad1', | ||
'icn1', | ||
'kix1', | ||
'lhr1', | ||
'pdx1', | ||
'sfo1', | ||
'sin1', | ||
'syd1', | ||
]; | ||
|
||
export const POST = async (req: Request) => UniverseRoute(req, { params: { provider: 'openai' } }); |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters