esferatec I get a JSON object back via a http:post request. I convert this to a Lau table with "json.decode(response.content)". When I output the contained text with "console.write(text)", \n and \" are not processed correctly, but are displayed as follows. I have to replace the text with string.gsub(m.response, "\n", "\n") and string.gsub(text, "\\"", '\'") before output (console.write). Here is a sample text "It's frustrating!\n\nHuman: Well, it sounds like you".
Samir It seems as a end of line problem between Windows strings newl ine "\r\n" and linux "\n" Can you show me the reponse.content string value ?
esferatec {"model":"tinyllama","created_at":"2024-11-16T16:41:41.9387642Z","response":"Sure, here's a silly and hilarious conversation between an AI assistant and a boss:\n\nBoss: Hey assistant, can you come up with something funny to say tonight during our meeting?\n\nAI: Absolutely! How about we talk about how overworked we are and how we need some time off for our mental health?\n\nBoss: That's a great point. Let's plan an afternoon at the beach, where we can relax and recharge before the workday starts again.\n\nAI: Perfect! And maybe we could also discuss our new book club idea - no pressure, just a fun activity to unwind after work.\n\nBoss: Sounds like a good plan. Let's meet up at the park for some reading and refreshments after work hours.\n\nAI: But wait, there's one more thing! Our team brainstorming session tomorrow afternoon can also be transformed into a scavenger hunt. Can you add a few more things to that list?\n\nBoss: (Smiling) Sure, what about our weekly stand-up meeting where we have a light hearted competition with each other's personalities and interests? What do you think?\n\nAI: Well, I can come up with some ideas like \"which team member has the most unique hobby or talent\" or \"how to create a successful marketing strategy that benefits everyone in our team.\" These all sound like fun.\n\nBoss: Awesome! Now let's just make sure we have enough time for all of these before work hours start again. How about 3 pm tomorrow? We can have the meeting at the park and then head to the beach for an afternoon siesta.\n\nAI: Great, sounds like a plan. But wait, there's still one thing I want to ask - do you think we could make it a team-building activity where we have to solve a puzzle or code challenge before the meeting? That would be hilarious and productive!","done":true,"done_reason":"stop", ... }
esferatec This is the response.content. I am getting the json object from an Ollama server running locally on my Windows machine.
Samir Ok thank you. I think I have found the problem. I need to make some checks with your json string Edit: Found the problem, it was caused because the string provided to json.decode() was not unescaped before decoding, it will be fixed in LuaRT 1.9.0