Files
tome/src/lib/engines/ollama/message.ts
Matte Noble 366f9f5b97 Back to line length of 100 + some svelte/ts settings
- Goes back to a max line length of 100
- Makes whitespace insignificant in Svelte files (see below)
- Avoids parens around single argument closures, in TS, when unncessary

*Whitespace Significance*

In HTML, `<p><b> 1 </b></p>` and `<p><b>1</b></p>` are not the same
thing. In the former, the "1" has spaces around it. If you were to try
to split this into multiple lines...

```html
<p>
    <b>
        1
    </b>
</p>
```

...you would lose that whitespace. The newlines reset any significance
around individual tokens. This meant prettier would format that code
as...

```html
<p>
    <b
    > 1 </b>
</p>
```

...which is insane and hideous.

We're saying all whitespace is insignificant from now on. Meaning
prettier no longer needs to retain it and can format that code as a sane
person.

This means you need to explicitly use `&nbsp;` characters if you
explicitly need whitespace around things. OR put it in a `span` and use
css.

TL;DR: do not rely on whitespace significance in HTML.
2025-05-27 09:29:57 -07:00

21 lines
451 B
TypeScript

import type { Message } from 'ollama';
import type { IMessage } from '$lib/models/message';
export default {
from,
};
export function from(message: IMessage): Message {
return {
role: message.role,
content: message.content,
tool_calls: message.toolCalls?.map(c => ({
function: {
name: c.function.name,
arguments: c.function.arguments,
},
})),
};
}