Saltar al contenido principal

GitHub Copilot

Traducción Beta No Oficial

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:

  1. Mostrar un código de dispositivo y URL de verificación

  2. Abrir tu navegador en la página de autorización de GitHub

  3. Pedirte que introduzcas el código de dispositivo

  4. 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

{
"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

NameTypeDefaultDescription
http_timeoutint20The default timeout for HTTP requests in milliseconds

Plantilla (info)

plantilla predeterminada
 \uec1e {{ .Premium.Percent.Gauge }}

Propiedades

NameTypeDescription
.PremiumCopilotUsagePremium interactions usage data
.Premium.UsedintNumber of premium interactions used
.Premium.LimitintTotal premium interactions available
.Premium.PercentPercentagePercentage of premium quota used (0-100)
.Premium.RemainingPercentagePercentage of premium quota remaining (0-100)
.Premium.UnlimitedboolWhether premium quota is unlimited
.InlineCopilotUsageInline completions usage data
.Inline.UsedintNumber of inline completions used
.Inline.LimitintTotal inline completions available
.Inline.PercentPercentagePercentage of inline quota used (0-100)
.Inline.RemainingPercentagePercentage of inline quota remaining (0-100)
.Inline.UnlimitedboolWhether inline quota is unlimited
.ChatCopilotUsageChat usage data
.Chat.UsedintNumber of chat interactions used
.Chat.LimitintTotal chat interactions available
.Chat.PercentPercentagePercentage of chat quota used (0-100)
.Chat.RemainingPercentagePercentage of chat quota remaining (0-100)
.Chat.UnlimitedboolWhether chat quota is unlimited
.BillingCycleEndstringEnd 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:

MethodReturnsDescription
.Gauge()stringVisual gauge showing remaining capacity using 5 bar blocks (▰▰▰▰▱)
.GaugeUsed()stringVisual gauge showing used capacity using 5 bar blocks (▰▱▱▱▱)
.String()stringNumeric 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 }}"