Upgrade to Pro — share decks privately, control downloads, hide ads and more …

生成式 AI CodeGPT 開發經驗談

Bo-Yi Wu
November 08, 2023

生成式 AI CodeGPT 開發經驗談

議程網址: https://modernweb.tw/2023/session-page/2428

相信大家對 ChatGPT 不會很陌生,這是目前在生成式人工智慧 (AIGC: AI Generated Content) 內的當紅炸子雞,然而 ChatGPT 對於軟體工程師有什麼影響呢?能否透過 ChatGPT 改善團隊流程或協助開發?而我現在想到最直接的就是用 ChatGTP 幫忙寫 Git Commit Message,然而怎麼把 Commit Message 寫好可以參考這篇文章,為了能達成這目的,我用 Go 語言寫了一個 CLI 工具 CodeGPT (請大家幫忙分享),來協助軟體工程師整理開發內容

Bo-Yi Wu

November 08, 2023
Tweet

More Decks by Bo-Yi Wu

Other Decks in Technology

Transcript

  1. About me (Mediatek) • Maintain Drone CI/CD Plugin (15) •

    Member of Gitea Platform • Member of Gin Golang Framework • Maintain GitHub Actions Plugins (18).
  2. auth : = &oauth2.Conf i g{ ClientID : CLIENT_ID, ClientSecret:

    CLIENT_SECRET, RedirectURL : "http: / / localhost:9999/callback", Scopes: []string{"openid", "prof i le", "email"}, Endpoint: oauth2.Endpoint{ AuthURL : GITEA_SERVER + "/login/oauth/authorize", TokenURL : GITEA_SERVER + "/login/oauth/access_token", }, }
  3. apiKey : = c.GetHeader("api - key") if apiKey = =

    "" { apiKey = strings.TrimPref i x(c.GetHeader("Authorization"), "Bearer ") } if apiKey = = "" { c.AbortWithStatusJSON(http.StatusUnauthorized, gin.H{"error": gin.H{ "code": strconv.Itoa(http.StatusUnauthorized), "message": "missing authorization header or api key", }}) return } claims, err : = oauth.ParseToken(apiKey) if err ! = nil { c.AbortWithStatusJSON(http.StatusUnauthorized, gin.H{"error": gin.H{ "code": strconv.Itoa(http.StatusUnauthorized), "message": err.Error(), }}) return } / / Set the X-User-Id header to the account id from the JWT claims. c.Request.Header.Set("X-User-Id", claims.Account) / / Set the api - key header to the api key from the specif i c API key. c.Request.Header.Set("api - key", cfg.API.Key)  
  4. END