mirror of
https://github.com/0xJacky/nginx-ui.git
synced 2025-05-11 02:15:48 +02:00
feat(wip): code completion with llm
This commit is contained in:
parent
63fb823344
commit
a57748a432
22 changed files with 623 additions and 31 deletions
23
internal/llm/context_test.go
Normal file
23
internal/llm/context_test.go
Normal file
|
@ -0,0 +1,23 @@
|
|||
package llm
|
||||
|
||||
import (
|
||||
"github.com/stretchr/testify/assert"
|
||||
"regexp"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestRegex(t *testing.T) {
|
||||
content := `
|
||||
server {
|
||||
listen 80;
|
||||
listen [::]:80;
|
||||
server_name _;
|
||||
include error_json;
|
||||
}
|
||||
`
|
||||
pattern := regexp.MustCompile(`(?m)^\s*include\s+([^;]+);`)
|
||||
matches := pattern.FindAllStringSubmatch(content, -1)
|
||||
|
||||
assert.Equal(t, 1, len(matches))
|
||||
assert.Equal(t, "error_json", matches[0][1])
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue