not sure when I added this

This commit is contained in:
2026-07-13 05:17:51 -06:00
parent 83edc35af9
commit fe19c8ccfb
+50 -2
View File
@@ -206,15 +206,20 @@ end
os.execute("mkdir -p PRIVATE_DATA/synopses")
if arg[1] == "refresh_file_list" then
print("Refresing file list...")
refresh_file_list()
end
if arg[1] == "repair_synopsis_exports" then
utility.list("PRIVATE_DATA/synopses", function(path_name)
local path = "PRIVATE_DATA/synopses"
utility.list(path, function(path_name)
path_name = path .. utility.path_separator .. path_name
if path_name:find("%.json") then
local object = json.decode(read_all(path_name))
if type(object.scoring) == "table" then return end -- don't fuck with working pieces
local decoded = json.decode(strip_markdown_codeblock(object.scoring))
if decoded then
object.scoring = decoded
@@ -222,6 +227,50 @@ if arg[1] == "repair_synopsis_exports" then
end
end
end)
os.exit(0)
end
if arg[1] == "export_ordered_list_of_prompts" then
local path = "PRIVATE_DATA/synopses"
local items = {}
local item_order = {}
utility.list(path, function(path_name)
local full_path = path .. utility.path_separator .. path_name
if path_name:find("%.json") then
local object = json.decode(read_all(full_path))
items[path_name] = object
if type(object.scoring) == "table" then
local s = object.scoring
local total_score = s.conflict_potential + s.emotional_potential + s.character_potential + s.worldbuilding_potential + s.expansion_potential + s.overall_promise + s.memorability + s.originality + s.curiosity + s.hook
item_order[#item_order + 1] = { path_name = path_name, total_score = total_score, }
end
end
end)
table.sort(item_order, function(A,B) return A.total_score > B.total_score end)
-- for k,v in pairs(item_order) do print(v.path_name,v.total_score) end
local output = {
"---",
"title: Ordered Synopses",
"author: [\"Gemma4:12b-mlx\", \"Tangent\", \"Ollama\"]",
"publisher: Tangent",
"---",
"",
}
for _, v in pairs(item_order) do
local item = items[v.path_name]
local text = item.synopsis
local tab = text:split("\n")
for index, line in ipairs(tab) do
if line:sub(1, 1) == "#" then
tab[index] = "#" .. tab[index]
end
end
-- output[#output + 1] = "# " .. v.path_name .. " (" .. v.total_score .. ")\n\n" .. item.synopsis .. "\n"
output[#output + 1] = "# " .. v.path_name .. " (" .. v.total_score .. ")\n\n" .. table.concat(tab, "\n") .. "\n"
output[#output + 1] = "## Scoring\n\n```json\n" .. json.encode(item.scoring, { indent = true, }) .. "\n```\n"
end
write_all("PRIVATE_DATA/Ordered Synopses.md", table.concat(output, "\n"))
os.exit(0)
end
print(#files .. " files to select from.")
@@ -230,7 +279,6 @@ if #files == 0 then
os.exit(1)
end
os.execute("mkdir -p PRIVATE_DATA/synopses")
while true do
print("Selecting a file...")
local file_name = files[math.random(1, #files)]