Update config.go
Browse files
config.go
CHANGED
|
@@ -1,74 +1,74 @@
|
|
| 1 |
-
package main
|
| 2 |
-
|
| 3 |
-
import (
|
| 4 |
-
"log"
|
| 5 |
-
"time"
|
| 6 |
-
|
| 7 |
-
"atlassian/db"
|
| 8 |
-
)
|
| 9 |
-
|
| 10 |
-
// Configuration & constants
|
| 11 |
-
const (
|
| 12 |
-
// Debug mode for verbose logging
|
| 13 |
-
DebugMode =
|
| 14 |
-
|
| 15 |
-
// Upstream Atlassian AI Gateway
|
| 16 |
-
RovoDevProxyURL = "https://api.atlassian.com/rovodev/v2/proxy/ai"
|
| 17 |
-
UnifiedChatPath = "/v2/beta/chat"
|
| 18 |
-
AtlassianAPIEndpoint = RovoDevProxyURL + UnifiedChatPath
|
| 19 |
-
|
| 20 |
-
// Retry configuration
|
| 21 |
-
InitialDelay = 500 * time.Millisecond
|
| 22 |
-
MaxDelay = 16 * time.Second
|
| 23 |
-
DelayMultiplier = 2
|
| 24 |
-
)
|
| 25 |
-
|
| 26 |
-
// Supported model list returned to clients (with prefixes visible)
|
| 27 |
-
var SupportedModels = []string{
|
| 28 |
-
"anthropic:claude-3-5-sonnet-v2@20241022",
|
| 29 |
-
"anthropic:claude-3-7-sonnet@20250219",
|
| 30 |
-
"anthropic:claude-sonnet-4@20250514",
|
| 31 |
-
"anthropic:claude-opus-4@20250514",
|
| 32 |
-
"google:gemini-2.0-flash-001",
|
| 33 |
-
"google:gemini-2.5-pro-preview-03-25",
|
| 34 |
-
"google:gemini-2.5-flash-preview-04-17",
|
| 35 |
-
"bedrock:anthropic.claude-3-5-sonnet-20241022-v2:0",
|
| 36 |
-
"bedrock:anthropic.claude-3-7-sonnet-20250219-v1:0",
|
| 37 |
-
"bedrock:anthropic.claude-sonnet-4-20250514-v1:0",
|
| 38 |
-
"bedrock:anthropic.claude-opus-4-20250514-v1:0",
|
| 39 |
-
}
|
| 40 |
-
|
| 41 |
-
// Credential represents an email/token pair
|
| 42 |
-
type Credential struct {
|
| 43 |
-
Email string
|
| 44 |
-
Token string
|
| 45 |
-
}
|
| 46 |
-
|
| 47 |
-
var Credentials []Credential
|
| 48 |
-
|
| 49 |
-
var IsFirstRun = true
|
| 50 |
-
|
| 51 |
-
// LoadCredentials loads credentials from database
|
| 52 |
-
func LoadCredentials() {
|
| 53 |
-
dbCredentials, err := db.GetAllCredentials()
|
| 54 |
-
if err != nil {
|
| 55 |
-
log.Printf("Failed to load credentials from database: %v", err)
|
| 56 |
-
|
| 57 |
-
Credentials = []Credential{}
|
| 58 |
-
return
|
| 59 |
-
}
|
| 60 |
-
|
| 61 |
-
Credentials = make([]Credential, 0, len(dbCredentials))
|
| 62 |
-
for _, cred := range dbCredentials {
|
| 63 |
-
Credentials = append(Credentials, Credential{
|
| 64 |
-
Email: cred.Email,
|
| 65 |
-
Token: cred.Token,
|
| 66 |
-
})
|
| 67 |
-
}
|
| 68 |
-
|
| 69 |
-
log.Printf("Loaded %d credentials from database", len(Credentials))
|
| 70 |
-
}
|
| 71 |
-
|
| 72 |
-
func ReloadCredentials() {
|
| 73 |
-
LoadCredentials()
|
| 74 |
-
}
|
|
|
|
| 1 |
+
package main
|
| 2 |
+
|
| 3 |
+
import (
|
| 4 |
+
"log"
|
| 5 |
+
"time"
|
| 6 |
+
|
| 7 |
+
"atlassian/db"
|
| 8 |
+
)
|
| 9 |
+
|
| 10 |
+
// Configuration & constants
|
| 11 |
+
const (
|
| 12 |
+
// Debug mode for verbose logging
|
| 13 |
+
DebugMode = true
|
| 14 |
+
|
| 15 |
+
// Upstream Atlassian AI Gateway
|
| 16 |
+
RovoDevProxyURL = "https://api.atlassian.com/rovodev/v2/proxy/ai"
|
| 17 |
+
UnifiedChatPath = "/v2/beta/chat"
|
| 18 |
+
AtlassianAPIEndpoint = RovoDevProxyURL + UnifiedChatPath
|
| 19 |
+
|
| 20 |
+
// Retry configuration
|
| 21 |
+
InitialDelay = 500 * time.Millisecond
|
| 22 |
+
MaxDelay = 16 * time.Second
|
| 23 |
+
DelayMultiplier = 2
|
| 24 |
+
)
|
| 25 |
+
|
| 26 |
+
// Supported model list returned to clients (with prefixes visible)
|
| 27 |
+
var SupportedModels = []string{
|
| 28 |
+
"anthropic:claude-3-5-sonnet-v2@20241022",
|
| 29 |
+
"anthropic:claude-3-7-sonnet@20250219",
|
| 30 |
+
"anthropic:claude-sonnet-4@20250514",
|
| 31 |
+
"anthropic:claude-opus-4@20250514",
|
| 32 |
+
"google:gemini-2.0-flash-001",
|
| 33 |
+
"google:gemini-2.5-pro-preview-03-25",
|
| 34 |
+
"google:gemini-2.5-flash-preview-04-17",
|
| 35 |
+
"bedrock:anthropic.claude-3-5-sonnet-20241022-v2:0",
|
| 36 |
+
"bedrock:anthropic.claude-3-7-sonnet-20250219-v1:0",
|
| 37 |
+
"bedrock:anthropic.claude-sonnet-4-20250514-v1:0",
|
| 38 |
+
"bedrock:anthropic.claude-opus-4-20250514-v1:0",
|
| 39 |
+
}
|
| 40 |
+
|
| 41 |
+
// Credential represents an email/token pair
|
| 42 |
+
type Credential struct {
|
| 43 |
+
Email string
|
| 44 |
+
Token string
|
| 45 |
+
}
|
| 46 |
+
|
| 47 |
+
var Credentials []Credential
|
| 48 |
+
|
| 49 |
+
var IsFirstRun = true
|
| 50 |
+
|
| 51 |
+
// LoadCredentials loads credentials from database
|
| 52 |
+
func LoadCredentials() {
|
| 53 |
+
dbCredentials, err := db.GetAllCredentials()
|
| 54 |
+
if err != nil {
|
| 55 |
+
log.Printf("Failed to load credentials from database: %v", err)
|
| 56 |
+
|
| 57 |
+
Credentials = []Credential{}
|
| 58 |
+
return
|
| 59 |
+
}
|
| 60 |
+
|
| 61 |
+
Credentials = make([]Credential, 0, len(dbCredentials))
|
| 62 |
+
for _, cred := range dbCredentials {
|
| 63 |
+
Credentials = append(Credentials, Credential{
|
| 64 |
+
Email: cred.Email,
|
| 65 |
+
Token: cred.Token,
|
| 66 |
+
})
|
| 67 |
+
}
|
| 68 |
+
|
| 69 |
+
log.Printf("Loaded %d credentials from database", len(Credentials))
|
| 70 |
+
}
|
| 71 |
+
|
| 72 |
+
func ReloadCredentials() {
|
| 73 |
+
LoadCredentials()
|
| 74 |
+
}
|