GitHub Copilot
Cette page a été traduite par PageTurner AI (bêta). Non approuvée officiellement par le projet. Vous avez trouvé une erreur ? Signaler un problème →
Description
Affiche vos statistiques d'utilisation et informations de quota de GitHub Copilot, incluant les interactions premium, les complétions en ligne et l'utilisation du chat. Ce segment a été inspiré par l'application Tauri d'utilisation de GitHub Copilot d'Elio Struyf.
Authentification
Ce segment nécessite une authentification GitHub pour accéder aux données d'utilisation Copilot. Utilisez le flux OAuth intégré avec code appareil :
oh-my-posh auth copilot
Ce processus va :
-
Afficher un code appareil et une URL de vérification
-
Ouvrir votre navigateur sur la page d'autorisation GitHub
-
Vous inviter à saisir le code appareil
-
Stocker le jeton d'accès de façon sécurisée pour usage futur
Le jeton est stocké de manière sécurisée et sera utilisé automatiquement par le segment.
Exemple de configuration
- 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
Options
| Name | Type | Default | Description |
|---|---|---|---|
http_timeout | int | 20 | The default timeout for HTTP requests in milliseconds |
Modèle (info)
\uec1e {{ .Premium.Percent.Gauge }}
Propriétés
| 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éthodes de pourcentage
Le type Percentage offre des fonctionnalités supplémentaires au-delà de la simple valeur numérique :
| 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) |
Exemple de visualisation de jauge (montre la capacité restante) :
-
0 % utilisé (100 % restant) :
▰▰▰▰▰ -
20 % utilisé (80 % restant) :
▰▰▰▰▱ -
40 % utilisé (60 % restant) :
▰▰▰▱▱ -
60 % utilisé (40 % restant) :
▰▰▱▱▱ -
80 % utilisé (20 % restant) :
▰▱▱▱▱ -
100 % utilisé (0 % restant) :
▱▱▱▱▱
Exemple de visualisation gaugeUsed (montre la capacité utilisée) :
-
0 % utilisé :
▱▱▱▱▱ -
20 % utilisé :
▰▱▱▱▱ -
40 % utilisé :
▰▰▱▱▱ -
60 % utilisé :
▰▰▰▱▱ -
80 % utilisé :
▰▰▰▰▱ -
100 % utilisé :
▰▰▰▰▰
Exemple de modèle avec jauge :
"template": "{{ .Premium.Percent.Gauge() }} {{ .Premium.Used }}/{{ .Premium.Limit }}"
Exemple de modèle montrant la capacité utilisée :
"template": "{{ .Premium.Percent.GaugeUsed() }} {{ .Premium.Used }}/{{ .Premium.Limit }}"