File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -39,7 +39,7 @@ interface ModelCapabilities {
3939 type : string
4040}
4141
42- interface Model {
42+ export interface Model {
4343 capabilities : ModelCapabilities
4444 id : string
4545 model_picker_enabled : boolean
Original file line number Diff line number Diff line change @@ -6,6 +6,8 @@ import consola from "consola"
66import { serve , type ServerHandler } from "srvx"
77import invariant from "tiny-invariant"
88
9+ import type { Model } from "./services/copilot/get-models"
10+
911import { ensurePaths } from "./lib/paths"
1012import { generateEnvScript } from "./lib/shell"
1113import { state } from "./lib/state"
@@ -26,6 +28,13 @@ interface RunServerOptions {
2628 headerMode: string
2729}
2830
31+ const formatModelInfo = ( model : Model ) => {
32+ const contextWindow = model . capabilities . limits . max_context_window_tokens
33+ const contextStr =
34+ contextWindow ? ` (${ ( contextWindow / 1000 ) . toFixed ( 0 ) } K tokens)` : ""
35+ return `- ${ model . id } ${ contextStr } `
36+ }
37+
2938export async function runServer ( options : RunServerOptions ) : Promise < void > {
3039 if ( options . verbose ) {
3140 consola . level = 5
@@ -68,7 +77,7 @@ export async function runServer(options: RunServerOptions): Promise<void> {
6877 await cacheModels ( )
6978
7079 consola . info (
71- `Available models: \n${ state . models ?. data . map ( ( model ) => `- ${ model . id } ` ) . join ( "\n" ) } ` ,
80+ `Available models: \n${ state . models ?. data . map ( ( model ) => formatModelInfo ( model ) ) . join ( "\n" ) } ` ,
7281 )
7382
7483 const serverUrl = `http://localhost:${ options . port } `
You can’t perform that action at this time.
0 commit comments