Skip to content

Commit

Permalink
Revert "fix dump hooks"
Browse files Browse the repository at this point in the history
This reverts commit ee59d47.
  • Loading branch information
monofuel committed Apr 21, 2024
1 parent ee59d47 commit fe18962
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 25 deletions.
2 changes: 1 addition & 1 deletion src/llama_leap.nim
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ proc dumpHook(v: var ShowModel, fieldName: var string) =
fieldName = "template"


proc dumpHook*(s: var string, v: object) =
proc dumpHook(s: var string, v: object) =
## jsony `hack` to skip optional fields that are nil
s.add '{'
var i = 0
Expand Down
25 changes: 1 addition & 24 deletions tests/test_llama_leap.nim
Original file line number Diff line number Diff line change
Expand Up @@ -3,31 +3,8 @@

import llama_leap, jsony, std/[unittest, json, options, strutils]

proc dumpHook*(s: var string, v: object) =
## jsony `hack` to skip optional fields that are nil
s.add '{'
var i = 0
# Normal objects.
for k, e in v.fieldPairs:
when compiles(e.isSome):
if e.isSome:
if i > 0:
s.add ','
s.dumpHook(k)
s.add ':'
s.dumpHook(e)
inc i
else:
if i > 0:
s.add ','
s.dumpHook(k)
s.add ':'
s.dumpHook(e)
inc i
s.add '}'

const
TestModel = "llama3"
TestModel = "llama2"
TestModelfileName = "test-pirate-llama2"

suite "llama_leap":
Expand Down

0 comments on commit fe18962

Please sign in to comment.