Change Content to seq[bytes] in bindings

This commit is contained in:
Jazz Turner-Baggs 2026-02-04 07:42:51 -08:00
parent c0dc3353f3
commit b7ed94e1f3
No known key found for this signature in database

View File

@ -1,8 +1,18 @@
import options
import results
import std/strutils
import ../src/libchat
## Convert a string to seq[byte]
proc encode*(s: string): seq[byte] =
if s.len == 0:
return @[]
result = newSeq[byte](s.len)
copyMem(addr result[0], unsafeAddr s[0], s.len)
proc pingpong() =
var raya = newConversationsContext()
@ -13,7 +23,7 @@ proc pingpong() =
let intro = raya.createIntroductionBundle().expect("[Raya] Couldn't create intro bundle")
echo "Raya's Intro Bundle: ",intro
var (convo_sr, payloads) = saro.createNewPrivateConvo(intro, "Hey Raya").expect("[Saro] Couldn't create convo")
var (convo_sr, payloads) = saro.createNewPrivateConvo(intro, encode("Hey Raya")).expect("[Saro] Couldn't create convo")
echo "ConvoId:: ", convo_sr
echo "Payload:: ", payloads