This commit is contained in:
mudler
2024-04-16 17:44:04 +02:00
parent 4ed61daf8e
commit 35d9ba44f5
7 changed files with 66 additions and 26 deletions

View File

@@ -155,6 +155,7 @@ func (a *AgentPool) startAgentWithConfig(name string, config *AgentConfig) error
),
WithStateFile(stateFile),
WithCharacterFile(characterFile),
WithTimeout(timeout),
WithRAGDB(a.ragDB),
WithAgentReasoningCallback(func(state ActionCurrentState) bool {
slog.Info("Reasoning", state.Reasoning)

View File

@@ -61,6 +61,7 @@ func (g *GithubIssues) Start(a *agent.Agent) {
slog.Info("Looking into github issues...")
g.issuesService()
case <-a.Context().Done():
slog.Info("GithubIssues connector is now stopping")
return
}
}
@@ -152,25 +153,23 @@ func (g *GithubIssues) issuesService() {
continue
}
go func() {
res := g.agent.Ask(
agent.WithConversationHistory(messages),
)
if res.Error != nil {
slog.Error("Error asking", "error", res.Error)
return
}
res := g.agent.Ask(
agent.WithConversationHistory(messages),
)
if res.Error != nil {
slog.Error("Error asking", "error", res.Error)
return
}
_, _, err := g.client.Issues.CreateComment(
g.agent.Context(),
g.owner, g.repository,
issue.GetNumber(), &github.IssueComment{
Body: github.String(res.Response),
},
)
if err != nil {
slog.Error("Error creating comment", "error", err)
}
}()
_, _, err := g.client.Issues.CreateComment(
g.agent.Context(),
g.owner, g.repository,
issue.GetNumber(), &github.IssueComment{
Body: github.String(res.Response),
},
)
if err != nil {
slog.Error("Error creating comment", "error", err)
}
}
}

View File

@@ -21,6 +21,7 @@ var apiURL = os.Getenv("API_URL")
var apiKey = os.Getenv("API_KEY")
var vectorStore = os.Getenv("VECTOR_STORE")
var kbdisableIndexing = os.Getenv("KBDISABLEINDEX")
var timeout = os.Getenv("TIMEOUT")
const defaultChunkSize = 4098
@@ -31,6 +32,9 @@ func init() {
if apiURL == "" {
apiURL = "http://192.168.68.113:8080"
}
if timeout == "" {
timeout = "5m"
}
}
//go:embed views/*
@@ -50,7 +54,7 @@ func main() {
os.MkdirAll(stateDir, 0755)
var dbStore RAGDB
lai := llm.NewClient(apiKey, apiURL+"/v1")
lai := llm.NewClient(apiKey, apiURL+"/v1", timeout)
switch vectorStore {
case "localai":