From 09f07a7de04e5e17fd027bea4b511ebfcf4ad4ec Mon Sep 17 00:00:00 2001 From: t11s Date: Mon, 10 Jun 2024 21:42:31 -0700 Subject: [PATCH] fix: types again --- src/components/App.tsx | 9 +++++---- src/utils/prompt.ts | 6 +++--- src/utils/types.ts | 2 +- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/src/components/App.tsx b/src/components/App.tsx index 4407bd0..dffc71d 100644 --- a/src/components/App.tsx +++ b/src/components/App.tsx @@ -65,7 +65,7 @@ import { NavigationBar } from "./utils/NavigationBar"; import { CheckCircleIcon } from "@chakra-ui/icons"; import { Box, useDisclosure, Spinner, useToast } from "@chakra-ui/react"; import mixpanel from "mixpanel-browser"; -import { ChatCompletionRequestMessageInner, OpenAI } from "openai-streams"; +import { OpenAI } from "openai-streams"; import { Resizable } from "re-resizable"; import { useEffect, useState, useCallback, useRef } from "react"; import { useBeforeunload } from "react-beforeunload"; @@ -392,7 +392,8 @@ function App() { "No choices in response. Decoded response: " + JSON.stringify(decoded) ); - const choice: ChatCompletionRequestMessageInner = decoded.choices[0]; + const choice: CreateChatCompletionStreamResponseChoicesInner = + decoded.choices[0]; if (choice.index === undefined) throw new Error( @@ -1047,9 +1048,9 @@ function App() { {isAnythingLoading ? ( - + ) : ( - + )} diff --git a/src/utils/prompt.ts b/src/utils/prompt.ts index 628f5f0..934d554 100644 --- a/src/utils/prompt.ts +++ b/src/utils/prompt.ts @@ -1,13 +1,13 @@ import { FluxNodeData, FluxNodeType, Settings } from "./types"; -import { CreateCompletionRequest } from "openai-streams"; +import { ChatCompletionRequestMessage } from "openai"; import { MAX_AUTOLABEL_CHARS } from "./constants"; import { Node } from "reactflow"; export function messagesFromLineage( lineage: Node[], settings: Settings -): CreateCompletionRequest[] { - const messages: CreateCompletionRequest[] = []; +): ChatCompletionRequestMessage[] { + const messages: ChatCompletionRequestMessage[] = []; // Iterate backwards. for (let i = lineage.length - 1; i >= 0; i--) { diff --git a/src/utils/types.ts b/src/utils/types.ts index 664508c..2416f62 100644 --- a/src/utils/types.ts +++ b/src/utils/types.ts @@ -1,6 +1,6 @@ import { Node, Edge } from "reactflow"; -import { ChatCompletionResponseMessage } from "openai-streams"; +import { ChatCompletionResponseMessage } from "openai"; export type FluxNodeData = { label: string;