This commit is contained in:
ben Gutier 2023-09-10 20:57:46 +08:00
parent 23b7c3e825
commit 088c15e54b
2 changed files with 51 additions and 1 deletions

View File

@ -3,7 +3,7 @@
- 作为代理服务器中转copilot插件的API的请求
- 支持vscode插件和jetbrains插件
- 支持多用户共享一个token
- 优化请求逻辑token降低被ban概率别万人骑)
- 优化请求逻辑,降低token被ban概率别万人骑基本不可能封
![软件系统网络架构.png](https://img1.imgtp.com/2023/09/10/qTL8A2u9.png)
# 一、自行编译:
```

50
source/displayInfo.go Normal file
View File

@ -0,0 +1,50 @@
package main
import (
"github.com/nsf/termbox-go"
"time"
)
func DisplayInfo(dataGetter func() []InfoItem, exitChan chan bool) {
err := termbox.Init()
if err != nil {
panic(err)
}
defer termbox.Close()
termbox.SetInputMode(termbox.InputEsc)
for {
err := termbox.Clear(termbox.ColorDefault, termbox.ColorDefault)
if err != nil {
return
}
y := 0
data := dataGetter()
for _, item := range data {
drawString(0, y, item.Title, item.TitleColor, termbox.ColorDefault)
drawString(len(item.Title)+1, y, item.Value, item.ValueColor, termbox.ColorDefault)
y++
}
err = termbox.Flush()
if err != nil {
return
}
select {
case <-exitChan:
return // 通过退出通道退出循环
default:
}
time.Sleep(1 * time.Second)
}
}
func drawString(x, y int, text string, fg, bg termbox.Attribute) {
for _, char := range text {
termbox.SetCell(x, y, char, fg, bg)
x++
}
}