MCPcopy Create free account
hub / github.com/apache/devlake / parseActiveFile

Function parseActiveFile

backend/plugins/q_dev/tasks/s3_logging_extractor.go:378–400  ·  view source on GitHub ↗

parseActiveFile extracts the active file name and extension from prompt

(prompt string)

Source from the content-addressed store, hash-verified

376
377// parseActiveFile extracts the active file name and extension from prompt
378func parseActiveFile(prompt string) (string, string) {
379 start := strings.Index(prompt, "<ACTIVE-EDITOR-FILE>")
380 if start == -1 {
381 return "", ""
382 }
383 end := strings.Index(prompt[start:], "</ACTIVE-EDITOR-FILE>")
384 if end == -1 {
385 return "", ""
386 }
387 block := prompt[start : start+end]
388 nameStart := strings.Index(block, "name=\"")
389 if nameStart == -1 {
390 return "", ""
391 }
392 nameStart += len("name=\"")
393 nameEnd := strings.Index(block[nameStart:], "\"")
394 if nameEnd == -1 {
395 return "", ""
396 }
397 fileName := block[nameStart : nameStart+nameEnd]
398 ext := filepath.Ext(fileName)
399 return fileName, ext
400}
401
402func parseCompletionRecord(raw json.RawMessage, fileMeta *models.QDevS3FileMeta, identityClient UserDisplayNameResolver, cache *sync.Map) (*models.QDevCompletionLog, error) {
403 var record completionLogRecord

Callers 1

parseChatRecordFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected