GitHub Copilot
Esta página fue traducida por PageTurner AI (beta). No está respaldada oficialmente por el proyecto. ¿Encontraste un error? Reportar problema →
Qué hace
Muestra tus estadísticas de uso e información de cuota de GitHub Copilot, incluidas interacciones premium, sugerencias en línea y uso del chat. Este segmento fue inspirado por la aplicación Tauri de Elio Struyf para el uso de GitHub Copilot.
Autenticación
Este segmento requiere autenticación con GitHub para acceder a los datos de uso de Copilot. Usa el flujo OAuth de código de dispositivo incorporado:
oh-my-posh auth copilot
Esto hará lo siguiente:
-
Mostrar un código de dispositivo y URL de verificación
-
Abrir tu navegador en la página de autorización de GitHub
-
Pedirte que introduzcas el código de dispositivo
-
Almacenar el token de acceso de forma segura para uso futuro
El token se almacena de forma segura y será utilizado automáticamente por el segmento.
Configuración de ejemplo
- json
- yaml
- toml
{
"type": "copilot",
"style": "diamond",
"leading_diamond": "",
"trailing_diamond": "",
"foreground": "#111111",
"background": "#fee898",
"template": " {{ .Premium.Percent.Gauge }} ",
"cache": {
"duration": "5m",
"strategy": "session"
},
"options": {
"http_timeout": 1000
}
}
type: copilot
style: diamond
leading_diamond:
trailing_diamond:
foreground: "#111111"
background: "#fee898"
template: " {{ .Premium.Percent.Gauge }} "
cache:
duration: 5m
strategy: session
options:
http_timeout: 1000
type = "copilot"
style = "diamond"
leading_diamond = ""
trailing_diamond = ""
foreground = "#111111"
background = "#fee898"
template = " {{ .Premium.Percent.Gauge }} "
[cache]
duration = "5m"
strategy = "session"
[options]
http_timeout = 1000
Opciones
| Name | Type | Default | Description |
|---|---|---|---|
http_timeout | int | 20 | The default timeout for HTTP requests in milliseconds |
Plantilla (info)
\uec1e {{ .Premium.Percent.Gauge }}
Propiedades
| Name | Type | Description |
|---|---|---|
.Premium | CopilotUsage | Premium interactions usage data |
.Premium.Used | int | Number of premium interactions used |
.Premium.Limit | int | Total premium interactions available |
.Premium.Percent | Percentage | Percentage of premium quota used (0-100) |
.Premium.Remaining | Percentage | Percentage of premium quota remaining (0-100) |
.Premium.Unlimited | bool | Whether premium quota is unlimited |
.Inline | CopilotUsage | Inline completions usage data |
.Inline.Used | int | Number of inline completions used |
.Inline.Limit | int | Total inline completions available |
.Inline.Percent | Percentage | Percentage of inline quota used (0-100) |
.Inline.Remaining | Percentage | Percentage of inline quota remaining (0-100) |
.Inline.Unlimited | bool | Whether inline quota is unlimited |
.Chat | CopilotUsage | Chat usage data |
.Chat.Used | int | Number of chat interactions used |
.Chat.Limit | int | Total chat interactions available |
.Chat.Percent | Percentage | Percentage of chat quota used (0-100) |
.Chat.Remaining | Percentage | Percentage of chat quota remaining (0-100) |
.Chat.Unlimited | bool | Whether chat quota is unlimited |
.BillingCycleEnd | string | End date of current billing cycle |
Métodos de porcentaje
El tipo Percentage ofrece funcionalidad adicional que va más allá del simple valor numérico:
| Method | Returns | Description |
|---|---|---|
.Gauge() | string | Visual gauge showing remaining capacity using 5 bar blocks (▰▰▰▰▱) |
.GaugeUsed() | string | Visual gauge showing used capacity using 5 bar blocks (▰▱▱▱▱) |
.String() | string | Numeric percentage value (e.g., "75" for use in templates) |
Ejemplo de visualización del indicador (muestra capacidad restante):
-
0% usado (100% restante):
▰▰▰▰▰ -
20% usado (80% restante):
▰▰▰▰▱ -
40% usado (60% restante):
▰▰▰▱▱ -
60% usado (40% restante):
▰▰▱▱▱ -
80% usado (20% restante):
▰▱▱▱▱ -
100% usado (0% restante):
▱▱▱▱▱
Ejemplo de visualización de gaugeUsed (muestra capacidad usada):
-
0% usado:
▱▱▱▱▱ -
20% usado:
▰▱▱▱▱ -
40% usado:
▰▰▱▱▱ -
60% usado:
▰▰▰▱▱ -
80% usado:
▰▰▰▰▱ -
100% usado:
▰▰▰▰▰
Ejemplo de plantilla con indicador:
"template": "{{ .Premium.Percent.Gauge() }} {{ .Premium.Used }}/{{ .Premium.Limit }}"
Ejemplo de plantilla que muestra la capacidad usada:
"template": "{{ .Premium.Percent.GaugeUsed() }} {{ .Premium.Used }}/{{ .Premium.Limit }}"