Fix the last few words not being added

This commit is contained in:
Nexus 2024-01-09 08:56:46 +00:00
parent 85f3ac973c
commit e2143e94e9
2 changed files with 20 additions and 7 deletions

View file

@ -4,7 +4,10 @@
<option name="autoReloadType" value="SELECTIVE" />
</component>
<component name="ChangeListManager">
<list default="true" id="aa6d62a8-d64d-4a60-a85f-8d9fa52b6b49" name="Changes" comment="Set output to TTY because why not" />
<list default="true" id="aa6d62a8-d64d-4a60-a85f-8d9fa52b6b49" name="Changes" comment="Fix the space strip and JSON output">
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/cogs/ollama.py" beforeDir="false" afterPath="$PROJECT_DIR$/src/cogs/ollama.py" afterDir="false" />
</list>
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
@ -77,7 +80,8 @@
<workItem from="1704317484555" duration="1407000" />
<workItem from="1704572901106" duration="125000" />
<workItem from="1704573038888" duration="7749000" />
<workItem from="1704760229948" duration="589000" />
<workItem from="1704760229948" duration="946000" />
<workItem from="1704790508193" duration="66000" />
</task>
<task id="LOCAL-00001" summary="Update gitignore">
<option name="closed" value="true" />
@ -231,7 +235,15 @@
<option name="project" value="LOCAL" />
<updated>1704760592118</updated>
</task>
<option name="localTasksCounter" value="20" />
<task id="LOCAL-00020" summary="Fix the space strip and JSON output">
<option name="closed" value="true" />
<created>1704760944356</created>
<option name="number" value="00020" />
<option name="presentableId" value="LOCAL-00020" />
<option name="project" value="LOCAL" />
<updated>1704760944356</updated>
</task>
<option name="localTasksCounter" value="21" />
<servers />
</component>
<component name="TypeScriptGeneratedFilesManager">
@ -258,6 +270,7 @@
<MESSAGE value="Fix screenshot errors" />
<MESSAGE value="Fix ollama streaming" />
<MESSAGE value="Set output to TTY because why not" />
<option name="LAST_COMMIT_MESSAGE" value="Set output to TTY because why not" />
<MESSAGE value="Fix the space strip and JSON output" />
<option name="LAST_COMMIT_MESSAGE" value="Fix the space strip and JSON output" />
</component>
</project>

View file

@ -244,8 +244,6 @@ class Ollama(commands.Cog):
last_update = time.time()
async for line in self.ollama_stream(response.content):
if not line["response"].strip("\n\r"):
continue
embed.description += line["response"]
embed.timestamp = discord.utils.utcnow()
if len(embed.description) >= 4096:
@ -261,7 +259,9 @@ class Ollama(commands.Cog):
await ctx.edit(embed=embed)
self.log.debug(f"Updating message ({last_update} -> {time.time()})")
last_update = time.time()
embed.title = "Done!"
embed.color = discord.Color.green()
await ctx.edit(embed=embed)
def setup(bot):
bot.add_cog(Ollama(bot))