Skip to content

Commit 92d8e96

Browse files
author
lin040204
committed
fix:remove underline between prompt
1 parent 2a73c58 commit 92d8e96

2 files changed

Lines changed: 5 additions & 7 deletions

File tree

spx-backend/internal/controller/asset_completion_llm.go

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -182,10 +182,8 @@ func (l *AssetCompletionLLM) cleanAndFormatSuggestion(line string) string {
182182
return ""
183183
}
184184

185-
// Replace spaces and hyphens with underscores, but keep original case for Chinese
185+
// Keep original formatting for better readability
186186
suggestion := line
187-
suggestion = strings.ReplaceAll(suggestion, " ", "_")
188-
suggestion = strings.ReplaceAll(suggestion, "-", "_")
189187

190188
// Only convert ASCII letters to lowercase, preserve Chinese characters
191189
var normalized strings.Builder
@@ -274,8 +272,8 @@ func isValidAssetNameChar(r rune) bool {
274272
if (r >= 'a' && r <= 'z') || (r >= 'A' && r <= 'Z') || (r >= '0' && r <= '9') {
275273
return true
276274
}
277-
// Underscore
278-
if r == '_' {
275+
// Common punctuation and spaces for better readability
276+
if r == '_' || r == '-' || r == ' ' {
279277
return true
280278
}
281279
// Chinese characters (CJK Unified Ideographs)

spx-backend/internal/controller/asset_completion_llm_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -240,9 +240,9 @@ fighter_attack`,
240240
// Check that we got some results
241241
assert.Greater(t, len(results), 0, "Should get at least one suggestion")
242242

243-
// Check that all results are properly formatted (lowercase, underscores)
243+
// Check that all results are properly formatted (allow spaces, hyphens for readability)
244244
for _, result := range results {
245-
assert.Regexp(t, `^[a-z0-9_]+$`, result, "Result should be lowercase with underscores only")
245+
assert.Regexp(t, `^[a-zA-Z0-9_\- ]+$`, result, "Result should contain only valid characters")
246246
}
247247
})
248248
}

0 commit comments

Comments
 (0)