Compare commits
7 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
98e75c0c5c | ||
|
|
06fd5a861c | ||
|
|
fc0d2073aa | ||
|
|
2c816afbd2 | ||
|
|
1bf2399a45 | ||
|
|
ddec57f562 | ||
|
|
63af4a8e97 |
11
CHANGELOG.md
11
CHANGELOG.md
@@ -1,3 +1,14 @@
|
||||
## v1.0.5
|
||||
|
||||
`2023-02-12`
|
||||
|
||||
### Enhancement
|
||||
- 输入框焦点,连续提交
|
||||
|
||||
### BugFix
|
||||
- 修复信息框样式问题
|
||||
- 修复中文输入法提交问题
|
||||
|
||||
## v1.0.4
|
||||
|
||||
`2023-02-11`
|
||||
|
||||
39
README.en.md
Normal file
39
README.en.md
Normal file
@@ -0,0 +1,39 @@
|
||||
# ChatGPT Web Bot
|
||||
|
||||
[中文](./README.md) | English
|
||||
|
||||
ChartGPT demo page built with express and vue3
|
||||
|
||||

|
||||
|
||||
## Usage
|
||||
> Make sure `node >= 18`
|
||||
|
||||
If pnpm is not installed
|
||||
```shell
|
||||
npm install pnpm -g
|
||||
```
|
||||
|
||||
install node deps
|
||||
```shell
|
||||
pnpm install
|
||||
```
|
||||
|
||||
Sign up for an [OpenAI API key](https://platform.openai.com/overview) and store it in your environment.
|
||||
|
||||
```
|
||||
# .env
|
||||
OPENAI_API_KEY="Your Key"
|
||||
```
|
||||
|
||||
Run service
|
||||
```shell
|
||||
pnpm run service
|
||||
```
|
||||
|
||||
Run web
|
||||
```shell
|
||||
pnpm run dev
|
||||
```
|
||||
|
||||
## License
|
||||
19
README.md
19
README.md
@@ -1,36 +1,37 @@
|
||||
# ChatGPT Web Bot
|
||||
|
||||
English | [中文](./README.zh-CN.md)
|
||||
中文 | [English](./README.en.md)
|
||||
|
||||
ChartGPT demo page built with express and vue3
|
||||
使用 express 和 vue3 搭建的 ChartGPT 演示网页
|
||||
|
||||

|
||||
## Usage
|
||||
> Make sure `node >= 18`
|
||||
|
||||
If pnpm is not installed
|
||||
## 使用
|
||||
> 确保 `node >= 18`
|
||||
|
||||
如果你没有安装过 `pnpm`
|
||||
```shell
|
||||
npm install pnpm -g
|
||||
```
|
||||
|
||||
install node deps
|
||||
安装依赖
|
||||
```shell
|
||||
pnpm install
|
||||
```
|
||||
|
||||
Sign up for an [OpenAI API key](https://platform.openai.com/overview) and store it in your environment.
|
||||
获取 [OpenAI API key](https://platform.openai.com/overview) 到本地环境变量
|
||||
|
||||
```
|
||||
# .env
|
||||
OPENAI_API_KEY="Your Key"
|
||||
```
|
||||
|
||||
Run service
|
||||
运行服务
|
||||
```shell
|
||||
pnpm run service
|
||||
```
|
||||
|
||||
Run web
|
||||
运行网页
|
||||
```shell
|
||||
pnpm run dev
|
||||
```
|
||||
|
||||
@@ -1,40 +0,0 @@
|
||||
# ChatGPT Web Bot
|
||||
|
||||
[English](./README.md) | 中文
|
||||
|
||||
使用 express 和 vue3 搭建的 ChartGPT 演示网页
|
||||
|
||||

|
||||
|
||||
## 使用
|
||||
> Make sure `node >= 18`
|
||||
|
||||
如果你没有安装过 `pnpm`
|
||||
```shell
|
||||
npm install pnpm -g
|
||||
```
|
||||
|
||||
安装依赖
|
||||
```shell
|
||||
pnpm install
|
||||
```
|
||||
|
||||
获取 [OpenAI API key](https://platform.openai.com/overview) 到本地环境变量
|
||||
|
||||
```
|
||||
# .env
|
||||
OPENAI_API_KEY="Your Key"
|
||||
```
|
||||
|
||||
运行服务
|
||||
```shell
|
||||
pnpm run service
|
||||
```
|
||||
|
||||
运行网页
|
||||
```shell
|
||||
pnpm run dev
|
||||
```
|
||||
|
||||
## License
|
||||
MIT © [ChenZhaoYu](./license)
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "chatgpt-web",
|
||||
"version": "1.0.4",
|
||||
"version": "1.0.5",
|
||||
"private": false,
|
||||
"description": "ChatGPT Web Bot",
|
||||
"author": "ChenZhaoYu <chenzhaoyu1994@gami.com>",
|
||||
|
||||
6
pnpm-lock.yaml
generated
6
pnpm-lock.yaml
generated
@@ -1412,8 +1412,8 @@ packages:
|
||||
fsevents: 2.3.2
|
||||
dev: true
|
||||
|
||||
/ci-info/3.7.1:
|
||||
resolution: {integrity: sha512-4jYS4MOAaCIStSRwiuxc4B8MYhIe676yO1sYGzARnjXkWpmzZMMYxY6zu8WYWDhSuth5zhrQ1rhNSibyyvv4/w==}
|
||||
/ci-info/3.8.0:
|
||||
resolution: {integrity: sha512-eXTggHWSooYhq49F2opQhuHWgzucfF2YgODK4e1566GQs5BIfP30B0oenwBJHfWxAs2fyPB1s7Mg949zLf61Yw==}
|
||||
engines: {node: '>=8'}
|
||||
dev: true
|
||||
|
||||
@@ -2030,7 +2030,7 @@ packages:
|
||||
dependencies:
|
||||
'@babel/helper-validator-identifier': 7.19.1
|
||||
'@eslint-community/eslint-utils': 4.1.2_eslint@8.34.0
|
||||
ci-info: 3.7.1
|
||||
ci-info: 3.8.0
|
||||
clean-regexp: 1.0.0
|
||||
eslint: 8.34.0
|
||||
esquery: 1.4.0
|
||||
|
||||
@@ -19,7 +19,7 @@ defineProps<Props>()
|
||||
>
|
||||
<Avatar :image="reversal" />
|
||||
</div>
|
||||
<div class="flex flex-col flex-1 text-sm" :class="[{ 'items-end': reversal }]">
|
||||
<div class="flex flex-col flex-1 text-sm" :class="[reversal ? 'items-end' : 'items-start']">
|
||||
<span class="text-xs text-[#b4bbc4]">
|
||||
{{ dateTime }}
|
||||
</span>
|
||||
|
||||
@@ -15,7 +15,7 @@ const scrollRef = ref<HTMLDivElement>()
|
||||
|
||||
const ms = useMessage()
|
||||
|
||||
const value = ref('')
|
||||
const prompt = ref('')
|
||||
|
||||
const loading = ref(false)
|
||||
|
||||
@@ -45,17 +45,19 @@ function handleEnter(event: KeyboardEvent) {
|
||||
}
|
||||
|
||||
async function handleSubmit() {
|
||||
if (!value.value) {
|
||||
const message = prompt.value.trim()
|
||||
|
||||
if (!message || !message.length) {
|
||||
ms.warning('Please enter a message')
|
||||
return
|
||||
}
|
||||
|
||||
addMessage(value.value, true)
|
||||
addMessage(message, true)
|
||||
prompt.value = ''
|
||||
|
||||
try {
|
||||
loading.value = true
|
||||
const { text } = await fetchChatAPI(value.value)
|
||||
value.value = ''
|
||||
const { text } = await fetchChatAPI(message)
|
||||
addMessage(text, false)
|
||||
}
|
||||
catch (error: any) {
|
||||
@@ -104,7 +106,7 @@ function addMessage(message: string, reversal = false) {
|
||||
</main>
|
||||
<footer class="p-4">
|
||||
<div class="flex items-center justify-between space-x-2">
|
||||
<NInput v-model:value="value" :disabled="loading" placeholder="Type a message..." @keyup="handleEnter" />
|
||||
<NInput v-model:value="prompt" placeholder="Type a message..." @keypress="handleEnter" />
|
||||
<NButton type="primary" :loading="loading" @click="handleSubmit">
|
||||
<template #icon>
|
||||
<Icon icon="ri:send-plane-fill" />
|
||||
|
||||
Reference in New Issue
Block a user