basic llm request stream
This commit is contained in:
1 parent
f74e4d1043
commit
a92cc76a9a
66 files changed
+1496
-158
No files matched your search
@@ -10,24 +10,24 @@ import (
|
||||
|
||||
type TursoAgentRepository struct {
|
||||
db *sql.DB
|
||||
AgentTable orm.Table[domain.Agent]
|
||||
agentTable orm.Table[domain.Agent]
|
||||
}
|
||||
|
||||
func NewTursoAgentRepository(db *sql.DB) *TursoAgentRepository {
|
||||
dialect := orm.NewSqliteDialect()
|
||||
AgentTable, err := orm.NewTable[domain.Agent](db, dialect, "agents")
|
||||
agentTable, err := orm.NewTable[domain.Agent](db, dialect, "agents")
|
||||
if err != nil {
|
||||
log.Fatalf("error creating lasebuche agent table")
|
||||
}
|
||||
|
||||
return &TursoAgentRepository{
|
||||
db: db,
|
||||
AgentTable: AgentTable,
|
||||
agentTable: agentTable,
|
||||
}
|
||||
}
|
||||
|
||||
func (r *TursoAgentRepository) ListAgents(userID string, teamID string) ([]*domain.Agent, error) {
|
||||
return r.AgentTable.Select(
|
||||
return r.agentTable.Select(
|
||||
orm.WithWhere(
|
||||
"team_id=$1 and team_id in (select team_id from user_teams where user_id=$2)",
|
||||
teamID,
|
||||
@@ -37,7 +37,7 @@ func (r *TursoAgentRepository) ListAgents(userID string, teamID string) ([]*doma
|
||||
}
|
||||
|
||||
func (r *TursoAgentRepository) GetAgent(userID string, teamID string, id string) (*domain.Agent, error) {
|
||||
return r.AgentTable.SelectOne(
|
||||
return r.agentTable.SelectOne(
|
||||
"id=$1 and team_id=$2 and team_id in (select team_id from user_teams where user_id=$3)",
|
||||
id,
|
||||
teamID,
|
||||
@@ -46,15 +46,15 @@ func (r *TursoAgentRepository) GetAgent(userID string, teamID string, id string)
|
||||
}
|
||||
|
||||
func (r *TursoAgentRepository) CreateAgent(userID string, agent *domain.Agent) (*domain.Agent, error) {
|
||||
return r.AgentTable.Insert(agent)
|
||||
return r.agentTable.Insert(agent)
|
||||
}
|
||||
|
||||
func (r *TursoAgentRepository) UpdateAgent(userID string, agent *domain.Agent) (*domain.Agent, error) {
|
||||
return r.AgentTable.Update(agent)
|
||||
return r.agentTable.Update(agent)
|
||||
}
|
||||
|
||||
func (r *TursoAgentRepository) DeleteAgent(userID string, teamID string, id string) error {
|
||||
return r.AgentTable.DeleteWhere(
|
||||
return r.agentTable.DeleteWhere(
|
||||
"id=$1 and team_id=$2 and team_id in (select team_id from user_teams where user_id=$3)",
|
||||
id,
|
||||
teamID,
|
||||
|
||||
Reference in new issue
Block a user