这是indexloc提供的服务,不要输入任何密码
Skip to content

Conversation

@shatfield4
Copy link
Collaborator

@shatfield4 shatfield4 commented Aug 15, 2023

connect #165

New table created to store custom welcome messages and renders custom messages if they are set in appearance settings. If they are not set in appearance settings, it displays the default AnythingLLM welcome messages.

@shatfield4 shatfield4 linked an issue Aug 15, 2023 that may be closed by this pull request
@shatfield4 shatfield4 marked this pull request as ready for review August 16, 2023 19:32
@timothycarambat timothycarambat self-assigned this Aug 16, 2023
method: "POST",
headers: {
...baseHeaders(),
"Content-Type": "application/json",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need to specify the application/json here? All other calls are working without this?

Comment on lines 228 to 232
.then((res) => {
if (!res.ok) {
throw new Error(res.statusText || "Error setting welcome messages.");
}
return { success: true, ...res.json() };
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if success is a tag that should exist, return it from the response then. Can then just simplify this to

.then((res) => {
  if(!res.ok) throw....
  return res.json()
}

Comment on lines 206 to 211
return fetch(`${API_BASE}/system/set-welcome-messages`, {
method: "POST",
headers: {
"Content-Type": "application/json",
},
body: JSON.stringify({ messages }),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

setting welcome message, even in single user mode should add base headers because without that - even on a password protected instance anyone could update the messages if they knew the endpoint

Comment on lines 503 to 507
if (!request.body || !Array.isArray(request.body.messages)) {
return response.status(400).json({
message: "Invalid message format. Expected an array of messages.",
});
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh this is why you are specifying the content-type in the POST.

Just use reqBody function - can then restructure the intended result automatically.
const { messages = [] } = reqBody(request);

@@ -0,0 +1,89 @@
const WelcomeMessages = {
tablename: "welcome_messages",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good to use plural for tables

};

const handleBackNavigation = () => {
window.location.href = "/";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

window.location = paths.home()

@timothycarambat timothycarambat merged commit 31fbb07 into master Aug 17, 2023
@timothycarambat timothycarambat deleted the 165-default-messages-appearance branch August 17, 2023 00:30
cabwds pushed a commit to cabwds/anything-llm that referenced this pull request Jul 3, 2025
Mintplex-Labs#193)

* added ui for custom welcome messages and added label for custom logo in admin settings

* linting

* fixing img to use light/dark modes

* converted ChatBubble into component

* implemented backend for welcome messages and admin appearance page

* completed custom welcome messages for admin

* finished custom messages for single user mode

* merged with master and linted

* improved UI for appearance settings pages

* linted and merged with master

* small updates

---------

Co-authored-by: timothycarambat <rambat1010@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Appearance Settings Page

3 participants