Skip to content

Commit

Permalink
re-add 1106 quickfix
Browse files Browse the repository at this point in the history
  • Loading branch information
jackschedel committed Jan 30, 2024
1 parent b57b0f8 commit ed7d7c8
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/components/ConfigMenu/ModelSelect.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ export const ModelSelect = ({
switch (m) {
case 'gpt-4':
case 'gpt-4-32k':
case 'gpt-4-1106-preview':
case 'gpt-4-turbo-preview':
case 'gpt-3.5-turbo':
case 'gpt-3.5-turbo-16k':
Expand Down
8 changes: 7 additions & 1 deletion src/components/TokenCount/TokenCount.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import React, { useEffect, useMemo, useState } from 'react';
import useStore from '@store/store';
import { shallow } from 'zustand/shallow';
import { ModelChoice } from '@type/chat';

Check failure

Code scanning / ESLint

Disallow unused variables Error

'ModelChoice' is defined but never used.

import countTokens from '@utils/messageUtils';
import { modelCost } from '@constants/chat';
Expand All @@ -15,12 +16,17 @@ const TokenCount = React.memo(() => {
shallow
);

const model = useStore((state) =>
let model = useStore((state) =>
state.chats
? state.chats[state.currentChatIndex].config.model
: 'gpt-3.5-turbo'
);

// stop modelcount null index if bad model value (i.e. from 2.0.9)
if (!model) {
model = 'gpt-3.5-turbo';
}

const cost = useMemo(() => {
const price =
modelCost[model].prompt.price *
Expand Down
6 changes: 6 additions & 0 deletions src/constants/chat.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ Respond using Markdown.`;
export const modelOptions: ModelChoice[] = [
'gpt-3.5-turbo',
'gpt-3.5-turbo-16k',
'gpt-4-1106-preview',
'gpt-4-turbo-preview',
'gpt-4',
'gpt-4-32k',
Expand All @@ -32,6 +33,7 @@ export const modelMaxToken = {
'gpt-4': 8192,
'gpt-4-0314': 8192,
'gpt-4-0613': 8192,
'gpt-4-1106-preview': 128000,
'gpt-4-turbo-preview': 128000,
'gpt-4-32k': 32768,
'gpt-4-32k-0314': 32768,
Expand Down Expand Up @@ -77,6 +79,10 @@ export const modelCost = {
prompt: { price: 0.03, unit: 1000 },
completion: { price: 0.06, unit: 1000 },
},
'gpt-4-1106-preview': {
prompt: { price: 0.01, unit: 1000 },
completion: { price: 0.03, unit: 1000 },
},
'gpt-4-turbo-preview': {
prompt: { price: 0.01, unit: 1000 },
completion: { price: 0.03, unit: 1000 },
Expand Down
1 change: 1 addition & 0 deletions src/types/chat.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ export type ModelChoice =
| 'gpt-4'
| 'gpt-4-0314'
| 'gpt-4-0613'
| 'gpt-4-1106-preview'
| 'gpt-4-turbo-preview'
| 'gpt-4-32k'
| 'gpt-4-32k-0314'
Expand Down

0 comments on commit ed7d7c8

Please sign in to comment.