MCPcopy Index your code
hub / github.com/coder/coder / persistBuildAgentBinding

Method persistBuildAgentBinding

coderd/x/chatd/chatd.go:734–761  ·  view source on GitHub ↗
(
	ctx context.Context,
	chatSnapshot database.Chat,
	buildID uuid.UUID,
	agentID uuid.UUID,
)

Source from the content-addressed store, hash-verified

732}
733
734func (c *turnWorkspaceContext) persistBuildAgentBinding(
735 ctx context.Context,
736 chatSnapshot database.Chat,
737 buildID uuid.UUID,
738 agentID uuid.UUID,
739) (database.Chat, error) {
740 updatedChat, err := c.server.db.UpdateChatBuildAgentBinding(
741 ctx,
742 database.UpdateChatBuildAgentBindingParams{
743 ID: chatSnapshot.ID,
744 BuildID: uuid.NullUUID{
745 UUID: buildID,
746 Valid: true,
747 },
748 AgentID: uuid.NullUUID{
749 UUID: agentID,
750 Valid: true,
751 },
752 },
753 )
754 if err != nil {
755 return chatSnapshot, xerrors.Errorf(
756 "update chat build/agent binding: %w", err,
757 )
758 }
759 c.setCurrentChat(updatedChat)
760 return updatedChat, nil
761}
762
763func (c *turnWorkspaceContext) getWorkspaceAgent(ctx context.Context) (database.WorkspaceAgent, error) {
764 _, agent, err := c.ensureWorkspaceAgent(ctx)

Callers 2

getWorkspaceConnMethod · 0.95

Calls 3

setCurrentChatMethod · 0.95
ErrorfMethod · 0.45

Tested by

no test coverage detected