Skip to content

Commit 49526ca

Browse files
committed
llm: updates, fixes, refactor, ...
1 parent 44ad667 commit 49526ca

26 files changed

+1280
-722
lines changed

src/.nvmrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
lts/hydrogen
1+
20

src/packages/frontend/account/user-defined-llm.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -265,6 +265,8 @@ export function UserDefinedLLMComponent({ style, on_change }: Props) {
265265
return "'open-mixtral-8x22b'";
266266
case "google":
267267
return "'gemini-2.0-flash'";
268+
case "xai":
269+
return "'grok-4-1-fast-non-reasoning-8k'";
268270
default:
269271
unreachable(service);
270272
return "'llama3:latest'";

src/packages/frontend/components/language-model-icon.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ import GooglePalmLogo from "./google-palm-avatar";
1919
import MistralAvatar from "./mistral-avatar";
2020
import OllamaAvatar from "./ollama-avatar";
2121
import OpenAIAvatar from "./openai-avatar";
22+
import XAIAvatar from "./xai-avatar";
2223

2324
export function LanguageModelVendorAvatar(
2425
props: Readonly<{
@@ -101,6 +102,9 @@ export function LanguageModelVendorAvatar(
101102
case "anthropic":
102103
return <AnthropicAvatar size={size} style={style} />;
103104

105+
case "xai":
106+
return <XAIAvatar size={size} style={style} />;
107+
104108
case "user":
105109
// should never happen, because it is unpacked below
106110
return fallback();
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
import { CSSProperties } from "react";
2+
3+
import { COLORS } from "@cocalc/util/theme";
4+
5+
interface Props {
6+
size: number;
7+
backgroundColor?: string;
8+
iconColor?: string;
9+
style?: CSSProperties;
10+
innerStyle?: CSSProperties;
11+
}
12+
13+
export default function XAIAvatar({
14+
size,
15+
innerStyle,
16+
backgroundColor = "transparent",
17+
iconColor = COLORS.GRAY_DD,
18+
style,
19+
}: Props) {
20+
return (
21+
<div
22+
style={{
23+
width: size,
24+
height: size,
25+
display: "inline-block",
26+
position: "relative",
27+
...style,
28+
}}
29+
>
30+
<div
31+
style={{
32+
position: "absolute",
33+
backgroundColor,
34+
color: iconColor,
35+
height: size,
36+
top: "0px",
37+
...innerStyle,
38+
}}
39+
>
40+
<svg
41+
width={size}
42+
height={size}
43+
viewBox="0 0 841.89 595.28"
44+
xmlns="http://www.w3.org/2000/svg"
45+
>
46+
<g fill="currentColor">
47+
<polygon points="557.09,211.99 565.4,538.36 631.96,538.36 640.28,93.18" />
48+
<polygon points="640.28,56.91 538.72,56.91 379.35,284.53 430.13,357.05" />
49+
<polygon points="201.61,538.36 303.17,538.36 353.96,465.84 303.17,393.31" />
50+
<polygon points="201.61,211.99 430.13,538.36 531.69,538.36 303.17,211.99" />
51+
</g>
52+
</svg>
53+
</div>
54+
</div>
55+
);
56+
}

src/packages/frontend/customize.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,7 @@ export interface CustomizeState {
107107
google_vertexai_enabled: boolean;
108108
mistral_enabled: boolean;
109109
anthropic_enabled: boolean;
110+
xai_enabled: boolean;
110111
ollama_enabled: boolean;
111112
custom_openai_enabled: boolean;
112113
neural_search_enabled: boolean;
@@ -215,6 +216,7 @@ export class CustomizeStore extends Store<CustomizeState> {
215216
custom_openai: this.get("custom_openai_enabled"),
216217
mistralai: this.get("mistral_enabled"),
217218
anthropic: this.get("anthropic_enabled"),
219+
xai: this.get("xai_enabled"),
218220
user: this.get("user_defined_llm"),
219221
};
220222
}
@@ -261,7 +263,7 @@ export class CustomizeActions extends Actions<CustomizeState> {
261263
unlicensed_project_timetravel_limit: undefined,
262264
});
263265
};
264-
266+
265267
reload = async () => {
266268
await loadCustomizeState();
267269
};

src/packages/frontend/project/context.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ export const emptyProjectContext = {
7272
mistralai: false,
7373
anthropic: false,
7474
custom_openai: false,
75+
xai: false,
7576
user: false,
7677
},
7778
flipTabs: [0, () => {}],

src/packages/next/components/openai/vendor-status-check.tsx

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,13 @@ export function LLMServiceStatusCheck({
6565
</>
6666
);
6767

68+
case "xai":
69+
return (
70+
<>
71+
xAI <A href="https://status.x.ai/">status</A>.
72+
</>
73+
);
74+
6875
case "user":
6976
return <>{getLLMServiceStatusCheckMD("user")}</>;
7077

src/packages/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@
2323
"undici@<5.28.3": "^5.28.4",
2424
"postcss@<8.4.31": "^8.4.31",
2525
"retry-request@<7.0.1": "^7.0.2",
26-
"@langchain/core": "^0.3.77",
27-
"langchain": "^0.3.34",
26+
"@langchain/core": "^1.1.6",
27+
"langchain": "^1.2.1",
2828
"katex@<0.16.9": "^0.16.10",
2929
"nanoid@<3.3.8": "^3.3.8",
3030
"node-forge@<=1.3.1": "^1.3.2",

0 commit comments

Comments
 (0)