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

Method GetPrompt

internal/services/chat_v2.go:87–105  ·  view source on GitHub ↗
(ctx context.Context, content string, selectedText string, surrounding string, conversationType chatv2.ConversationType)

Source from the content-addressed store, hash-verified

85}
86
87func (s *ChatServiceV2) GetPrompt(ctx context.Context, content string, selectedText string, surrounding string, conversationType chatv2.ConversationType) (string, error) {
88 var tmpl *template.Template
89 switch conversationType {
90 case chatv2.ConversationType_CONVERSATION_TYPE_DEBUG:
91 tmpl = userPromptDebugTmplV2
92 default:
93 tmpl = userPromptDefaultTmplV2
94 }
95
96 var userPromptBuffer bytes.Buffer
97 if err := tmpl.Execute(&userPromptBuffer, map[string]string{
98 "UserInput": content,
99 "SelectedText": selectedText,
100 "Surrounding": surrounding,
101 }); err != nil {
102 return "", err
103 }
104 return strings.TrimSpace(userPromptBuffer.String()), nil
105}
106
107func (s *ChatServiceV2) InsertConversationToDBV2(ctx context.Context, userID bson.ObjectID, projectID string, modelSlug string, inappChatHistory []*chatv2.Message, openaiChatHistory []openai.ChatCompletionMessageParamUnion) (*models.Conversation, error) {
108 // Convert protobuf messages to BSON

Callers

nothing calls this directly

Calls 1

StringMethod · 0.45

Tested by

no test coverage detected