mirror of
https://github.com/coder/coder.git
synced 2026-06-03 13:08:25 +00:00
edee917d88
feat: add AI chat system with agent tools and chat UI Introduce the chatd subsystem and Agents UI for AI-powered chat within Coder workspaces. - Add chatd package with chat loop, message compaction, prompt management, and LLM provider integration (OpenAI, Anthropic) - Add agent tools: create workspace, list/read templates, read/write/ edit files, execute commands - Add chat API endpoints with streaming, message editing, and durable reconnection - Add database schema and migrations for chats, chat messages, chat providers, and chat model configs - Add RBAC policies and dbauthz enforcement for chat resources - Add Agents UI pages with conversation timeline, queued messages list, diff viewer, and model configuration panel - Add comprehensive test coverage including coderd integration tests, chatd unit tests, and Storybook stories - Gate feature behind experiments flag --------- Co-authored-by: Cian Johnston <cian@coder.com> Co-authored-by: Danielle Maywood <danielle@themaywoods.com> Co-authored-by: Jeremy Ruppel <jeremy@coder.com> Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
76 lines
1.2 KiB
SQL
76 lines
1.2 KiB
SQL
-- name: GetChatProviderByID :one
|
|
SELECT
|
|
*
|
|
FROM
|
|
chat_providers
|
|
WHERE
|
|
id = @id::uuid;
|
|
|
|
-- name: GetChatProviderByProvider :one
|
|
SELECT
|
|
*
|
|
FROM
|
|
chat_providers
|
|
WHERE
|
|
provider = @provider::text;
|
|
|
|
-- name: GetChatProviders :many
|
|
SELECT
|
|
*
|
|
FROM
|
|
chat_providers
|
|
ORDER BY
|
|
provider ASC;
|
|
|
|
-- name: GetEnabledChatProviders :many
|
|
SELECT
|
|
*
|
|
FROM
|
|
chat_providers
|
|
WHERE
|
|
enabled = TRUE
|
|
ORDER BY
|
|
provider ASC;
|
|
|
|
-- name: InsertChatProvider :one
|
|
INSERT INTO chat_providers (
|
|
provider,
|
|
display_name,
|
|
api_key,
|
|
base_url,
|
|
api_key_key_id,
|
|
created_by,
|
|
enabled
|
|
) VALUES (
|
|
@provider::text,
|
|
@display_name::text,
|
|
@api_key::text,
|
|
@base_url::text,
|
|
sqlc.narg('api_key_key_id')::text,
|
|
sqlc.narg('created_by')::uuid,
|
|
@enabled::boolean
|
|
)
|
|
RETURNING
|
|
*;
|
|
|
|
-- name: UpdateChatProvider :one
|
|
UPDATE
|
|
chat_providers
|
|
SET
|
|
display_name = @display_name::text,
|
|
api_key = @api_key::text,
|
|
base_url = @base_url::text,
|
|
api_key_key_id = sqlc.narg('api_key_key_id')::text,
|
|
enabled = @enabled::boolean,
|
|
updated_at = NOW()
|
|
WHERE
|
|
id = @id::uuid
|
|
RETURNING
|
|
*;
|
|
|
|
-- name: DeleteChatProviderByID :exec
|
|
DELETE FROM
|
|
chat_providers
|
|
WHERE
|
|
id = @id::uuid;
|