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

Function setChatStatus

coderd/x/chatd/subagent_internal_test.go:3050–3074  ·  view source on GitHub ↗

setChatStatus transitions a chat to the given status.

(
	ctx context.Context,
	t *testing.T,
	db database.Store,
	chatID uuid.UUID,
	status database.ChatStatus,
	lastError string,
)

Source from the content-addressed store, hash-verified

3048
3049// setChatStatus transitions a chat to the given status.
3050func setChatStatus(
3051 ctx context.Context,
3052 t *testing.T,
3053 db database.Store,
3054 chatID uuid.UUID,
3055 status database.ChatStatus,
3056 lastError string,
3057) {
3058 t.Helper()
3059
3060 params := database.UpdateChatStatusParams{
3061 ID: chatID,
3062 Status: status,
3063 }
3064 if lastError != "" {
3065 encodedLastError, err := json.Marshal(codersdk.ChatError{
3066 Message: lastError,
3067 Kind: codersdk.ChatErrorKindGeneric,
3068 })
3069 require.NoError(t, err)
3070 params.LastError = pqtype.NullRawMessage{RawMessage: encodedLastError, Valid: true}
3071 }
3072 _, err := db.UpdateChatStatus(ctx, params)
3073 require.NoError(t, err)
3074}
3075
3076// insertAssistantMessage inserts an assistant message with v1 content
3077// into a chat.

Calls 3

HelperMethod · 0.65
UpdateChatStatusMethod · 0.65
MarshalMethod · 0.45

Tested by

no test coverage detected