Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
chenpangpang
open-webui
Commits
4ec81a89
Commit
4ec81a89
authored
Jan 17, 2024
by
Timothy J. Baek
Browse files
feat: message ts display
parent
59724ea9
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
22 additions
and
7 deletions
+22
-7
src/lib/components/chat/Messages/Name.svelte
src/lib/components/chat/Messages/Name.svelte
+1
-1
src/lib/components/chat/Messages/ResponseMessage.svelte
src/lib/components/chat/Messages/ResponseMessage.svelte
+7
-0
src/lib/components/chat/Messages/UserMessage.svelte
src/lib/components/chat/Messages/UserMessage.svelte
+8
-0
src/routes/(app)/+page.svelte
src/routes/(app)/+page.svelte
+3
-3
src/routes/(app)/c/[id]/+page.svelte
src/routes/(app)/c/[id]/+page.svelte
+3
-3
No files found.
src/lib/components/chat/Messages/Name.svelte
View file @
4ec81a89
<div class=" self-center font-bold mb-0.5 capitalize">
<div class=" self-center font-bold mb-0.5 capitalize
line-clamp-1
">
<slot />
<slot />
</div>
</div>
src/lib/components/chat/Messages/ResponseMessage.svelte
View file @
4ec81a89
<script
lang=
"ts"
>
<script
lang=
"ts"
>
import
dayjs
from
'
dayjs
'
;
import
{
marked
}
from
'
marked
'
;
import
{
marked
}
from
'
marked
'
;
import
tippy
from
'
tippy.js
'
;
import
tippy
from
'
tippy.js
'
;
...
@@ -219,6 +220,12 @@
...
@@ -219,6 +220,12 @@
>
{message.model ? ` ${message.model}` : ''}
</span
>
{message.model ? ` ${message.model}` : ''}
</span
>
>
{/if}
{/if}
{#if message.timestamp}
<span
class=
" invisible group-hover:visible text-gray-400 text-xs font-normal"
>
{dayjs(message.timestamp * 1000).format('DD/MM/YYYY HH:MM')}
</span>
{/if}
</Name>
</Name>
{#if message.content === ''}
{#if message.content === ''}
...
...
src/lib/components/chat/Messages/UserMessage.svelte
View file @
4ec81a89
<script lang="ts">
<script lang="ts">
import dayjs from 'dayjs';
import { tick } from 'svelte';
import { tick } from 'svelte';
import Name from './Name.svelte';
import Name from './Name.svelte';
import ProfileImage from './ProfileImage.svelte';
import ProfileImage from './ProfileImage.svelte';
...
@@ -61,6 +63,12 @@
...
@@ -61,6 +63,12 @@
{:else}
{:else}
You
You
{/if}
{/if}
{#if message.timestamp}
<span class=" invisible group-hover:visible text-gray-400 text-xs font-normal">
{dayjs(message.timestamp * 1000).format('DD/MM/YYYY HH:MM')}
</span>
{/if}
</Name>
</Name>
</div>
</div>
...
...
src/routes/(app)/+page.svelte
View file @
4ec81a89
...
@@ -146,7 +146,7 @@
...
@@ -146,7 +146,7 @@
user: _user ?? undefined,
user: _user ?? undefined,
content: userPrompt,
content: userPrompt,
files: files.length > 0 ? files : undefined,
files: files.length > 0 ? files : undefined,
timestamp:
Date.now()
timestamp:
Math.floor(Date.now() / 1000) // Unix epoch
};
};
// Add message to history and Set currentId to messageId
// Add message to history and Set currentId to messageId
...
@@ -258,7 +258,7 @@
...
@@ -258,7 +258,7 @@
role: 'assistant',
role: 'assistant',
content: '',
content: '',
model: model,
model: model,
timestamp:
Date.now()
timestamp:
Math.floor(Date.now() / 1000) // Unix epoch
};
};
// Add message to history and Set currentId to messageId
// Add message to history and Set currentId to messageId
...
@@ -449,7 +449,7 @@
...
@@ -449,7 +449,7 @@
role: 'assistant',
role: 'assistant',
content: '',
content: '',
model: model,
model: model,
timestamp:
Date.now()
timestamp:
Math.floor(Date.now() / 1000) // Unix epoch
};
};
history.messages[responseMessageId] = responseMessage;
history.messages[responseMessageId] = responseMessage;
...
...
src/routes/(app)/c/[id]/+page.svelte
View file @
4ec81a89
...
@@ -165,7 +165,7 @@
...
@@ -165,7 +165,7 @@
user: _user ?? undefined,
user: _user ?? undefined,
content: userPrompt,
content: userPrompt,
files: files.length > 0 ? files : undefined,
files: files.length > 0 ? files : undefined,
timestamp:
Date.now()
timestamp:
Math.floor(Date.now() / 1000) // Unix epoch
};
};
// Add message to history and Set currentId to messageId
// Add message to history and Set currentId to messageId
...
@@ -276,7 +276,7 @@
...
@@ -276,7 +276,7 @@
role: 'assistant',
role: 'assistant',
content: '',
content: '',
model: model,
model: model,
timestamp:
Date.now()
timestamp:
Math.floor(Date.now() / 1000) // Unix epoch
};
};
// Add message to history and Set currentId to messageId
// Add message to history and Set currentId to messageId
...
@@ -467,7 +467,7 @@
...
@@ -467,7 +467,7 @@
role: 'assistant',
role: 'assistant',
content: '',
content: '',
model: model,
model: model,
timestamp:
Date.now()
timestamp:
Math.floor(Date.now() / 1000) // Unix epoch
};
};
history.messages[responseMessageId] = responseMessage;
history.messages[responseMessageId] = responseMessage;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment