Skip to content

Commit 2d723b0

Browse files
committed
version 0.1.0
1 parent 6c380f6 commit 2d723b0

File tree

10 files changed

+223
-0
lines changed

10 files changed

+223
-0
lines changed

README.md

+29
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,32 @@ ChatGPT page with API instand of offical pages.
33

44
基于ChatGPT API的网页,避免出现无法登录而无法使用的情况。
55

6+
7+
8+
This template should help get you started developing with Vue 3 in Vite.
9+
10+
## Recommended IDE Setup
11+
12+
[VSCode](https://code.visualstudio.com/) + [Volar](https://marketplace.visualstudio.com/items?itemName=Vue.volar) (and disable Vetur) + [TypeScript Vue Plugin (Volar)](https://marketplace.visualstudio.com/items?itemName=Vue.vscode-typescript-vue-plugin).
13+
14+
## Customize configuration
15+
16+
See [Vite Configuration Reference](https://vitejs.dev/config/).
17+
18+
## Project Setup
19+
20+
```sh
21+
npm install
22+
```
23+
24+
### Compile and Hot-Reload for Development
25+
26+
```sh
27+
npm run dev
28+
```
29+
30+
### Compile and Minify for Production
31+
32+
```sh
33+
npm run build
34+
```

chatgpt-web/.gitignore

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# Logs
2+
logs
3+
*.log
4+
npm-debug.log*
5+
yarn-debug.log*
6+
yarn-error.log*
7+
pnpm-debug.log*
8+
lerna-debug.log*
9+
10+
node_modules
11+
.DS_Store
12+
dist
13+
dist-ssr
14+
coverage
15+
*.local
16+
17+
/cypress/videos/
18+
/cypress/screenshots/
19+
20+
# Editor directories and files
21+
.vscode/*
22+
!.vscode/extensions.json
23+
.idea
24+
*.suo
25+
*.ntvs*
26+
*.njsproj
27+
*.sln
28+
*.sw?

chatgpt-web/.vscode/extensions.json

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"recommendations": ["Vue.volar", "Vue.vscode-typescript-vue-plugin"]
3+
}

chatgpt-web/README.md

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# chatgpt-web
2+
3+
This template should help get you started developing with Vue 3 in Vite.
4+
5+
## Recommended IDE Setup
6+
7+
[VSCode](https://code.visualstudio.com/) + [Volar](https://marketplace.visualstudio.com/items?itemName=Vue.volar) (and disable Vetur) + [TypeScript Vue Plugin (Volar)](https://marketplace.visualstudio.com/items?itemName=Vue.vscode-typescript-vue-plugin).
8+
9+
## Customize configuration
10+
11+
See [Vite Configuration Reference](https://vitejs.dev/config/).
12+
13+
## Project Setup
14+
15+
```sh
16+
npm install
17+
```
18+
19+
### Compile and Hot-Reload for Development
20+
21+
```sh
22+
npm run dev
23+
```
24+
25+
### Compile and Minify for Production
26+
27+
```sh
28+
npm run build
29+
```

chatgpt-web/index.html

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8">
5+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
6+
<title>ChatGPT-Web</title>
7+
</head>
8+
<body>
9+
<a href="https://github.com/SmileBuild/ChatGPT-Web">Version 0.1.0</a>
10+
<div id="app"></div>
11+
<script type="module" src="/src/main.js"></script>
12+
</body>
13+
</html>

chatgpt-web/package.json

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
{
2+
"name": "chatgpt-web",
3+
"version": "0.0.0",
4+
"private": true,
5+
"scripts": {
6+
"dev": "vite",
7+
"build": "vite build",
8+
"preview": "vite preview"
9+
},
10+
"dependencies": {
11+
"axios": "^1.2.6",
12+
"vue": "^3.2.45"
13+
},
14+
"devDependencies": {
15+
"@vitejs/plugin-vue": "^4.0.0",
16+
"vite": "^4.0.0"
17+
}
18+
}

chatgpt-web/src/App.vue

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<template>
2+
<MainPage />
3+
</template>
4+
5+
<script>
6+
import MainPage from './components/MainPage.vue'
7+
8+
export default {
9+
name: 'App',
10+
components: {
11+
MainPage
12+
}
13+
}
14+
</script>
+70
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
<template>
2+
<div>
3+
<form>
4+
<label>Key</label>
5+
<input type="text" v-model="key"/>
6+
<label>Prompt:</label>
7+
<textarea type="text" v-model="prompt" rows="20" cols="50"></textarea>
8+
<label>Temperature:</label>
9+
<input v-model="temperature" type="number" min="0" max="1" step="0.1" />
10+
<label>Top P:</label>
11+
<input v-model="top_p" type="number" min="0" max="1" step="0.1" />
12+
<label>Model:</label>
13+
<select v-model="model">
14+
<option v-for="m in models" :value="m">{{ m }}</option>
15+
</select>
16+
</form>
17+
<button @click="submitForm">Confirm</button>
18+
<p style="color:red;white-space: pre-wrap;">{{response}}</p>
19+
</div>
20+
</template>
21+
22+
23+
<script>
24+
import axios from 'axios'
25+
export default {
26+
name: 'MainPage',
27+
data() {
28+
return {
29+
key: '',
30+
prompt: '',
31+
temperature: 0.7,
32+
top_p: 1,
33+
max_tokens: 2048,
34+
frequency_penalty: 0,
35+
presence_penalty: 0.6,
36+
stop:["Human:","AI:"],
37+
model: 'text-davinci-003',
38+
models: ['text-davinci-003','text-davinci-002', 'text-curie-001'],
39+
response: ''
40+
}
41+
},
42+
methods: {
43+
submitForm() {
44+
let data = {
45+
prompt: this.prompt,
46+
temperature: this.temperature,
47+
top_p: this.top_p,
48+
model: this.model,
49+
max_tokens: this.max_tokens,
50+
frequency_penalty: this.frequency_penalty,
51+
presence_penalty: this.presence_penalty,
52+
stop:this.stop
53+
}
54+
axios.post('https://api.openai.com/v1/completions', data, {
55+
headers: {
56+
'Content-Type': 'application/json',
57+
'Authorization': `Bearer `+ this.key,
58+
}
59+
})
60+
.then(response => {
61+
this.response = response.data.choices[0].text;
62+
console.log(this.response)
63+
})
64+
.catch(error => {
65+
console.log(error);
66+
});
67+
}
68+
}
69+
}
70+
</script>

chatgpt-web/src/main.js

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import { createApp } from 'vue'
2+
import App from './App.vue'
3+
4+
5+
createApp(App).mount('#app')

chatgpt-web/vite.config.js

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import { fileURLToPath, URL } from 'node:url'
2+
3+
import { defineConfig } from 'vite'
4+
import vue from '@vitejs/plugin-vue'
5+
6+
// https://vitejs.dev/config/
7+
export default defineConfig({
8+
plugins: [vue()],
9+
resolve: {
10+
alias: {
11+
'@': fileURLToPath(new URL('./src', import.meta.url))
12+
}
13+
}
14+
})

0 commit comments

Comments
 (0)