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

Method getUserChatCustomPrompt

coderd/exp_chats.go:5779–5801  ·  view source on GitHub ↗

EXPERIMENTAL: this endpoint is experimental and is subject to change. nolint:revive // get-return: revive assumes get* must be a getter, but this is an HTTP handler.

(rw http.ResponseWriter, r *http.Request)

Source from the content-addressed store, hash-verified

5777//
5778//nolint:revive // get-return: revive assumes get* must be a getter, but this is an HTTP handler.
5779func (api *API) getUserChatCustomPrompt(rw http.ResponseWriter, r *http.Request) {
5780 var (
5781 ctx = r.Context()
5782 apiKey = httpmw.APIKey(r)
5783 )
5784
5785 customPrompt, err := api.Database.GetUserChatCustomPrompt(ctx, apiKey.UserID)
5786 if err != nil {
5787 if !errors.Is(err, sql.ErrNoRows) {
5788 httpapi.Write(ctx, rw, http.StatusInternalServerError, codersdk.Response{
5789 Message: "Error reading user chat custom prompt.",
5790 Detail: err.Error(),
5791 })
5792 return
5793 }
5794
5795 customPrompt = ""
5796 }
5797
5798 httpapi.Write(ctx, rw, http.StatusOK, codersdk.UserChatCustomPrompt{
5799 CustomPrompt: customPrompt,
5800 })
5801}
5802
5803// EXPERIMENTAL: this endpoint is experimental and is subject to change.
5804func (api *API) putUserChatCustomPrompt(rw http.ResponseWriter, r *http.Request) {

Callers 2

chatUserCustomPromptFunction · 0.80

Calls 6

APIKeyFunction · 0.92
WriteFunction · 0.92
ContextMethod · 0.65
IsMethod · 0.45
ErrorMethod · 0.45

Tested by 1