Skip to content

Commit ea04595

Browse files
authored
Merge branch 'main' into add_tip_top
2 parents 13c68bd + 68702bf commit ea04595

File tree

18 files changed

+183
-70
lines changed

18 files changed

+183
-70
lines changed

.env.template

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,4 +66,4 @@ ANTHROPIC_API_VERSION=
6666
ANTHROPIC_URL=
6767

6868
### (optional)
69-
WHITE_WEBDEV_ENDPOINTS=
69+
WHITE_WEBDAV_ENDPOINTS=

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -340,7 +340,7 @@ For ByteDance: use `modelName@bytedance=deploymentName` to customize model name
340340

341341
Change default model
342342

343-
### `WHITE_WEBDEV_ENDPOINTS` (optional)
343+
### `WHITE_WEBDAV_ENDPOINTS` (optional)
344344

345345
You can use this option if you want to increase the number of webdav service addresses you are allowed to access, as required by the format:
346346
- Each address must be a complete endpoint

README_CN.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ ByteDance Api Url.
202202

203203
如果你想禁用从链接解析预制设置,将此环境变量设置为 1 即可。
204204

205-
### `WHITE_WEBDEV_ENDPOINTS` (可选)
205+
### `WHITE_WEBDAV_ENDPOINTS` (可选)
206206

207207
如果你想增加允许访问的webdav服务地址,可以使用该选项,格式要求:
208208
- 每一个地址必须是一个完整的 endpoint

README_JA.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ ByteDance API の URL。
193193

194194
リンクからのプリセット設定解析を無効にしたい場合は、この環境変数を 1 に設定します。
195195

196-
### `WHITE_WEBDEV_ENDPOINTS` (オプション)
196+
### `WHITE_WEBDAV_ENDPOINTS` (オプション)
197197

198198
アクセス許可を与える WebDAV サービスのアドレスを追加したい場合、このオプションを使用します。フォーマット要件:
199199
- 各アドレスは完全なエンドポイントでなければなりません。

app/api/webdav/[...path]/route.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ const config = getServerSideConfig();
66

77
const mergedAllowedWebDavEndpoints = [
88
...internalAllowedWebDavEndpoints,
9-
...config.allowedWebDevEndpoints,
9+
...config.allowedWebDavEndpoints,
1010
].filter((domain) => Boolean(domain.trim()));
1111

1212
const normalizeUrl = (url: string) => {

app/client/platforms/openai.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -277,6 +277,7 @@ export class ChatGPTApi implements LLMApi {
277277
);
278278
}
279279
if (shouldStream) {
280+
let index = -1;
280281
const [tools, funcs] = usePluginStore
281282
.getState()
282283
.getAsTools(
@@ -302,10 +303,10 @@ export class ChatGPTApi implements LLMApi {
302303
}>;
303304
const tool_calls = choices[0]?.delta?.tool_calls;
304305
if (tool_calls?.length > 0) {
305-
const index = tool_calls[0]?.index;
306306
const id = tool_calls[0]?.id;
307307
const args = tool_calls[0]?.function?.arguments;
308308
if (id) {
309+
index += 1;
309310
runTools.push({
310311
id,
311312
type: tool_calls[0]?.type,
@@ -327,6 +328,8 @@ export class ChatGPTApi implements LLMApi {
327328
toolCallMessage: any,
328329
toolCallResult: any[],
329330
) => {
331+
// reset index value
332+
index = -1;
330333
// @ts-ignore
331334
requestPayload?.messages?.splice(
332335
// @ts-ignore

app/components/markdown.tsx

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@ import {
2121
} from "./artifacts";
2222
import { useChatStore } from "../store";
2323
import { IconButton } from "./button";
24+
25+
import { useAppConfig } from "../store/config";
26+
2427
export function Mermaid(props: { code: string }) {
2528
const ref = useRef<HTMLDivElement>(null);
2629
const [hasError, setHasError] = useState(false);
@@ -91,7 +94,9 @@ export function PreCode(props: { children: any }) {
9194
}
9295
}, 600);
9396

94-
const enableArtifacts = session.mask?.enableArtifacts !== false;
97+
const config = useAppConfig();
98+
const enableArtifacts =
99+
session.mask?.enableArtifacts !== false && config.enableArtifacts;
95100

96101
//Wrap the paragraph for plain-text
97102
useEffect(() => {
@@ -127,8 +132,9 @@ export function PreCode(props: { children: any }) {
127132
className="copy-code-button"
128133
onClick={() => {
129134
if (ref.current) {
130-
const code = ref.current.innerText;
131-
copyToClipboard(code);
135+
copyToClipboard(
136+
ref.current.querySelector("code")?.innerText ?? "",
137+
);
132138
}
133139
}}
134140
></span>
@@ -277,6 +283,20 @@ function _MarkDownContent(props: { content: string }) {
277283
p: (pProps) => <p {...pProps} dir="auto" />,
278284
a: (aProps) => {
279285
const href = aProps.href || "";
286+
if (/\.(aac|mp3|opus|wav)$/.test(href)) {
287+
return (
288+
<figure>
289+
<audio controls src={href}></audio>
290+
</figure>
291+
);
292+
}
293+
if (/\.(3gp|3g2|webm|ogv|mpeg|mp4|avi)$/.test(href)) {
294+
return (
295+
<video controls width="99.9%">
296+
<source src={href} />
297+
</video>
298+
);
299+
}
280300
const isInternal = /^\/#/i.test(href);
281301
const target = isInternal ? "_self" : aProps.target ?? "_blank";
282302
return <a {...aProps} target={target} />;

app/components/mask.tsx

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -166,21 +166,23 @@ export function MaskConfig(props: {
166166
></input>
167167
</ListItem>
168168

169-
<ListItem
170-
title={Locale.Mask.Config.Artifacts.Title}
171-
subTitle={Locale.Mask.Config.Artifacts.SubTitle}
172-
>
173-
<input
174-
aria-label={Locale.Mask.Config.Artifacts.Title}
175-
type="checkbox"
176-
checked={props.mask.enableArtifacts !== false}
177-
onChange={(e) => {
178-
props.updateMask((mask) => {
179-
mask.enableArtifacts = e.currentTarget.checked;
180-
});
181-
}}
182-
></input>
183-
</ListItem>
169+
{globalConfig.enableArtifacts && (
170+
<ListItem
171+
title={Locale.Mask.Config.Artifacts.Title}
172+
subTitle={Locale.Mask.Config.Artifacts.SubTitle}
173+
>
174+
<input
175+
aria-label={Locale.Mask.Config.Artifacts.Title}
176+
type="checkbox"
177+
checked={props.mask.enableArtifacts !== false}
178+
onChange={(e) => {
179+
props.updateMask((mask) => {
180+
mask.enableArtifacts = e.currentTarget.checked;
181+
});
182+
}}
183+
></input>
184+
</ListItem>
185+
)}
184186

185187
{!props.shouldSyncFromGlobal ? (
186188
<ListItem

app/components/plugin.module.scss

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,29 @@
1010
max-height: 240px;
1111
overflow-y: auto;
1212
white-space: pre-wrap;
13-
min-width: 300px;
13+
min-width: 280px;
1414
}
1515
}
1616

17+
.plugin-schema {
18+
display: flex;
19+
justify-content: flex-end;
20+
flex-direction: row;
21+
22+
input {
23+
margin-right: 20px;
24+
25+
@media screen and (max-width: 600px) {
26+
margin-right: 0px;
27+
}
28+
}
29+
30+
@media screen and (max-width: 600px) {
31+
flex-direction: column;
32+
gap: 5px;
33+
34+
button {
35+
padding: 10px;
36+
}
37+
}
38+
}

app/components/plugin.tsx

Lines changed: 7 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ import EditIcon from "../icons/edit.svg";
1212
import AddIcon from "../icons/add.svg";
1313
import CloseIcon from "../icons/close.svg";
1414
import DeleteIcon from "../icons/delete.svg";
15-
import EyeIcon from "../icons/eye.svg";
1615
import ConfirmIcon from "../icons/confirm.svg";
1716
import ReloadIcon from "../icons/reload.svg";
1817
import GithubIcon from "../icons/github.svg";
@@ -29,7 +28,6 @@ import {
2928
import Locale from "../locales";
3029
import { useNavigate } from "react-router-dom";
3130
import { useState } from "react";
32-
import { getClientConfig } from "../config/client";
3331

3432
export function PluginPage() {
3533
const navigate = useNavigate();
@@ -209,19 +207,11 @@ export function PluginPage() {
209207
</div>
210208
</div>
211209
<div className={styles["mask-actions"]}>
212-
{m.builtin ? (
213-
<IconButton
214-
icon={<EyeIcon />}
215-
text={Locale.Plugin.Item.View}
216-
onClick={() => setEditingPluginId(m.id)}
217-
/>
218-
) : (
219-
<IconButton
220-
icon={<EditIcon />}
221-
text={Locale.Plugin.Item.Edit}
222-
onClick={() => setEditingPluginId(m.id)}
223-
/>
224-
)}
210+
<IconButton
211+
icon={<EditIcon />}
212+
text={Locale.Plugin.Item.Edit}
213+
onClick={() => setEditingPluginId(m.id)}
214+
/>
225215
{!m.builtin && (
226216
<IconButton
227217
icon={<DeleteIcon />}
@@ -325,30 +315,13 @@ export function PluginPage() {
325315
></PasswordInput>
326316
</ListItem>
327317
)}
328-
{!getClientConfig()?.isApp && (
329-
<ListItem
330-
title={Locale.Plugin.Auth.Proxy}
331-
subTitle={Locale.Plugin.Auth.ProxyDescription}
332-
>
333-
<input
334-
type="checkbox"
335-
checked={editingPlugin?.usingProxy}
336-
style={{ minWidth: 16 }}
337-
onChange={(e) => {
338-
pluginStore.updatePlugin(editingPlugin.id, (plugin) => {
339-
plugin.usingProxy = e.currentTarget.checked;
340-
});
341-
}}
342-
></input>
343-
</ListItem>
344-
)}
345318
</List>
346319
<List>
347320
<ListItem title={Locale.Plugin.EditModal.Content}>
348-
<div style={{ display: "flex", justifyContent: "flex-end" }}>
321+
<div className={pluginStyles["plugin-schema"]}>
349322
<input
350323
type="text"
351-
style={{ minWidth: 200, marginRight: 20 }}
324+
style={{ minWidth: 200 }}
352325
onInput={(e) => setLoadUrl(e.currentTarget.value)}
353326
></input>
354327
<IconButton

0 commit comments

Comments
 (0)