Skip to content

Commit cbc1a5d

Browse files
v1.19.0 (#69)
* Initial commit * Fixes same embedding name for openai & azure check * Fixes padding on question playground results * Updates project record count on upload * Adds border to no logs for ac calc * sub ref --------- Co-authored-by: JWittmeyer <jens.wittmeyer@kern.ai>
1 parent 55400e2 commit cbc1a5d

File tree

6 files changed

+33
-17
lines changed

6 files changed

+33
-17
lines changed

src/components/projects/projectId/playground/PlaygroundSearch.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ export function PlaygroundSearch() {
8484
}, [projectId, question]);
8585

8686

87-
return <div className="grid overflow-hidden grid-cols-2 h-[calc(100vh-200px)]">
87+
return <div className="grid overflow-hidden grid-cols-2 h-[calc(100vh-150px)]">
8888
<div className="flex flex-col gap-y-2 m-3 h-full">
8989
<div className="flex items-center">
9090
<span className="mr-3">Embedding</span>
@@ -153,7 +153,7 @@ export function PlaygroundSearch() {
153153
/>
154154
</div>
155155
{!loading && !searchResults && <div className="text-sm inline-block font-normal text-gray-500 italic mx-3">Start by searching for records.</div>}
156-
{!loading && searchResults && (searchResults.length > 0 ? <div className="relative ml-2 font-dmMono text-xs whitespace-pre-line h-[calc(100vh-200px)] overflow-y-auto">
156+
{!loading && searchResults && (searchResults.length > 0 ? <div className="relative ml-2 font-dmMono text-xs whitespace-pre-line h-[calc(100vh-175px)] pb-5 overflow-y-auto">
157157
{searchResults.map((result, index) => <div key={index} className="flex flex-col gap-x-3 bg-white rounded-md border border-gray-300 py-2 px-3 m-2">
158158
<div className="absolute right-4 text-gray-500 text-xs">{result?.score.toFixed(3)}</div>
159159
<RecordDisplay record={result} attributes={attributes} />

src/components/shared/logs/ContainerLogs.tsx

+4-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,10 @@ export default function ContainerLogs(props: ContainerLogsProps) {
3535
/>
3636
) : (
3737
<Tooltip content='No runs to copy' color="invert" placement="top" className="cursor-auto">
38-
<IconClipboardOff className="text-gray-400 h-5 w-5 mx-1" />
38+
<IconButton
39+
icon={IconClipboardOff}
40+
disabled
41+
/>
3942
</Tooltip>)}
4043

4144

src/components/shared/sidebar/Sidebar.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ export default function Sidebar() {
183183
<Tooltip placement="right" trigger="hover" color="invert" content={TOOLTIPS_DICT.SIDEBAR.VERSION_OVERVIEW}>
184184
<div onClick={requestVersionOverview} id="refineryVersion"
185185
className="z-50 tooltip tooltip-right cursor-pointer select-none text-white flex items-center mr-1">
186-
v1.18.0
186+
v1.19.0
187187
{hasUpdates && <Tooltip placement="right" trigger="hover" color="invert" content={TOOLTIPS_DICT.SIDEBAR.NEWER_VERSION_AVAILABLE} >
188188
<IconAlertCircle className="h-5 w-5 text-yellow-700" />
189189
</Tooltip>}
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,34 @@
11
import UploadRecords from "@/src/components/projects/projectId/upload-records/UploadRecords";
2-
import { setCurrentPage, setDisplayIconComments } from "@/src/reduxStore/states/general";
3-
import { CurrentPage } from "@/submodules/react-components/hooks/web-socket/constants";
4-
import { useEffect } from "react";
5-
import { useDispatch } from "react-redux"
2+
import { selectOrganizationId, setCurrentPage, setDisplayIconComments } from "@/src/reduxStore/states/general";
3+
import { selectProjectId, setActiveProject } from "@/src/reduxStore/states/project";
4+
import { getProjectByProjectId } from "@/src/services/base/project";
5+
import { Application, CurrentPage, CurrentPageSubKey } from "@/submodules/react-components/hooks/web-socket/constants";
6+
import { useWebsocket } from "@/submodules/react-components/hooks/web-socket/useWebsocket";
7+
import { useCallback, useEffect } from "react";
8+
import { useDispatch, useSelector } from "react-redux"
69

710
export default function UploadRecordsPage() {
811
const dispatch = useDispatch();
12+
const projectId = useSelector(selectProjectId);
13+
const orgId = useSelector(selectOrganizationId);
914

1015
useEffect(() => {
1116
dispatch(setCurrentPage(CurrentPage.UPLOAD_RECORDS));
1217
dispatch(setDisplayIconComments(false));
1318
}, []);
1419

15-
return (<UploadRecords></UploadRecords>)
20+
21+
const handleWebsocketNotification = useCallback((msgParts: string[]) => {
22+
if (!projectId) return;
23+
if (msgParts[1] == 'project_update' && msgParts[2] == projectId) {
24+
getProjectByProjectId(projectId, (res) => {
25+
dispatch(setActiveProject(res));
26+
})
27+
}
28+
29+
}, [projectId]);
30+
31+
useWebsocket(orgId, Application.REFINERY, CurrentPage.PROJECT_SETTINGS, handleWebsocketNotification, undefined, CurrentPageSubKey.FILE_UPLOAD);
32+
33+
return <UploadRecords />
1634
}

src/util/components/projects/projectId/settings/embeddings-helper.ts

+2-7
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ function buildExpectedEmbeddingName(data: any): string {
8484
function buildEmbeddingNameWithApiToken(data: any) {
8585
if (data.apiToken == null) return "";
8686
if (data.platform == PlatformType.AZURE) data.model = data.engine;
87-
const platformStr = "-" + data + "-";
87+
const platformStr = "-" + data.platform + "-";
8888
const apiTokenCut = data.apiToken.substring(0, 3) + "..." + data.apiToken.substring(data.apiToken.length - 4, data.apiToken.length);
8989
if (data.platform == PlatformType.OPEN_AI || data.platform == PlatformType.AZURE) return platformStr + data.model + "-" + apiTokenCut;
9090
else return platformStr + apiTokenCut;
@@ -93,12 +93,7 @@ function buildEmbeddingNameWithApiToken(data: any) {
9393
export function checkDuplicates(embeddings: any, data: any): boolean {
9494
const currentName = buildExpectedEmbeddingName(data);
9595
if (currentName.slice(-1) == "-") return false;
96-
else {
97-
for (const embedding of embeddings) {
98-
if (embedding.name == currentName) return false;
99-
}
100-
}
101-
return true;
96+
else return !embeddings.some((e) => e.name == currentName);
10297
}
10398

10499
export function checkIfCreateEmbeddingIsDisabled(props: EmbeddingCreationEnabledProps) {

0 commit comments

Comments
 (0)