Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master' into support-ollama-api
Browse files Browse the repository at this point in the history
  • Loading branch information
haraldschilly committed Feb 26, 2024
2 parents 3413932 + 778a8d5 commit 7c22214
Show file tree
Hide file tree
Showing 17 changed files with 77 additions and 47 deletions.
35 changes: 32 additions & 3 deletions src/packages/frontend/chat/message.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* License: AGPLv3 s.t. "Commons Clause" – see LICENSE.md for details
*/

import { Button, Col, Row, Tooltip } from "antd";
import { Button, Col, Row, Popconfirm, Tooltip } from "antd";
import { Map } from "immutable";
import { CSSProperties } from "react";

Expand Down Expand Up @@ -203,7 +203,7 @@ export default function Message(props: Props) {
);
}
return (
<div style={{ marginTop: "5px" }}>
<div>
{text}
{is_editing ? (
<span style={{ margin: "10px 10px 0 10px", display: "inline-block" }}>
Expand Down Expand Up @@ -356,7 +356,7 @@ export default function Message(props: Props) {
<div>
{Date.now() - date < SHOW_EDIT_BUTTON_MS && (
<Tooltip
title="Edit this message. You can edit any past message by anybody at any time by double clicking on it."
title="Edit this message. You can edit any past message by anybody at any time by double clicking on it. Previous versions are in the history."
placement="left"
>
<Button
Expand All @@ -374,6 +374,35 @@ export default function Message(props: Props) {
</Button>
</Tooltip>
)}
{newest_content(props.message).trim().length > 0 && (
<Tooltip
title="Delete this message. You can delete any past message by anybody. The deleted message can be view in history."
placement="left"
>
<Popconfirm
title="Delete this message"
description="Are you sure you want to delete this message?"
onConfirm={() => {
props.actions?.set_editing(props.message, true);
setTimeout(
() => props.actions?.send_edit(props.message, ""),
1,
);
}}
>
<Button
disabled={replying}
style={{
color: is_viewers_message ? "white" : "#555",
}}
type="text"
size="small"
>
<Icon name="trash" /> Delete
</Button>
</Popconfirm>
</Tooltip>
)}
{!props.message.get("reply_to") &&
props.allowReply &&
!replying && (
Expand Down
4 changes: 2 additions & 2 deletions src/packages/frontend/compute/compute-servers-alert.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,14 @@ export default function ComputeServersAlert({ project_id }) {
type="success"
showIcon
icon={<Icon name="servers" />}
message=<>Dedicated Compute Servers</>
message={<>Dedicated Compute Servers</>}
description={
<>
You can also run Jupyter notebooks, terminals, and commercial software
on dedicated VM's where you have root permissions. These are charged
by the second and have up to{" "}
<strong>
11,776GB of RAM, 416 vCPU's, 65TB of disk space, and GPU's.{" "}
11,776GB of RAM, 416 vCPUs, 65TB of disk space, and GPUs.{" "}
</strong>
<br />
Click the{" "}
Expand Down
6 changes: 3 additions & 3 deletions src/packages/frontend/compute/compute-servers.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ export default function ComputeServers({ project_id }: { project_id: string }) {
Do you need{" "}
<strong>
<A href="https://github.com/sagemathinc/cocalc-howto/blob/main/ollama.md">
affordable GPU's
affordable GPUs
</A>
</strong>
, <strong>high end VM's</strong>, <strong>root access</strong>,{" "}
Expand All @@ -66,8 +66,8 @@ export default function ComputeServers({ project_id }: { project_id: string }) {
Linux server,
</li>
<li>
<Icon name="server" /> Dedicated GPU's, hundreds of very fast
vCPU's, and thousands of GB of RAM
<Icon name="server" /> Dedicated GPUs, hundreds of very fast
vCPUs, and thousands of GB of RAM
</li>
<li>
<Icon name="mathematica" /> <Icon name="matlab" />{" "}
Expand Down
12 changes: 6 additions & 6 deletions src/packages/frontend/compute/google-cloud-config.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ export default function GoogleCloudConfiguration({
const gpu = configuration.acceleratorType
? `${configuration.acceleratorCount ?? 1} ${displayAcceleratorType(
configuration.acceleratorType,
)} ${plural(configuration.acceleratorCount ?? 1, "GPU", "GPU's")}, `
)} ${plural(configuration.acceleratorCount ?? 1, "GPU")}, `
: "";
// short summary
return (
Expand Down Expand Up @@ -1002,13 +1002,13 @@ function RamAndCpu({
if (inline) {
return (
<span style={style}>
{vcpu} {plural(vcpu, "vCPU", "vCPU's")}, {memory} GB RAM
{vcpu} {plural(vcpu, "vCPU")}, {memory} GB RAM
</span>
);
}
return (
<div style={{ color: "#666", ...style }}>
<b>{plural(vcpu, "vCPU", "vCPU's")}: </b>
<b>{plural(vcpu, "vCPU")}: </b>
<div
style={{ width: "65px", textAlign: "left", display: "inline-block" }}
>
Expand Down Expand Up @@ -1439,7 +1439,7 @@ function GPU({ priceData, setConfig, configuration, disabled, state, IMAGES }) {
<div style={{ color: "#666", marginTop: "10px" }}>
You have selected {acceleratorCount} dedicated{" "}
<b>{displayAcceleratorType(acceleratorType)}</b>{" "}
{plural(acceleratorCount, "GPU", "GPU's")}, with a total of{" "}
{plural(acceleratorCount, "GPU")}, with a total of{" "}
<b>
{priceData.accelerators[acceleratorType].memory *
acceleratorCount}
Expand All @@ -1448,7 +1448,7 @@ function GPU({ priceData, setConfig, configuration, disabled, state, IMAGES }) {
.{" "}
{acceleratorCount > 1 && (
<>
The {acceleratorCount} GPU's will be available on the same
The {acceleratorCount} GPUs will be available on the same
server.
</>
)}
Expand Down Expand Up @@ -1620,7 +1620,7 @@ function ensureZoneIsConsistentWithGPU(priceData, configuration, changes) {
// Ensure the region/zone is consistent with accelerator type
const prices = data[configuration.spot ? "spot" : "prices"];
if (prices[configuration.zone] == null) {
// there are no GPU's in the selected zone of the selected type.
// there are no GPUs in the selected zone of the selected type.
// If you just explicitly changed the GPU type, then we fix this by changing the zone.
if (changes["acceleratorType"] != null) {
// fix the region and zone
Expand Down
29 changes: 16 additions & 13 deletions src/packages/frontend/course/export/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,13 @@ export class ExportActions {
const assignments = store.get_sorted_assignments();
// CSV definition: http://edoceo.com/utilitas/csv-file-format
// i.e. double quotes everywhere (not single!) and double quote in double quotes usually blows up
const timestamp = webapp_client.server_time().toISOString();
let content = `# Course '${store.getIn(["settings", "title"])}'\n`;
content += `# exported ${timestamp}\n`;
content += "Name,Id,Email,";
// We had these nice comments, but actually CSV has no official
// support for comments, and this breaks some parsers, e.g.,
// https://github.com/sagemathinc/cocalc/issues/7138
// const timestamp = webapp_client.server_time().toISOString();
// let content = `# Course '${store.getIn(["settings", "title"])}'\n`;
// content += `# exported ${timestamp}\n`;
let content = "Name,Id,Email,";
content +=
(() => {
const result: any[] = [];
Expand All @@ -95,7 +98,7 @@ export class ExportActions {
for (const assignment of assignments) {
let grade = store.get_grade(
assignment.get("assignment_id"),
student.get("student_id")
student.get("student_id"),
);
grade = grade != null ? grade : "";
grade = this.sanitize_csv_entry(grade);
Expand All @@ -109,7 +112,7 @@ export class ExportActions {
for (const assignment of assignments) {
let comment = store.get_comments(
assignment.get("assignment_id"),
student.get("student_id")
student.get("student_id"),
);
comment = comment != null ? comment : "";
comment = this.sanitize_csv_entry(comment);
Expand All @@ -118,7 +121,7 @@ export class ExportActions {
return result3;
})().join(",");
const name = `\"${this.sanitize_csv_entry(
store.get_student_name(student.get("student_id"))
store.get_student_name(student.get("student_id")),
)}\"`;
const email = `\"${
(left2 = store.get_student_email(student.get("student_id"))) != null
Expand Down Expand Up @@ -182,7 +185,7 @@ export class ExportActions {
const obj = this.export_grades();
this.write_file(
this.path("json", "grades"),
JSON.stringify(obj, undefined, 2)
JSON.stringify(obj, undefined, 2),
);
}

Expand All @@ -208,27 +211,27 @@ export class ExportActions {
const target_json = this.path(
"json",
"file-use-times/assignment/" +
replace_all(assignment.get("path"), "/", "-")
replace_all(assignment.get("path"), "/", "-"),
);
await this.course_actions.assignments.export_file_use_times(
assignment_or_handout_id,
target_json
target_json,
);
this.open_file(target_json);
} else if (handout != null) {
const target_json = this.path(
"json",
"file-use-times/handouts/" +
replace_all(handout.get("path"), "/", "-")
replace_all(handout.get("path"), "/", "-"),
);
await this.course_actions.handouts.export_file_use_times(
assignment_or_handout_id,
target_json
target_json,
);
this.open_file(target_json);
} else {
throw Error(
`Unknown handout or assignment "${assignment_or_handout_id}"`
`Unknown handout or assignment "${assignment_or_handout_id}"`,
);
}
} catch (err) {
Expand Down
4 changes: 2 additions & 2 deletions src/packages/frontend/project/new/file-type-selector.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -194,10 +194,10 @@ export function FileTypeSelector({
title={"Create a Compute Server"}
placement="left"
icon={"servers"}
tip={"Affordable GPU's and high end dedicate virtual machines."}
tip={"Affordable GPUs and high-end dedicated virtual machines."}
>
<NewFileButton
name={"Compute Server: GPU's and VM's"}
name={"Compute Server: GPUs and VM's"}
icon="servers"
on_click={() => {
projectActions?.setState({ create_compute_server: true });
Expand Down
4 changes: 2 additions & 2 deletions src/packages/frontend/site-licenses/purchase/quota-editor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ export const QuotaEditor: React.FC<Props> = (props: Props) => {
)
</b>
{render_explanation(
"Google cloud vCPU's shared with other projects (member hosting significantly reduces sharing)"
"Google Cloud vCPUs shared with other projects (member hosting significantly reduces sharing)"
)}
</Col>
)}
Expand Down Expand Up @@ -292,7 +292,7 @@ export const QuotaEditor: React.FC<Props> = (props: Props) => {
)
</b>
{render_explanation(
"Google cloud vCPU's NOT shared with other projects. You can enter a fractional value, e.g., 0.5 for a half dedicated core."
"Google Cloud vCPUs NOT shared with other projects. You can enter a fractional value, e.g., 0.5 for a half dedicated core."
)}
</Col>
)}
Expand Down
4 changes: 1 addition & 3 deletions src/packages/next/components/landing/content.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,7 @@ export default function Content(props: Props) {
{description}
</Title>
)}
<SignIn startup={startup ?? title} hideFree={true} />
</Space>
</Col>
<Col sm={14} xs={24}>
Expand All @@ -237,9 +238,6 @@ export default function Content(props: Props) {
{renderBelowImage()}
</Col>
{subtitle && renderSubtitleBelow()}
<Col lg={24}>
<SignIn startup={startup ?? title} hideFree={true} />
</Col>
</Row>
</div>
);
Expand Down
2 changes: 1 addition & 1 deletion src/packages/next/components/store/overview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ export default function Overview() {
icon={PAYASYOUGO_ICON}
title="Pay As You Go Servers"
>
Run Jupyter Notebooks and Linux Terminals on GPU's and high powered
Run Jupyter Notebooks and Linux Terminals on GPUs and high-powered
virtual machines with full admin privileges. Pay only for what you
actually use.
</Product>
Expand Down
4 changes: 2 additions & 2 deletions src/packages/next/components/store/payg-info.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ export default function PaygInfo({ what }) {
<div>
<ul>
<li>
If you need a large amount of compute power, disk space, GPU's,
root privileges or to run commercial software, add a{" "}
If you need a large amount of compute power, disk space, GPUs,
root privileges, or to run commercial software, add a{" "}
<A href="https://doc.cocalc.com/compute_server.html">
pay as you go compute server to your project
</A>
Expand Down
4 changes: 2 additions & 2 deletions src/packages/next/components/store/quota-config.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -117,9 +117,9 @@ export const QuotaConfig: React.FC<Props> = (props: Props) => {
showExplanations ? (
<>
<A href="https://cloud.google.com/compute/docs/faq#virtualcpu">
Google cloud vCPU's.
Google Cloud vCPUs.
</A>{" "}
To keep prices low, these vCPU's may be shared with other
To keep prices low, these vCPUs may be shared with other
projects, though member hosting very significantly reduces
competition for CPUs. We also offer{" "}
<A href={"/store/dedicated?type=vm"}>
Expand Down
2 changes: 1 addition & 1 deletion src/packages/next/pages/features/compute-server.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ export default function ComputeServer({ customize }) {
to 65TB of disk space.
</Paragraph>
<Paragraph>
You can choose one or more T4, L4, and A100 GPU's.
You can choose one or more T4, L4, and A100 GPUs.
</Paragraph>
<Paragraph>
Many preconfigured software stacks are available, including
Expand Down
4 changes: 2 additions & 2 deletions src/packages/next/pages/pricing/products.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,8 @@ function Body({ siteName }): JSX.Element {
<Icon name="servers" /> Compute Servers
</Title>
<Paragraph>
You can use Jupyter notebooks and terminals with access to GPU's,
hundreds of CPU's, and thousands of GB of RAM by creating{" "}
You can use Jupyter notebooks and terminals with access to GPUs,
hundreds of CPUs, and thousands of GB of RAM by creating{" "}
<A href="https://doc.cocalc.com/compute_server.html">compute servers</A>{" "}
associated to a project.
</Paragraph>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ export async function validateConfigurationChange({
(newConfiguration.acceleratorCount ?? 0) >= 1
)
) {
// Google cloud automatically adds GPU's in cases like the above,
// Google cloud automatically adds GPUs in cases like the above,
// which is VERY bad and would cost us tons but users nothing!
// Not checking for this could kill us.
throw Error("the machine type g2- must have an L4 GPU configured");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ export function computeAcceleratorCost({ configuration, priceData }) {
if (!configuration.acceleratorType) {
return 0;
}
// we have 1 or more GPU's:
// we have 1 or more GPUs:
const acceleratorCount = configuration.acceleratorCount ?? 1;
// sometimes google has "tesla-" in the name, sometimes they don't,
// but our pricing data doesn't.
Expand Down
2 changes: 1 addition & 1 deletion src/packages/util/db-schema/accounts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -574,7 +574,7 @@ export const TAGS: Tag[] = [
color: "red",
},
{
label: "AI / GPU's",
label: "AI / GPUs",
tag: "gpu",
color: "volcano",
icon: "gpu",
Expand Down
4 changes: 2 additions & 2 deletions src/packages/util/upgrades/quota.ts
Original file line number Diff line number Diff line change
Expand Up @@ -271,10 +271,10 @@ const BASE_QUOTAS: RQuota = {
member_host: false,
privileged: false, // for elevated docker privileges (FUSE mounting, later more)
memory_request: 0, // will hold guaranteed RAM in MB
cpu_request: 0, // will hold guaranteed min number of vCPU's as a float from 0 to infinity.
cpu_request: 0, // will hold guaranteed min number of vCPUs as a float from 0 to infinity.
disk_quota: DEFAULT_QUOTAS.disk_quota,
memory_limit: DEFAULT_QUOTAS.memory, // upper bound on RAM in MB
cpu_limit: DEFAULT_QUOTAS.cores, // upper bound on vCPU's
cpu_limit: DEFAULT_QUOTAS.cores, // upper bound on vCPUs
idle_timeout: DEFAULT_QUOTAS.mintime, // minimum uptime
always_running: false, // if true, a service restarts the project if it isn't running
dedicated_vm: false,
Expand Down

0 comments on commit 7c22214

Please sign in to comment.