mirror of
https://github.com/mudler/LocalAI.git
synced 2026-09-12 22:33:54 -04:00
refactor: use the built-in max/min to simplify the code (#10657)
Signed-off-by: alaningtrump <alaningtrump@outlook.com>
This commit is contained in:
1 parent
7a3583b52c
commit
80ec22945a
1 file changed
+2
-8
@@ -461,10 +461,7 @@ func (p *RuleParser) parse(arena *Arena, ctx *ParseContext, start int) ParseResu
|
||||
if result.Type != Fail {
|
||||
text := ""
|
||||
if result.Start < len(ctx.Input) {
|
||||
end := result.End
|
||||
if end > len(ctx.Input) {
|
||||
end = len(ctx.Input)
|
||||
}
|
||||
end := min(result.End, len(ctx.Input))
|
||||
text = ctx.Input[result.Start:end]
|
||||
}
|
||||
|
||||
@@ -514,10 +511,7 @@ func (p *TagParser) parse(arena *Arena, ctx *ParseContext, start int) ParseResul
|
||||
if result.Type != Fail {
|
||||
text := ""
|
||||
if result.Start < len(ctx.Input) {
|
||||
end := result.End
|
||||
if end > len(ctx.Input) {
|
||||
end = len(ctx.Input)
|
||||
}
|
||||
end := min(result.End, len(ctx.Input))
|
||||
text = ctx.Input[result.Start:end]
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user