Compare commits
5 Commits
wenker
...
f0c16a3cd1
| Author | SHA1 | Date | |
|---|---|---|---|
|
f0c16a3cd1
|
|||
|
f54b192616
|
|||
|
b20de667a4
|
|||
|
a76cf224f6
|
|||
|
943cb5f392
|
27
.gitea/workflows/default.yml
Normal file
27
.gitea/workflows/default.yml
Normal file
@@ -0,0 +1,27 @@
|
||||
name: Build static content
|
||||
|
||||
on:
|
||||
# Runs on pushes targeting the default branch
|
||||
push:
|
||||
branches: ["master"]
|
||||
|
||||
# Allows you to run this workflow manually from the Actions tab
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- name: Use Node.js 18.x
|
||||
uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version: 18.x
|
||||
cache: 'npm'
|
||||
- run: npm install
|
||||
- run: npm run build
|
||||
- name: Upload artifact
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: dist-files
|
||||
path: './dist/'
|
||||
@@ -67,7 +67,7 @@ export interface ChatStore {
|
||||
logprobs: boolean;
|
||||
}
|
||||
|
||||
const _defaultAPIEndpoint = "/v1/chat/completions";
|
||||
const _defaultAPIEndpoint = "https://api.openai.com/v1/chat/completions";
|
||||
export const newChatStore = (
|
||||
apiKey = "",
|
||||
systemMessageContent = "",
|
||||
@@ -87,7 +87,7 @@ export const newChatStore = (
|
||||
image_gen_api = "https://api.openai.com/v1/images/generations",
|
||||
image_gen_key = "",
|
||||
json_mode = false,
|
||||
logprobs = true
|
||||
logprobs = false
|
||||
): ChatStore => {
|
||||
return {
|
||||
chatgpt_api_web_version: CHATGPT_API_WEB_VERSION,
|
||||
@@ -290,7 +290,7 @@ export function App() {
|
||||
chatStore.image_gen_api,
|
||||
chatStore.image_gen_key,
|
||||
chatStore.json_mode,
|
||||
chatStore.logprobs
|
||||
false // logprobs default to false
|
||||
)
|
||||
);
|
||||
setSelectedChatIndex(newKey as number);
|
||||
@@ -339,7 +339,7 @@ export function App() {
|
||||
<div className="flex flex-col h-full p-2 border-r-indigo-500 border-2 dark:border-slate-800 dark:border-r-indigo-500 dark:text-black">
|
||||
<div className="grow overflow-scroll">
|
||||
<button
|
||||
className="bg-violet-300 p-1 rounded hover:bg-violet-400"
|
||||
className="w-full bg-violet-300 p-1 rounded hover:bg-violet-400"
|
||||
onClick={handleNewChatStore}
|
||||
>
|
||||
{Tr("NEW")}
|
||||
|
||||
@@ -56,11 +56,24 @@ export default function ChatBOX(props: {
|
||||
const [showAddToolMsg, setShowAddToolMsg] = useState(false);
|
||||
const [newToolCallID, setNewToolCallID] = useState("");
|
||||
const [newToolContent, setNewToolContent] = useState("");
|
||||
let default_follow = localStorage.getItem("follow");
|
||||
if (default_follow === null) {
|
||||
default_follow = "true";
|
||||
}
|
||||
const [follow, _setFollow] = useState(default_follow === "true");
|
||||
const mediaRef = createRef();
|
||||
|
||||
const setFollow = (follow: boolean) => {
|
||||
console.log("set follow", follow);
|
||||
localStorage.setItem("follow", follow.toString());
|
||||
_setFollow(follow);
|
||||
};
|
||||
|
||||
const messagesEndRef = createRef();
|
||||
useEffect(() => {
|
||||
messagesEndRef.current.scrollIntoView({ behavior: "smooth" });
|
||||
if (follow) {
|
||||
messagesEndRef.current.scrollIntoView({ behavior: "smooth" });
|
||||
}
|
||||
}, [showRetry, showGenerating, generatingMessage]);
|
||||
|
||||
const client = new ChatGPT(chatStore.apiKey);
|
||||
@@ -804,6 +817,18 @@ export default function ChatBOX(props: {
|
||||
</div>
|
||||
)}
|
||||
|
||||
{generatingMessage && (
|
||||
<span
|
||||
class="p-2 m-2 rounded bg-white dark:text-black dark:bg-white dark:bg-opacity-50 dark:text-black dark:bg-opacity-50"
|
||||
style={{ textAlign: "right" }}
|
||||
onClick={() => {
|
||||
setFollow(!follow);
|
||||
}}
|
||||
>
|
||||
<label>Follow</label>
|
||||
<input type="checkbox" checked={follow} />
|
||||
</span>
|
||||
)}
|
||||
<div className="flex justify-between">
|
||||
{(chatStore.model.match("vision") ||
|
||||
(chatStore.image_gen_api && chatStore.image_gen_key)) && (
|
||||
|
||||
@@ -15,10 +15,62 @@ const models: Record<string, Model> = {
|
||||
maxToken: 16385,
|
||||
price: { prompt: 0.001 / 1000, completion: 0.002 / 1000 },
|
||||
},
|
||||
"gpt-3.5-turbo": {
|
||||
maxToken: 4096,
|
||||
price: { prompt: 0.0015 / 1000, completion: 0.002 / 1000 },
|
||||
},
|
||||
"gpt-3.5-turbo-16k": {
|
||||
maxToken: 16385,
|
||||
price: { prompt: 0.003 / 1000, completion: 0.004 / 1000 },
|
||||
},
|
||||
"gpt-3.5-turbo-0613": {
|
||||
maxToken: 4096,
|
||||
price: { prompt: 0.0015 / 1000, completion: 0.002 / 1000 },
|
||||
},
|
||||
"gpt-3.5-turbo-16k-0613": {
|
||||
maxToken: 16385,
|
||||
price: { prompt: 0.003 / 1000, completion: 0.004 / 1000 },
|
||||
},
|
||||
"gpt-3.5-turbo-0301": {
|
||||
maxToken: 4096,
|
||||
price: { prompt: 0.0015 / 1000, completion: 0.002 / 1000 },
|
||||
},
|
||||
"gpt-4-0125-preview": {
|
||||
maxToken: 128000,
|
||||
price: { prompt: 0.01 / 1000, completion: 0.03 / 1000 },
|
||||
},
|
||||
"gpt-4-turbo-preview": {
|
||||
maxToken: 128000,
|
||||
price: { prompt: 0.01 / 1000, completion: 0.03 / 1000 },
|
||||
},
|
||||
"gpt-4-1106-preview": {
|
||||
maxToken: 128000,
|
||||
price: { prompt: 0.01 / 1000, completion: 0.03 / 1000 },
|
||||
},
|
||||
"gpt-4-vision-preview": {
|
||||
maxToken: 128000,
|
||||
price: { prompt: 0.01 / 1000, completion: 0.03 / 1000 },
|
||||
},
|
||||
"gpt-4-1106-vision-preview": {
|
||||
maxToken: 128000,
|
||||
price: { prompt: 0.01 / 1000, completion: 0.03 / 1000 },
|
||||
},
|
||||
"gpt-4": {
|
||||
maxToken: 8192,
|
||||
price: { prompt: 0.03 / 1000, completion: 0.06 / 1000 },
|
||||
},
|
||||
"gpt-4-0613": {
|
||||
maxToken: 8192,
|
||||
price: { prompt: 0.03 / 1000, completion: 0.06 / 1000 },
|
||||
},
|
||||
"gpt-4-32k": {
|
||||
maxToken: 8192,
|
||||
price: { prompt: 0.06 / 1000, completion: 0.12 / 1000 },
|
||||
},
|
||||
"gpt-4-32k-0613": {
|
||||
maxToken: 8192,
|
||||
price: { prompt: 0.06 / 1000, completion: 0.12 / 1000 },
|
||||
},
|
||||
};
|
||||
|
||||
export const defaultModel = "gpt-3.5-turbo-0125";
|
||||
|
||||
Reference in New Issue
Block a user