Skip to content

Commit 3c27ac8

Browse files
authored
Merge pull request #7641 from sagemathinc/npm-antd-5.18.3
update antd
2 parents 4a4a498 + 1bc317f commit 3c27ac8

File tree

21 files changed

+447
-446
lines changed

21 files changed

+447
-446
lines changed

src/packages/frontend/account/other-settings.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -409,7 +409,7 @@ export function OtherSettings(props: Readonly<Props>): JSX.Element {
409409
<Panel
410410
header={
411411
<>
412-
<AIAvatar size={22} /> AI Settings
412+
<AIAvatar size={18} /> AI Settings
413413
</>
414414
}
415415
>

src/packages/frontend/admin/page.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,8 +89,8 @@ export function AdminPage() {
8989
key: "llm-testing",
9090
label: (
9191
<div style={headerStyle}>
92-
<AIAvatar size={16} style={{ marginRight: "8px", top: "-5px" }} />{" "}
93-
Test LLM Integration
92+
<AIAvatar size={16} style={{ marginRight: "8px" }} /> Test LLM
93+
Integration
9494
</div>
9595
),
9696
children: <TestLLMAdmin />,

src/packages/frontend/chat/llm-msg-regenerate.tsx

Lines changed: 27 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66
import type { MenuProps } from "antd";
77
import { Button, Dropdown, Space, Tooltip } from "antd";
8+
import { isEmpty } from "lodash";
89

910
import { CSS, redux, useTypedRedux } from "@cocalc/frontend/app-framework";
1011
import { Icon, Text } from "@cocalc/frontend/components";
@@ -13,16 +14,18 @@ import {
1314
LLMModelPrice,
1415
modelToName,
1516
} from "@cocalc/frontend/frame-editors/llm/llm-selector";
17+
import { useUserDefinedLLM } from "@cocalc/frontend/frame-editors/llm/use-userdefined-llm";
1618
import { useProjectContext } from "@cocalc/frontend/project/context";
1719
import {
18-
LanguageModelCore,
1920
LanguageModel,
21+
LanguageModelCore,
2022
USER_SELECTABLE_LLMS_BY_VENDOR,
23+
isCustomOpenAI,
2124
isLanguageModel,
2225
isOllamaLLM,
23-
toOllamaModel,
24-
isCustomOpenAI,
2526
toCustomOpenAIModel,
27+
toOllamaModel,
28+
toUserLLMModelName,
2629
} from "@cocalc/util/db-schema/llm-utils";
2730
import { COLORS } from "@cocalc/util/theme";
2831
import { CustomLLMPublic } from "@cocalc/util/types/llm";
@@ -45,6 +48,7 @@ export function RegenerateLLM({
4548
const selectableLLMs = useTypedRedux("customize", "selectable_llms");
4649
const ollama = useTypedRedux("customize", "ollama");
4750
const custom_openai = useTypedRedux("customize", "custom_openai");
51+
const user_llm = useUserDefinedLLM();
4852

4953
const haveChatRegenerate = redux
5054
.getStore("projects")
@@ -117,6 +121,25 @@ export function RegenerateLLM({
117121
}
118122
}
119123

124+
if (!isEmpty(user_llm)) {
125+
for (const llm of user_llm) {
126+
const m = toUserLLMModelName(llm);
127+
const name = modelToName(m);
128+
entries.push({
129+
key: m,
130+
label: (
131+
<>
132+
<LanguageModelVendorAvatar model={m} /> {name}{" "}
133+
<LLMModelPrice model={m} floatRight />
134+
</>
135+
),
136+
onClick: () => {
137+
actions.regenerateLLMResponse(new Date(date), m);
138+
},
139+
});
140+
}
141+
}
142+
120143
if (entries.length === 0) {
121144
entries.push({
122145
key: "none",
@@ -161,7 +184,6 @@ export function RegenerateLLM({
161184
<Button
162185
size="small"
163186
type="text"
164-
icon={<Icon name="refresh" />}
165187
style={{
166188
display: "inline",
167189
whiteSpace: "nowrap",
@@ -170,6 +192,7 @@ export function RegenerateLLM({
170192
}}
171193
>
172194
<Space>
195+
<Icon name="refresh" />
173196
Regenerate
174197
<Icon name="chevron-down" />
175198
</Space>

src/packages/frontend/chat/message.tsx

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -743,7 +743,7 @@ export default function Message(props: Readonly<Props>) {
743743
<Avatar
744744
account_id={isLLMThread}
745745
size={16}
746-
style={{ marginLeft: "10px", marginBottom: "2.5px" }}
746+
style={{ top: "-5px" }}
747747
/>
748748
) : undefined}
749749
</Button>
@@ -784,11 +784,7 @@ export default function Message(props: Readonly<Props>) {
784784
const style: CSS =
785785
mode === "standalone"
786786
? {
787-
marginTop:
788-
props.show_avatar ||
789-
(!props.is_prev_sender && is_viewers_message)
790-
? MARGIN_TOP_VIEWER
791-
: "5px",
787+
marginTop: MARGIN_TOP_VIEWER,
792788
marginLeft: "5px",
793789
marginRight: "5px",
794790
}

src/packages/frontend/codemirror/extensions/ai-formula.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,7 @@ function AiGenFormula({ mode, text = "", project_id, cb }: Props) {
237237
return (
238238
<>
239239
<Title level={4}>
240-
<AIAvatar size={24} /> Generate LaTeX Formula
240+
<AIAvatar size={20} /> Generate LaTeX Formula
241241
</Title>
242242
{enabled ? (
243243
<>

src/packages/frontend/components/ai-avatar.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,8 @@ export default function AIAvatar({
3232
height: size,
3333
display: "inline-block",
3434
position: "relative",
35-
...{ marginRight: "3px", ...style },
35+
top: "2px",
36+
...style,
3637
}}
3738
>
3839
<div
@@ -41,7 +42,6 @@ export default function AIAvatar({
4142
backgroundColor,
4243
color: "white",
4344
height: size,
44-
top: "5px",
4545
...innerStyle,
4646
}}
4747
>

src/packages/frontend/editors/stopwatch/stopwatch.tsx

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -7,23 +7,25 @@
77
The stopwatch and timer component
88
*/
99

10-
import { CSSProperties, useEffect, useState } from "react";
11-
import { redux, useForceUpdate } from "@cocalc/frontend/app-framework";
12-
import { Icon } from "@cocalc/frontend/components/icon";
13-
import dayjs from "dayjs";
14-
import { Button, Row, Col, Modal, TimePicker, Tooltip } from "antd";
1510
import {
1611
DeleteTwoTone,
12+
EditTwoTone,
1713
PauseCircleTwoTone,
1814
PlayCircleTwoTone,
1915
StopTwoTone,
20-
EditTwoTone,
2116
} from "@ant-design/icons";
22-
import { TimerState } from "./actions";
23-
import StaticMarkdown from "@cocalc/frontend/editors/slate/static-markdown";
17+
import { redux, useForceUpdate } from "@cocalc/frontend/app-framework";
18+
import { Icon } from "@cocalc/frontend/components/icon";
19+
import { Button, Col, Modal, Row, TimePicker, Tooltip } from "antd";
20+
import type { Dayjs } from "dayjs";
21+
import dayjs from "dayjs";
22+
import { CSSProperties, useEffect, useState } from "react";
23+
2424
import MarkdownInput from "@cocalc/frontend/editors/markdown-input/multimode";
25-
import { webapp_client } from "@cocalc/frontend/webapp-client";
25+
import StaticMarkdown from "@cocalc/frontend/editors/slate/static-markdown";
2626
import { useFrameContext } from "@cocalc/frontend/frame-editors/frame-tree/frame-context";
27+
import { webapp_client } from "@cocalc/frontend/webapp-client";
28+
import { TimerState } from "./actions";
2729
import { TimeAmount } from "./time";
2830

2931
function assertNever(x: never): never {
@@ -114,14 +116,14 @@ export default function Stopwatch(props: StopwatchProps) {
114116
{!props.compact ? "Edit" : undefined}
115117
</Button>
116118
</Tooltip>
117-
{editingTime && (
119+
{editingTime ? (
118120
<TimePicker
119121
open
120122
defaultValue={getCountdownMoment(props.countdown)}
121123
onChange={(time) => {
122124
if (time != null) {
123125
setCountdown(
124-
time.second() + time.minute() * 60 + time.hour() * 60 * 60
126+
time.second() + time.minute() * 60 + time.hour() * 60 * 60,
125127
);
126128
// timeout so the setcountdown can fully propagate through flux; needed for whiteboard
127129
setTimeout(() => props.clickButton("reset"), 0);
@@ -134,7 +136,7 @@ export default function Stopwatch(props: StopwatchProps) {
134136
}
135137
}}
136138
/>
137-
)}
139+
) : undefined}
138140
</div>
139141
);
140142
}
@@ -397,7 +399,7 @@ export default function Stopwatch(props: StopwatchProps) {
397399
}
398400
}
399401

400-
export function getCountdownMoment(countdown: number | undefined) {
402+
export function getCountdownMoment(countdown: number | undefined): Dayjs {
401403
let amount = Math.round(countdown ?? 0);
402404
const m = dayjs();
403405
m.second(amount % 60);

src/packages/frontend/frame-editors/frame-tree/title-bar.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1057,7 +1057,7 @@ export function FrameTitleBar(props: Props) {
10571057
background: "#fafafa",
10581058
}}
10591059
>
1060-
<div style={{ margin: "-1px 0 -5px 0" }}>{v}</div>
1060+
<div style={{ margin: "-1px 0 -1px 0" }}>{v}</div>
10611061
</div>
10621062
);
10631063
}

src/packages/frontend/frame-editors/llm/help-me-fix.tsx

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ A generic button for helping a user fix problems using chatgpt.
33
If chatgpt is disabled or not available it renders as null.
44
*/
55

6-
import { Alert, Button } from "antd";
6+
import { Alert, Button, Space } from "antd";
77
import type { BaseButtonProps } from "antd/lib/button/button";
88
import { CSSProperties, useState } from "react";
99
import useAsyncEffect from "use-async-effect";
@@ -151,12 +151,10 @@ export default function HelpMeFix({
151151
}}
152152
>
153153
<Button size={size} style={style} disabled={gettingHelp}>
154-
<AIAvatar
155-
size={16}
156-
style={{ marginRight: "5px" }}
157-
innerStyle={{ top: "2.5px" }}
158-
/>
159-
Help me fix this...
154+
<Space>
155+
<AIAvatar size={16} />
156+
Help me fix this...
157+
</Space>
160158
</Button>
161159
</PopconfirmKeyboard>
162160
{errorGettingHelp && (

src/packages/frontend/frame-editors/llm/title-bar-button.tsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -410,7 +410,6 @@ export default function LanguageModelTitleBarButton({
410410
<Text type="secondary">{description}</Text>
411411
</>
412412
),
413-
type: preset.tag == tag ? "primary" : undefined,
414413
onClick: () => {
415414
setPreset(preset);
416415
track(TAG_TMPL, { project_id, template: label });
@@ -637,9 +636,9 @@ export default function LanguageModelTitleBarButton({
637636
>
638637
<span ref={buttonRef}>
639638
<AIAvatar
640-
size={18}
639+
size={16}
641640
iconColor={COLORS.AI_ASSISTANT_TXT}
642-
style={{ top: "-2px", marginRight: "1px" }}
641+
innerStyle={{ top: "2px" }}
643642
/>
644643
{noLabel ? (
645644
""

0 commit comments

Comments
 (0)