MCPcopy Create free account
hub / github.com/PaperDebugger/paperdebugger / ListPrompts

Method ListPrompts

internal/api/user/list_prompts.go:74–102  ·  view source on GitHub ↗
(
	ctx context.Context,
	req *userv1.ListPromptsRequest,
)

Source from the content-addressed store, hash-verified

72}
73
74func (s *UserServer) ListPrompts(
75 ctx context.Context,
76 req *userv1.ListPromptsRequest,
77) (*userv1.ListPromptsResponse, error) {
78 actor, err := contextutil.GetActor(ctx)
79 if err != nil {
80 return nil, err
81 }
82
83 prompts, err := s.promptService.ListPrompts(ctx, actor.ID)
84 if err != nil {
85 return nil, err
86 }
87
88 // Get user prompts
89 userPrompts := mapper.MapModelPromptsToProto(prompts)
90
91 // Sort user prompts by UpdatedAt in descending order
92 sort.Slice(userPrompts, func(i, j int) bool {
93 return userPrompts[i].UpdatedAt.AsTime().After(userPrompts[j].UpdatedAt.AsTime())
94 })
95
96 // Append default prompts after sorted user prompts
97 allPrompts := append(userPrompts, defaultPrompts...)
98
99 return &userv1.ListPromptsResponse{
100 Prompts: allPrompts,
101 }, nil
102}

Callers

nothing calls this directly

Calls 3

GetActorFunction · 0.92
MapModelPromptsToProtoFunction · 0.92
ListPromptsMethod · 0.65

Tested by

no test coverage detected