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
8dac4e91
"tests/data/kitti/vscode:/vscode.git/clone" did not exist on "2dedcc2061909d68c6af901a4ee09e790c5735dc"
Commit
8dac4e91
authored
May 18, 2024
by
Timothy J. Baek
Browse files
fix: share chat issue
parent
1e6ddb2f
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
1 deletion
+17
-1
backend/apps/web/routers/users.py
backend/apps/web/routers/users.py
+12
-0
src/routes/s/[id]/+page.svelte
src/routes/s/[id]/+page.svelte
+5
-1
No files found.
backend/apps/web/routers/users.py
View file @
8dac4e91
...
@@ -11,6 +11,7 @@ import logging
...
@@ -11,6 +11,7 @@ import logging
from
apps.web.models.users
import
UserModel
,
UserUpdateForm
,
UserRoleUpdateForm
,
Users
from
apps.web.models.users
import
UserModel
,
UserUpdateForm
,
UserRoleUpdateForm
,
Users
from
apps.web.models.auths
import
Auths
from
apps.web.models.auths
import
Auths
from
apps.web.models.chats
import
Chats
from
utils.utils
import
get_verified_user
,
get_password_hash
,
get_admin_user
from
utils.utils
import
get_verified_user
,
get_password_hash
,
get_admin_user
from
constants
import
ERROR_MESSAGES
from
constants
import
ERROR_MESSAGES
...
@@ -80,6 +81,17 @@ class UserResponse(BaseModel):
...
@@ -80,6 +81,17 @@ class UserResponse(BaseModel):
@
router
.
get
(
"/{user_id}"
,
response_model
=
UserResponse
)
@
router
.
get
(
"/{user_id}"
,
response_model
=
UserResponse
)
async
def
get_user_by_id
(
user_id
:
str
,
user
=
Depends
(
get_verified_user
)):
async
def
get_user_by_id
(
user_id
:
str
,
user
=
Depends
(
get_verified_user
)):
if
user_id
.
startswith
(
"shared-"
):
chat_id
=
user_id
.
replace
(
"shared-"
,
""
)
chat
=
Chats
.
get_chat_by_id
(
chat_id
)
if
chat
:
user_id
=
chat
.
user_id
else
:
raise
HTTPException
(
status_code
=
status
.
HTTP_400_BAD_REQUEST
,
detail
=
ERROR_MESSAGES
.
USER_NOT_FOUND
,
)
user
=
Users
.
get_user_by_id
(
user_id
)
user
=
Users
.
get_user_by_id
(
user_id
)
if
user
:
if
user
:
...
...
src/routes/s/[id]/+page.svelte
View file @
8dac4e91
...
@@ -13,6 +13,7 @@
...
@@ -13,6 +13,7 @@
import Messages from '$lib/components/chat/Messages.svelte';
import Messages from '$lib/components/chat/Messages.svelte';
import Navbar from '$lib/components/layout/Navbar.svelte';
import Navbar from '$lib/components/layout/Navbar.svelte';
import { getUserById } from '$lib/apis/users';
import { getUserById } from '$lib/apis/users';
import { error } from '@sveltejs/kit';
const i18n = getContext('i18n');
const i18n = getContext('i18n');
...
@@ -90,7 +91,10 @@
...
@@ -90,7 +91,10 @@
});
});
if (chat) {
if (chat) {
user = await getUserById(localStorage.token, chat.user_id);
user = await getUserById(localStorage.token, chat.user_id).catch((error) => {
console.error(error);
return null;
});
const chatContent = chat.chat;
const chatContent = chat.chat;
...
...
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