Skip to content

Commit 1096cbf

Browse files
committed
refactor: Rename copilot-token service and move models types
1 parent 6e5ab64 commit 1096cbf

8 files changed

Lines changed: 10 additions & 82 deletions

File tree

src/lib/models.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import consola from "consola"
22

33
import type { GetModelsResponse } from "~/services/copilot/get-models/types"
44

5-
import { getModels } from "~/services/copilot/get-models/service"
5+
import { getModels } from "~/services/copilot/get-models"
66

77
import { state } from "./state"
88

src/lib/state.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
import type { GetModelsResponse } from "~/services/copilot/get-models/types"
1+
import type { ModelsResponse } from "~/services/copilot/get-models"
22

33
interface State {
44
githubToken?: string
55
copilotToken?: string
6-
models?: GetModelsResponse
6+
models?: ModelsResponse
77
}
88

99
export const state: State = {}

src/lib/token.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import consola from "consola"
22
import fs from "node:fs/promises"
33

44
import { PATHS } from "~/lib/paths"
5-
import { getCopilotToken } from "~/services/copilot/get-token/copilot-token"
5+
import { getCopilotToken } from "~/services/copilot/get-copilot-token"
66
import { getDeviceCode } from "~/services/github/get-device-code"
77
import { getGitHubUser } from "~/services/github/get-user"
88
import { pollAccessToken } from "~/services/github/poll-access-token"

src/routes/models/route.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import consola from "consola"
22
import { Hono } from "hono"
33
import { FetchError } from "ofetch"
44

5-
import { getModels } from "~/services/copilot/get-models/service"
5+
import { getModels } from "~/services/copilot/get-models"
66

77
export const modelRoutes = new Hono()
88

File renamed without changes.

src/services/copilot/get-models/service.ts renamed to src/services/copilot/get-models.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,11 @@ export const getModels = async () => {
1717
return (await response.json()) as ModelsResponse
1818
}
1919

20+
export interface ModelsResponse {
21+
data: Array<Model>
22+
object: string
23+
}
24+
2025
interface ModelLimits {
2126
max_context_window_tokens?: number
2227
max_output_tokens?: number
@@ -53,8 +58,3 @@ interface Model {
5358
terms: string
5459
}
5560
}
56-
57-
export interface ModelsResponse {
58-
data: Array<Model>
59-
object: string
60-
}

src/services/copilot/get-models/types.ts

Lines changed: 0 additions & 41 deletions
This file was deleted.

src/services/copilot/get-token/types.ts

Lines changed: 0 additions & 31 deletions
This file was deleted.

0 commit comments

Comments
 (0)