Skip to content

Commit

Permalink
Merge branch 'details' into dev
Browse files Browse the repository at this point in the history
  • Loading branch information
dezoito committed Jul 1, 2024
2 parents 28b22fe + 6a79e05 commit 1992c94
Show file tree
Hide file tree
Showing 5 changed files with 69 additions and 6 deletions.
3 changes: 3 additions & 0 deletions Prompt for testing.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Prompt for testing

Imagine you wake up one morning to find yourself in a bustling marketplace in a fantastical city you've never seen before. Write a concise paragraph description of your surroundings, capturing the sights, sounds, and smells that overwhelm your senses.
2 changes: 2 additions & 0 deletions src/components/results/grid-results-pane.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ export default function GridResultsPane() {
variant="ghost"
size="tight"
onClick={() => setExpandParams(!expandParams)}
className="pr-2"
>
{expandParams ? (
<>
Expand All @@ -134,6 +135,7 @@ export default function GridResultsPane() {
variant="ghost"
size="tight"
onClick={() => setExpandMetadata(!expandMetadata)}
className="pr-2"
>
{expandMetadata ? (
<>
Expand Down
15 changes: 10 additions & 5 deletions src/components/results/iteration-result.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,9 @@ import { useState } from "react";
import { get_inference } from "../queries";
import { Button } from "../ui/button";
import { CollapsibleItem } from "../ui/collapsible-item";
import { CollapsibleText } from "../ui/collapsible-text";
import { Separator } from "../ui/separator";
import Spinner from "../ui/spinner";

interface IProps {
params: TParamIteration;
iterationIndex: number;
Expand Down Expand Up @@ -89,10 +90,6 @@ export default function IterationResult(props: IProps) {
defaultOpen={expandParams}
>
<div className="font-mono text-sm">
<div className="whitespace-pre-wrap">
system prompt: {system_prompt}
</div>
<div className="whitespace-pre-wrap">prompt: {prompt}</div>
<div>temperature: {temperature}</div>
<div>repeat penalty: {repeat_penalty}</div>
<div>top k: {top_k}</div>
Expand All @@ -102,6 +99,14 @@ export default function IterationResult(props: IProps) {
<div>mirostat: {mirostat}</div>
<div>mirostat tau: {mirostat_tau}</div>
<div>mirostat eta: {mirostat_eta}</div>
<Separator className="my-1" />
<div className=" whitespace-pre-wrap">
prompt: <CollapsibleText text={prompt} maxChars={45} />
</div>
<div className=" whitespace-pre-wrap">
system prompt:{" "}
<CollapsibleText text={system_prompt} maxChars={45} />
</div>
</div>
</CollapsibleItem>

Expand Down
51 changes: 51 additions & 0 deletions src/components/ui/collapsible-text.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
"use client";

import { ChevronUpIcon, DotsHorizontalIcon } from "@radix-ui/react-icons";
import * as React from "react";
import { useEffect } from "react";

import { Button } from "@/components/ui/button";
import {
Collapsible,
CollapsibleContent,
CollapsibleTrigger,
} from "@/components/ui/collapsible";

interface IProps {
text: string;
maxChars: number;
}

export function CollapsibleText({ text, maxChars }: IProps) {
const [isOpen, setIsOpen] = React.useState(false);
const isTextLong = text.length > maxChars;
const displayText =
isTextLong && !isOpen ? text.substring(0, maxChars) : text;

useEffect(() => {
isTextLong && !isOpen ? text.substring(0, maxChars) : text;
}, [isOpen]);

return (
<Collapsible open={isOpen} onOpenChange={setIsOpen} className="space-y-2">
<div className="my-1 flex justify-stretch">
<div className="text-sm font-semibold">{displayText}</div>

{isTextLong && (
<CollapsibleTrigger asChild>
<Button variant="ghost" size="sm">
{isOpen ? (
<ChevronUpIcon className="mr-1 h-4 w-4" />
) : (
<DotsHorizontalIcon className="mr-1 h-4 w-4" />
)}
<span className="sr-only">Toggle Expand/Collapse</span>
</Button>
</CollapsibleTrigger>
)}
</div>

<CollapsibleContent className="space-y-2"></CollapsibleContent>
</Collapsible>
);
}
4 changes: 3 additions & 1 deletion todo.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,9 +89,11 @@ https://github.com/tauri-apps/plugins-workspace/tree/v1/plugins/single-instance
[ok] - Add versioning to the JSON log files, starting at this release's version.

--- v0.5.1
[ok] - Add3ed Rust CI
[ok] - Added Rust CI
[ok] - Added Clippy checks when saving Rust code
[ok] - Corrected existing Rust code to pass Clippy checks
[ok] - Fixed padding in "Expand/Hide" buttons for params and metadate
[ok] - Improved UI for component that displays inference parameters with collapsible prompts



Expand Down

0 comments on commit 1992c94

Please sign in to comment.