Skip to content

Commit

Permalink
Merge upstream/main into main
Browse files Browse the repository at this point in the history
  • Loading branch information
lopins committed Oct 5, 2024
2 parents b6a9446 + 640bf8d commit 7f675af
Show file tree
Hide file tree
Showing 5 changed files with 62 additions and 13 deletions.
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@ By simplifying the structure and key functions, developers can quickly set up an
## How to use

### Option 1: Goto demo [AIQL](https://chat.aiql.com/)

> The demo will use `Llama 3.1` by default
> The demo will use `Qwen 2.5` by default
### Option 2: Download [Index](./index.html) and open it locally (recommended)

Expand Down
1 change: 1 addition & 0 deletions example/config/chatgpt.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"url": "https://api.openai.com",
"path": "/v1/chat/completions",
"model": "gpt-4o-mini",
"max_tokens_type": "max_completion_tokens",
"max_tokens_value": ""
},
"defaultChoiceStore": {
Expand Down
1 change: 1 addition & 0 deletions example/config/chatgptproxy.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"url": "https://api.aiql.com",
"path": "/v1/chat/completions",
"model": "gpt-4o-mini",
"max_tokens_type": "max_completion_tokens",
"max_tokens_value": ""
},
"defaultChoiceStore": {
Expand Down
4 changes: 3 additions & 1 deletion example/config/deepinfra.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,15 @@
},
"defaultChoiceStore": {
"model": [
"meta-llama/Llama-3.2-11B-Vision-Instruct",
"meta-llama/Llama-3.2-90B-Vision-Instruct",
"meta-llama/Meta-Llama-3.1-70B-Instruct",
"meta-llama/Meta-Llama-3.1-405B-Instruct",
"meta-llama/Meta-Llama-3.1-8B-Instruct",
"mistralai/Mistral-7B-Instruct-v0.3",
"mistralai/Mistral-Nemo-Instruct-2407",
"01-ai/Yi-34B-Chat",
"Qwen/Qwen2-72B-Instruct"
"Qwen/Qwen2.5-72B-Instruct"
]
}
}
66 changes: 56 additions & 10 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@
}

#lottie {
height: calc(95vh - 20px);
height: calc(99vh - 50px);
max-height: calc(100% - 100px);
}

Expand Down Expand Up @@ -339,6 +339,7 @@
<template v-slot:append>
<v-card-actions>
<v-spacer></v-spacer>
<v-btn color="primary" icon="mdi-download" @click="historyStore.downloadHistory"></v-btn>
<v-btn color="error" icon="mdi-delete-off-outline" @click="historyStore.resetState"></v-btn>
</v-card-actions>
</template>
Expand Down Expand Up @@ -381,7 +382,7 @@
<template v-slot:append>
<v-card-actions>
<v-spacer></v-spacer>
<v-btn color="error" icon="mdi-delete-off-outline" @click="chatbotStore.resetState"></v-btn>
<v-btn color="error" icon="mdi-refresh" @click="chatbotStore.resetState"></v-btn>
</v-card-actions>
</template>

Expand Down Expand Up @@ -455,6 +456,16 @@
{{ chatbotStore.max_tokens_value ? chatbotStore.max_tokens_value :
"default" }}
</v-chip>
<v-chip label color="primary" class="ma-1">
{{"temperature: "}}
{{ chatbotStore.temperature ? chatbotStore.temperature :
"default" }}
</v-chip>
<v-chip label color="primary" class="ma-1">
{{"top_p: "}}
{{ chatbotStore.top_p ? chatbotStore.top_p :
"default" }}
</v-chip>
<v-chip label color="primary" class="ma-1">
{{ chatbotStore.authPrefix }}
</v-chip>
Expand Down Expand Up @@ -484,6 +495,17 @@
variant="outlined">
</v-combobox>
</v-row>
<v-row class="px-3 mt-0 mb-0">
<v-combobox class="px-2" density='compact' label="Temperature"
:items="defaultChoiceStore.temperature" type='number'
v-model="chatbotStore.temperature" variant="outlined"
:rules="[value => !isNaN(value) && parseFloat(value) >= 0 && parseFloat(value) <= 2]">
</v-combobox>
<v-combobox class="px-2" density='compact' label="Top P"
v-model="chatbotStore.top_p" type='number' variant="outlined"
:rules="[value => !isNaN(value) && parseFloat(value) >= 0 && parseFloat(value) <= 1]">
</v-combobox>
</v-row>
<v-combobox class="px-2" density='compact' label="ContentType"
v-model="chatbotStore.contentType" variant="outlined">
</v-combobox>
Expand Down Expand Up @@ -982,6 +1004,15 @@ <h5 class="font-weight-bold">{{ column.key }}</h5>
return "grey"
}

},
downloadHistory() {
const blob = new Blob([JSON.stringify(this.conversation, null, 2)], { type: 'application/json' });
const url = URL.createObjectURL(blob);
const a = document.createElement('a');
a.href = url;
a.download = 'history.json';
a.click();
URL.revokeObjectURL(url);
}

}
Expand All @@ -1006,15 +1037,17 @@ <h5 class="font-weight-bold">{{ column.key }}</h5>
model: [
"gpt-4o-mini",
"gpt-4o",
'gpt-4-turbo',
"gpt-4-turbo",
"Qwen/Qwen2.5-72B-Instruct",
"meta-llama/Llama-3.2-11B-Vision-Instruct",
"meta-llama/Llama-3.2-90B-Vision-Instruct",
"meta-llama/Meta-Llama-3.1-70B-Instruct",
"meta-llama/Meta-Llama-3.1-405B-Instruct",
"meta-llama/Meta-Llama-3.1-8B-Instruct",
"mistralai/Mistral-7B-Instruct-v0.3",
"mistralai/Mistral-Nemo-Instruct-2407",
'Qwen/Qwen2-72B-Instruct'],
],
authPrefix: ["Bearer", "Base", "Token"],
max_tokens_type: ["max_tokens", "max_new_tokens"],
max_tokens_type: ["max_tokens", "max_completion_tokens", "max_new_tokens"],
}),
persist: {
enabled: true,
Expand All @@ -1039,11 +1072,13 @@ <h5 class="font-weight-bold">{{ column.key }}</h5>
apiKey: "",
url: "https://api2.aiql.com",
path: "/chat/completions",
model: "meta-llama/Meta-Llama-3.1-70B-Instruct",
model: "Qwen/Qwen2.5-72B-Instruct",
authPrefix: "Bearer",
contentType: "application/json",
max_tokens_type: "max_tokens",
max_tokens_value: "32000",
temperature: "",
top_p: "",
method: "POST",
stream: true
}),
Expand Down Expand Up @@ -1094,6 +1129,14 @@ <h5 class="font-weight-bold">{{ column.key }}</h5>
body[chatbotStore.max_tokens_type] = parseInt(chatbotStore.max_tokens_value)
}

if (chatbotStore.temperature) {
body["temperature"] = parseFloat(chatbotStore.temperature)
}

if (chatbotStore.top_p) {
body["top_p"] = parseFloat(chatbotStore.top_p)
}

const request = {
headers: headers,
method: chatbotStore.method,
Expand All @@ -1110,10 +1153,13 @@ <h5 class="font-weight-bold">{{ column.key }}</h5>
// Handle errors
if (!completion.ok) {
const errorData = await completion.json();
console.log(errorData.error?.message);
if (errorData.error?.message)
snackbarStore.showErrorMessage(errorData.error.message);
snackbarStore.showErrorMessage(`${completion.status}: ${errorData.error.message}`);
else if (errorData.detail[0]?.msg)
snackbarStore.showErrorMessage(`${completion.status}${(" - " + errorData.detail[0]?.loc + ":") || ":"} ${errorData.detail[0]?.msg}`);
else
snackbarStore.showErrorMessage(`${completion.status} ${completion.statusText}`);
snackbarStore.showErrorMessage(`${completion.status}: ${completion.statusText}`);
return;
}

Expand Down Expand Up @@ -1383,4 +1429,4 @@ <h5 class="font-weight-bold">{{ column.key }}</h5>
</script>
</body>

</html>
</html>

0 comments on commit 7f675af

Please sign in to comment.