mirror of
https://github.com/runebookai/tome.git
synced 2025-07-21 00:27:30 +03:00
- 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 ` ` 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.
21 lines
451 B
TypeScript
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,
|
|
},
|
|
})),
|
|
};
|
|
}
|