In-browser live demo!

This commit is contained in:
2023-11-12 14:57:16 +00:00
parent ba134a8ae2
commit c49fdcdc41
24 changed files with 1191 additions and 10 deletions

View File

@@ -866,6 +866,7 @@ local function download_files(manifest_data, needed_files)
table.insert(fns, function()
add_log("downloading %s", file)
local url = base_URL .. "/" .. file
write "."
local h = assert(http.get(url, nil, true))
local x = h.readAll()
h.close()
@@ -873,6 +874,7 @@ local function download_files(manifest_data, needed_files)
if (manifest_data.sizes and manifest_data.sizes[file] and manifest_data.sizes[file] ~= #x) or manifest_data.files[file] ~= hexsha then
error(("hash mismatch on %s %s (expected %s, got %s)"):format(file, url, manifest_data.files[file], hexsha)) end
fwrite(file, x)
write "."
count = count + 1
end)
end

View File

@@ -2338,6 +2338,7 @@ function potatOS.run_assistant_turn(history, executor)
local prompt = construct_prompt {fixed_context, history, new_history}
local result = potatOS.llm(prompt, 100, {"\n"})
local typ, arg = result:match "^([A-Za-z]*): (.*)$"
ccemux.echo(textutils.serialise(result))
if typ then
local arg = arg:gsub("\n$", "")
if typ == "Action" or typ == "Assistant" then table.insert(new_history, { typ, arg }) end