analyzeSections 分析段落
(prompt string)
| 251 | |
| 252 | // analyzeSections 分析段落 |
| 253 | func (c *EnhancedPromptCompressor) analyzeSections(prompt string) []string { |
| 254 | // 按双换行分割 |
| 255 | sections := strings.Split(prompt, "\n\n") |
| 256 | |
| 257 | // 过滤空段落 |
| 258 | var result []string |
| 259 | for _, s := range sections { |
| 260 | trimmed := strings.TrimSpace(s) |
| 261 | if trimmed != "" { |
| 262 | result = append(result, trimmed) |
| 263 | } |
| 264 | } |
| 265 | |
| 266 | return result |
| 267 | } |
| 268 | |
| 269 | // scoreSections 评分段落 |
| 270 | func (c *EnhancedPromptCompressor) scoreSections(sections []string, preserveSections []string) []ScoredSection { |