mirror of
https://github.com/larsbaunwall/vscode-copilot-bridge.git
synced 2025-10-05 22:22:59 +00:00
refactor(extension): extract config/state/logging/models/messages/http modules (SRP)
Co-Authored-By: Lars Baunwall <larslb@thinkability.dk>
This commit is contained in:
parent
f4e6b390e3
commit
c8afe9ee17
16 changed files with 634 additions and 623 deletions
25
src/http/routes/models.ts
Normal file
25
src/http/routes/models.ts
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
import { writeJson } from '../utils';
|
||||
import { listCopilotModels } from '../../models';
|
||||
|
||||
export const handleModelsRequest = async (res: any): Promise<void> => {
|
||||
try {
|
||||
const models = await listCopilotModels();
|
||||
writeJson(res, 200, {
|
||||
data: models.map((id: string) => ({
|
||||
id,
|
||||
object: 'model',
|
||||
owned_by: 'vscode-bridge',
|
||||
})),
|
||||
});
|
||||
} catch {
|
||||
writeJson(res, 200, {
|
||||
data: [
|
||||
{
|
||||
id: 'copilot',
|
||||
object: 'model',
|
||||
owned_by: 'vscode-bridge',
|
||||
},
|
||||
],
|
||||
});
|
||||
}
|
||||
};
|
||||
Loading…
Add table
Add a link
Reference in a new issue