GitHub Copilot
Deze pagina is vertaald door PageTurner AI (beta). Niet officieel goedgekeurd door het project. Een fout gevonden? Probleem melden →
Wat
Toon je GitHub Copilot gebruiksstatistieken en quota-informatie, inclusief premium interacties, inline suggesties en chatgebruik. Dit segment is geïnspireerd door Elio Struyf's GitHub Copilot Usage Tauri-applicatie.
Authenticatie
Dit segment vereist authenticatie met GitHub om Copilot gebruiksdata te benaderen. Gebruik de ingebouwde OAuth device code flow:
oh-my-posh auth copilot
Dit zal:
-
Een device code en verificatie-URL tonen
-
Je browser openen naar GitHub's autorisatiepagina
-
Je vragen om de device code in te voeren
-
Het access token veilig opslaan voor toekomstig gebruik
Het token wordt veilig opgeslagen en wordt automatisch door het segment gebruikt.
Voorbeeldconfiguratie
- 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
Opties
| Name | Type | Default | Description |
|---|---|---|---|
http_timeout | int | 20 | The default timeout for HTTP requests in milliseconds |
Template (informatie)
\uec1e {{ .Premium.Percent.Gauge }}
Eigenschappen
| 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 |
Percentage-methoden
Het Percentage-type biedt extra functionaliteit naast alleen de numerieke waarde:
| 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) |
Voorbeeld gauge visualisatie (toont resterende capaciteit):
-
0% gebruikt (100% resterend):
▰▰▰▰▰ -
20% gebruikt (80% resterend):
▰▰▰▰▱ -
40% gebruikt (60% resterend):
▰▰▰▱▱ -
60% gebruikt (40% resterend):
▰▰▱▱▱ -
80% gebruikt (20% resterend):
▰▱▱▱▱ -
100% gebruikt (0% resterend):
▱▱▱▱▱
Voorbeeld gaugeUsed visualisatie (toont gebruikte capaciteit):
-
0% gebruikt:
▱▱▱▱▱ -
20% gebruikt:
▰▱▱▱▱ -
40% gebruikt:
▰▰▱▱▱ -
60% gebruikt:
▰▰▰▱▱ -
80% gebruikt:
▰▰▰▰▱ -
100% gebruikt:
▰▰▰▰▰
Voorbeeldtemplate met gauge:
"template": "{{ .Premium.Percent.Gauge() }} {{ .Premium.Used }}/{{ .Premium.Limit }}"
Voorbeeldtemplate die gebruikte capaciteit toont:
"template": "{{ .Premium.Percent.GaugeUsed() }} {{ .Premium.Used }}/{{ .Premium.Limit }}"