Skip to content

Commit

Permalink
feat: ✨ vue3 版,新增提示词库,历史记录等
Browse files Browse the repository at this point in the history
  • Loading branch information
adams549659584 committed May 15, 2023
1 parent cf94832 commit a9c1144
Show file tree
Hide file tree
Showing 76 changed files with 12,742 additions and 1,302 deletions.
2 changes: 1 addition & 1 deletion .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"mode": "auto",
"program": "${workspaceFolder}",
"env": {
"PORT": "8888",
"PORT": "8899",
"Go_Proxy_BingAI_Debug": "true",
"Go_Proxy_BingAI_SOCKS_URL": "192.168.0.88:1070",
// "Go_Proxy_BingAI_SOCKS_USER": "xxx",
Expand Down
10 changes: 4 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@

⭐ 无需登录即可畅聊

⭐ 无单次对话次数限制

⭐ 需要画图等高级功能时,可登录微软账号设置用户 Cookie 进行体验

⭐ 遇到一切问题,先点左下角 ![新主题](./docs/img/bing-clear.png) 试试,不行使用刷新大法(Shift + F5 或 Ctrl + Shift + R 或 右上角设置中的重置),最终大招就 清理浏览器缓存 及 Cookie ,比如(24 小时限制、未登录提示等等)
Expand Down Expand Up @@ -72,7 +70,7 @@

- https://bing-vercel.vcanbb.top

- https://go-proxy-bingai-git-master-adams549659584.vercel.app
- https://go-proxy-bingai-adams549659584.vercel.app

### Render 搭建

Expand Down Expand Up @@ -187,8 +185,8 @@ RAILWAY_DOCKERFILE_PATH=docker/Dockerfile
## TODO

- [x] 撰写
- [ ] Vue3 重构
- [ ] 提示词
- [ ] 保存历史消息
- [x] Vue3 重构
- [x] 提示词
- [x] 历史聊条
- [ ] 导出消息到本地(Markdown、图片、PDF)
- [ ] 简单访问权限控制
244 changes: 244 additions & 0 deletions Taskfile.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,244 @@
version: '3'

vars:
BUILD_VERSION:
sh: git describe --tags
BUILD_DATE:
sh: date "+%F %T"
COMMIT_ID:
sh: git rev-parse HEAD

tasks:
clean:
cmds:
- rm -rf frontend/node_modules
- rm -rf release
# extended globbing is not supported
# - rm -rf web/!(web.go)
- cp web/web.go web.go
- rm -rf web/*
- mv web.go web/web.go
build_web:
dir: frontend
cmds:
# - pnpm build
- pnpm install && pnpm build
build_tpl:
label: build-{{.TASK}}
cmds:
- |
GOOS={{.GOOS}} GOARCH={{.GOARCH}} GOARM={{.GOARM}} GOMIPS={{.GOMIPS}} GOAMD64={{.GOAMD64}} \
go build -tags netgo -trimpath -o release/go_proxy_bingai_{{.TASK}} -ldflags \
"-w -s -X 'main.version={{.BUILD_VERSION}}' -X 'main.buildDate={{.BUILD_DATE}}' -X 'main.commitID={{.COMMIT_ID}}'"
linux_386:
cmds:
- task: build_tpl
vars: {
TASK: "{{.TASK}}",
GOOS: linux,
GOARCH: 386
}
linux_amd64:
cmds:
- task: build_tpl
vars: {
TASK: "{{.TASK}}",
GOOS: linux,
GOARCH: amd64
}
linux_amd64_v2:
cmds:
- task: build_tpl
vars: {
TASK: "{{.TASK}}",
GOOS: linux,
GOARCH: amd64,
GOAMD64: v2
}
linux_amd64_v3:
cmds:
- task: build_tpl
vars: {
TASK: "{{.TASK}}",
GOOS: linux,
GOARCH: amd64,
GOAMD64: v3
}
linux_amd64_v4:
cmds:
- task: build_tpl
vars: {
TASK: "{{.TASK}}",
GOOS: linux,
GOARCH: amd64,
GOAMD64: v4
}
linux_armv5:
cmds:
- task: build_tpl
vars: {
TASK: "{{.TASK}}",
GOOS: linux,
GOARCH: arm,
GOARM: 5
}
linux_armv6:
cmds:
- task: build_tpl
vars: {
TASK: "{{.TASK}}",
GOOS: linux,
GOARCH: arm,
GOARM: 6
}
linux_armv7:
cmds:
- task: build_tpl
vars: {
TASK: "{{.TASK}}",
GOOS: linux,
GOARCH: arm,
GOARM: 7
}
linux_armv8:
cmds:
- task: build_tpl
vars: {
TASK: "{{.TASK}}",
GOOS: linux,
GOARCH: arm64
}
linux_mips_hardfloat:
cmds:
- task: build_tpl
vars: {
TASK: "{{.TASK}}",
GOOS: linux,
GOARCH: mips,
GOMIPS: hardfloat
}
linux_mipsle_softfloat:
cmds:
- task: build_tpl
vars: {
TASK: "{{.TASK}}",
GOOS: linux,
GOARCH: mipsle,
GOMIPS: softfloat
}
linux_mipsle_hardfloat:
cmds:
- task: build_tpl
vars: {
TASK: "{{.TASK}}",
GOOS: linux,
GOARCH: mipsle,
GOMIPS: hardfloat
}
linux_mips64:
cmds:
- task: build_tpl
vars: {
TASK: "{{.TASK}}",
GOOS: linux,
GOARCH: mips64
}
linux_mips64le:
cmds:
- task: build_tpl
vars: {
TASK: "{{.TASK}}",
GOOS: linux,
GOARCH: mips64le
}
windows_386.exe:
cmds:
- task: build_tpl
vars: {
TASK: "{{.TASK}}",
GOOS: windows,
GOARCH: 386
}
windows_amd64.exe:
cmds:
- task: build_tpl
vars: {
TASK: "{{.TASK}}",
GOOS: windows,
GOARCH: amd64
}
windows_amd64_v2.exe:
cmds:
- task: build_tpl
vars: {
TASK: "{{.TASK}}",
GOOS: windows,
GOARCH: amd64,
GOAMD64: v2
}
windows_amd64_v3.exe:
cmds:
- task: build_tpl
vars: {
TASK: "{{.TASK}}",
GOOS: windows,
GOARCH: amd64,
GOAMD64: v3
}
windows_amd64_v4.exe:
cmds:
- task: build_tpl
vars: {
TASK: "{{.TASK}}",
GOOS: windows,
GOARCH: amd64,
GOAMD64: v4
}
darwin_amd64:
cmds:
- task: build_tpl
vars: {
TASK: "{{.TASK}}",
GOOS: darwin,
GOARCH: amd64,
}
darwin_arm64:
cmds:
- task: build_tpl
vars: {
TASK: "{{.TASK}}",
GOOS: darwin,
GOARCH: arm64,
}
docker:
cmds:
- docker build -t adams549659584/go-proxy-bingai:{{.BUILD_VERSION}} -f docker/Dockerfile .
- docker tag adams549659584/go-proxy-bingai:{{.BUILD_VERSION}} adams549659584/go-proxy-bingai
default:
cmds:
- task: clean
- task: build_web
- task: linux_386
- task: linux_amd64
- task: linux_amd64_v2
- task: linux_amd64_v3
- task: linux_amd64_v4
- task: linux_armv5
- task: linux_armv6
- task: linux_armv7
- task: linux_armv8
- task: linux_mips_hardfloat
- task: linux_mipsle_softfloat
- task: linux_mipsle_hardfloat
- task: linux_mips64
- task: linux_mips64le
- task: windows_386.exe
- task: windows_amd64.exe
- task: windows_amd64_v2.exe
- task: windows_amd64_v3.exe
- task: windows_amd64_v4.exe
- task: darwin_amd64
- task: darwin_arm64
release:
cmds:
- task: default
2 changes: 1 addition & 1 deletion api/web.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
)

func WebStatic(w http.ResponseWriter, r *http.Request) {
if _, ok := web.WEB_PATH_MAP[r.URL.Path]; ok {
if _, ok := web.WEB_PATH_MAP[r.URL.Path]; ok || r.URL.Path == common.PROXY_WEB_PREFIX_PATH {
http.StripPrefix(common.PROXY_WEB_PREFIX_PATH, http.FileServer(web.GetWebFS())).ServeHTTP(w, r)
} else {
common.NewSingleHostReverseProxy(common.BING_URL).ServeHTTP(w, r)
Expand Down
7 changes: 6 additions & 1 deletion common/proxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ var (
USER_TOKEN_COOKIE_NAME = "_U"
RAND_IP_COOKIE_NAME = "BingAI_Rand_IP"
PROXY_WEB_PREFIX_PATH = "/web/"
PROXY_WEB_PAGE_PATH = PROXY_WEB_PREFIX_PATH + "chat.html"
PROXY_WEB_PAGE_PATH = PROXY_WEB_PREFIX_PATH + "index.html"
)

func NewSingleHostReverseProxy(target *url.URL) *httputil.ReverseProxy {
Expand Down Expand Up @@ -150,6 +150,11 @@ func NewSingleHostReverseProxy(target *url.URL) *httputil.ReverseProxy {
}
}

// 跨域
res.Header.Set("Access-Control-Allow-Origin", "*")
res.Header.Set("Access-Control-Allow-Methods", "*")
res.Header.Set("Access-Control-Allow-Headers", "*")

return nil
}
errorHandler := func(res http.ResponseWriter, req *http.Request, err error) {
Expand Down
1 change: 1 addition & 0 deletions frontend/.env
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
VITE_BASE_API_URL=https://devbing.vcanbb.top
15 changes: 15 additions & 0 deletions frontend/.eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
/* eslint-env node */
require('@rushstack/eslint-patch/modern-module-resolution')

module.exports = {
root: true,
'extends': [
'plugin:vue/vue3-essential',
'eslint:recommended',
'@vue/eslint-config-typescript',
'@vue/eslint-config-prettier/skip-formatting'
],
parserOptions: {
ecmaVersion: 'latest'
}
}
28 changes: 28 additions & 0 deletions frontend/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
lerna-debug.log*

node_modules
.DS_Store
dist
dist-ssr
coverage
*.local

/cypress/videos/
/cypress/screenshots/

# Editor directories and files
.vscode/*
!.vscode/extensions.json
.idea
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?
9 changes: 9 additions & 0 deletions frontend/.prettierrc.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
module.exports = {
plugins: [require('prettier-plugin-tailwindcss')],
$schema: 'https://json.schemastore.org/prettierrc',
semi: true,
tabWidth: 2,
singleQuote: true,
printWidth: 100,
trailingComma: 'none',
};
9 changes: 9 additions & 0 deletions frontend/.vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"recommendations": [
"vue.volar",
"vue.vscode-typescript-vue-plugin",
"bradlc.vscode-tailwindcss",
"esbenp.prettier-vscode",
"dbaeumer.vscode-eslint"
]
}
Loading

0 comments on commit a9c1144

Please sign in to comment.