θΏ™ζ˜―indexlocζδΎ›ηš„ζœεŠ‘οΌŒδΈθ¦θΎ“ε…₯任何密码
Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion frontend/public/embed/anythingllm-chat-widget.min.css

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions frontend/public/embed/anythingllm-chat-widget.min.js

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ https://github.com/Mintplex-Labs/anything-llm/tree/master/embed/README.md
<script
data-embed-id="${embed.uuid}"
data-base-api-url="${serverHost}/api/embed"
data-show-thoughts="${embed?.show_thoughts || false}"
src="${scriptHost}/embed/anythingllm-chat-widget.min.js">
</script>
<!-- AnythingLLM (https://anythingllm.com) -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,12 @@ export default function EditEmbedModal({ embed, closeModal }) {
hint="Allow setting of the system prompt to override the workspace default."
defaultValue={embed.allow_prompt_override}
/>
<BooleanInput
name="show_thoughts"
title="Show AI Thoughts"
hint="Allow users to see the AI's thought process in responses. If disabled, users will only see the thinking state."
defaultValue={embed.show_thoughts}
/>

{error && <p className="text-red-400 text-sm">Error: {error}</p>}
<p className="text-white text-opacity-60 text-xs md:text-sm">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,16 @@ export function enforceSubmissionSchema(form) {
}

// Always set value on nullable keys since empty or off will not send anything from form element.
if (!data.hasOwnProperty("allowlist_domains")) data.allowlist_domains = null;
if (!data.hasOwnProperty("allow_model_override"))
if (!Object.prototype.hasOwnProperty.call(data, "allowlist_domains"))
data.allowlist_domains = null;
if (!Object.prototype.hasOwnProperty.call(data, "allow_model_override"))
data.allow_model_override = false;
if (!data.hasOwnProperty("allow_temperature_override"))
if (!Object.prototype.hasOwnProperty.call(data, "allow_temperature_override"))
data.allow_temperature_override = false;
if (!data.hasOwnProperty("allow_prompt_override"))
if (!Object.prototype.hasOwnProperty.call(data, "allow_prompt_override"))
data.allow_prompt_override = false;
if (!Object.prototype.hasOwnProperty.call(data, "show_thoughts"))
data.show_thoughts = false;
return data;
}

Expand Down Expand Up @@ -84,6 +87,12 @@ export default function NewEmbedModal({ closeModal }) {
title="Enable Prompt Override"
hint="Allow setting of the system prompt to override the workspace default."
/>
<BooleanInput
name="show_thoughts"
title="Show AI Thoughts"
hint="Allow users to see the AI's thought process in responses. If disabled, users will only see the thinking state. Re-copy the embed code after changing this option."
defaultValue={true}
/>

{error && <p className="text-red-400 text-sm">Error: {error}</p>}
<p className="text-white text-opacity-60 text-xs md:text-sm">
Expand Down Expand Up @@ -150,6 +159,7 @@ export const WorkspaceSelection = ({ defaultValue = null }) => {
{workspaces.map((workspace) => {
return (
<option
key={workspace.id}
selected={defaultValue === workspace.id}
value={workspace.id}
>
Expand Down
6 changes: 6 additions & 0 deletions server/models/embedConfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ const EmbedConfig = {
"allow_model_override",
"allow_temperature_override",
"allow_prompt_override",
"show_thoughts",
"max_chats_per_day",
"max_chats_per_session",
"chat_mode",
Expand Down Expand Up @@ -39,6 +40,10 @@ const EmbedConfig = {
data?.allow_prompt_override,
"allow_prompt_override"
),
show_thoughts: validatedCreationData(
data?.show_thoughts,
"show_thoughts"
),
max_chats_per_day: validatedCreationData(
data?.max_chats_per_day,
"max_chats_per_day"
Expand Down Expand Up @@ -183,6 +188,7 @@ const BOOLEAN_KEYS = [
"allow_model_override",
"allow_temperature_override",
"allow_prompt_override",
"show_thoughts",
"enabled",
];

Expand Down
2 changes: 2 additions & 0 deletions server/prisma/migrations/20250404224329_init/migration.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
-- AlterTable
ALTER TABLE "embed_configs" ADD COLUMN "show_thoughts" BOOLEAN DEFAULT true;
1 change: 1 addition & 0 deletions server/prisma/schema.prisma
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,7 @@ model embed_configs {
allow_model_override Boolean @default(false)
allow_temperature_override Boolean @default(false)
allow_prompt_override Boolean @default(false)
show_thoughts Boolean? @default(true)
max_chats_per_day Int?
max_chats_per_session Int?
workspace_id Int
Expand Down