mirror of
https://github.com/memohai/Memoh.git
synced 2026-04-27 07:16:19 +09:00
6aebbe9279
Major changes: 1. Core Architecture: Decoupled Bots from Users. Bots now have independent lifecycles, member management (bot_members), and dedicated configurations. 2. Channel Gateway: - Implemented a unified Channel Manager supporting Feishu, Telegram, and Local (Web/CLI) adapters. - Added message processing pipeline to normalize interactions across different platforms. - Introduced a Contact system for identity binding and guest access policies. 3. Database & Tooling: - Consolidated all migrations into 0001_init with updated schema for bots, channels, and contacts. - Optimized sqlc.yaml to automatically track the migrations directory. 4. Agent Enhancements: - Introduced ToolContext to provide Agents with platform-aware execution capabilities (e.g., messaging, contact lookups). - Added tool logging and fallback mechanisms for toolChoice execution. 5. UI & Docs: Updated frontend stores, UI components, and Swagger documentation to align with the new Bot-centric model.
102 lines
2.6 KiB
Go
102 lines
2.6 KiB
Go
// Code generated by sqlc. DO NOT EDIT.
|
|
// versions:
|
|
// sqlc v1.30.0
|
|
// source: containers.sql
|
|
|
|
package sqlc
|
|
|
|
import (
|
|
"context"
|
|
|
|
"github.com/jackc/pgx/v5/pgtype"
|
|
)
|
|
|
|
const getContainerByContainerID = `-- name: GetContainerByContainerID :one
|
|
SELECT id, bot_id, container_id, container_name, image, status, namespace, auto_start, host_path, container_path, created_at, updated_at, last_started_at, last_stopped_at FROM containers WHERE container_id = $1
|
|
`
|
|
|
|
func (q *Queries) GetContainerByContainerID(ctx context.Context, containerID string) (Container, error) {
|
|
row := q.db.QueryRow(ctx, getContainerByContainerID, containerID)
|
|
var i Container
|
|
err := row.Scan(
|
|
&i.ID,
|
|
&i.BotID,
|
|
&i.ContainerID,
|
|
&i.ContainerName,
|
|
&i.Image,
|
|
&i.Status,
|
|
&i.Namespace,
|
|
&i.AutoStart,
|
|
&i.HostPath,
|
|
&i.ContainerPath,
|
|
&i.CreatedAt,
|
|
&i.UpdatedAt,
|
|
&i.LastStartedAt,
|
|
&i.LastStoppedAt,
|
|
)
|
|
return i, err
|
|
}
|
|
|
|
const upsertContainer = `-- name: UpsertContainer :exec
|
|
INSERT INTO containers (
|
|
bot_id, container_id, container_name, image, status, namespace, auto_start,
|
|
host_path, container_path, last_started_at, last_stopped_at
|
|
)
|
|
VALUES (
|
|
$1,
|
|
$2,
|
|
$3,
|
|
$4,
|
|
$5,
|
|
$6,
|
|
$7,
|
|
$8,
|
|
$9,
|
|
$10,
|
|
$11
|
|
)
|
|
ON CONFLICT (container_id) DO UPDATE SET
|
|
bot_id = EXCLUDED.bot_id,
|
|
container_name = EXCLUDED.container_name,
|
|
image = EXCLUDED.image,
|
|
status = EXCLUDED.status,
|
|
namespace = EXCLUDED.namespace,
|
|
auto_start = EXCLUDED.auto_start,
|
|
host_path = EXCLUDED.host_path,
|
|
container_path = EXCLUDED.container_path,
|
|
last_started_at = EXCLUDED.last_started_at,
|
|
last_stopped_at = EXCLUDED.last_stopped_at,
|
|
updated_at = now()
|
|
`
|
|
|
|
type UpsertContainerParams struct {
|
|
BotID pgtype.UUID `json:"bot_id"`
|
|
ContainerID string `json:"container_id"`
|
|
ContainerName string `json:"container_name"`
|
|
Image string `json:"image"`
|
|
Status string `json:"status"`
|
|
Namespace string `json:"namespace"`
|
|
AutoStart bool `json:"auto_start"`
|
|
HostPath pgtype.Text `json:"host_path"`
|
|
ContainerPath string `json:"container_path"`
|
|
LastStartedAt pgtype.Timestamptz `json:"last_started_at"`
|
|
LastStoppedAt pgtype.Timestamptz `json:"last_stopped_at"`
|
|
}
|
|
|
|
func (q *Queries) UpsertContainer(ctx context.Context, arg UpsertContainerParams) error {
|
|
_, err := q.db.Exec(ctx, upsertContainer,
|
|
arg.BotID,
|
|
arg.ContainerID,
|
|
arg.ContainerName,
|
|
arg.Image,
|
|
arg.Status,
|
|
arg.Namespace,
|
|
arg.AutoStart,
|
|
arg.HostPath,
|
|
arg.ContainerPath,
|
|
arg.LastStartedAt,
|
|
arg.LastStoppedAt,
|
|
)
|
|
return err
|
|
}
|