Sha256: 50862904dde46082d0999d82818a1b63dfee481eb044e4e7a1d3a02a01ee9e62
Contents?: true
Size: 1.49 KB
Versions: 2
Compression:
Stored size: 1.49 KB
Contents
class SlackSmartBot module Commands module General module AI module OpenAI def open_ai_chat_get_prompts(session_name) save_stats(__method__) user = Thread.current[:user].dup team_id_user = Thread.current[:team_id_user] @active_chat_gpt_sessions[team_id_user] ||= {} get_openai_sessions(session_name) if @open_ai[team_id_user][:chat_gpt][:sessions].key?(session_name) prompts = @ai_gpt[team_id_user][session_name].join("\n") prompts.gsub!(/^Me>\s*/, "\nMe> ") prompts.gsub!(/^chatGPT>\s*/, "\nchatGPT> ") if prompts.length > 3000 respond "*ChatGPT*: Session *#{session_name}*." send_file(Thread.current[:dest], "ChatGPT prompts for #{session_name}", "prompts.txt", "prompts", "text/plain", "text", content: prompts) elsif prompts.empty? respond "*ChatGPT*: Session *#{session_name}* has no prompts." else respond "*ChatGPT*: Session *#{session_name}*." if prompts.include?("`") respond prompts else respond "```#{prompts}```" end end else respond "*ChatGPT*: You don't have a session with that name.\nCall `chatGPT list sessions` to see your saved sessions." end end end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems