s-kostyaev / ellama

Ellama is a tool for interacting with large language models from Emacs.
GNU General Public License v3.0
348 stars 25 forks source link

Wrong org formatting + Garbled text #117

Closed liar666 closed 1 month ago

liar666 commented 1 month ago

Hi,

Almost every time I ask-selection, I get both wrong org output & garbled text.

Here is an MVE:

** User:
generate tikz picture with a rectangle in blue

** Ellama:
Here is your TikZ code for a blue rectangle: #+END_SRC \documentclass{article}
\usepackage{tikz} \begin{document}
\begin{tikzpicture} \node[rectangle, draw=blue, fill=blue!20] (mynode) {Text};
\end{tikzpicture}
\end{document}~`~This code will create a rectangle with a blue border and light
blue filling. You can replace 'Text' with your desired text or other TikZ
elements.

As you can see, there are 2 problems:

I'm not sure if you're reformatting the text after/during generation, or if it's an automatic process in my DoomEmacs/Org config, but it results in bad out, that takes more time for me to reformat manually than generating myself, thus rendering the whole usage of ellama pointless.

PS: Not sure if it is related to https://github.com/s-kostyaev/ellama/issues/35 (which is closed, thus supposed to be solved)?

s-kostyaev commented 1 month ago

Hi @liar666 Both problems is a result of code in ellama. Try to use ellama with markdown instead of org:

(setq ellama-major-mode 'markdown-mode)
s-kostyaev commented 1 month ago

I will try to provide more general fix.

s-kostyaev commented 1 month ago

Also which model do you use? Have you tried other models?

liar666 commented 1 month ago

Hi,

Thanks for your very quick answer.

I'm using orionstar/orion14b-q4:latest.

I just discovered ellama-fill-paragraphs. Setting it it nil Seems to solve the main problem of garbled text.

s-kostyaev commented 1 month ago

@liar666 Thank you for bug report. Code blocks translation now should works better.