Skip to content

Commit

Permalink
修改服务器设置方式
Browse files Browse the repository at this point in the history
  • Loading branch information
LeafYeeXYZ committed Jul 25, 2024
1 parent c2b3840 commit 6d4035d
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 25 deletions.
8 changes: 2 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,8 @@
### Deploy Server
See [this project](https://github.com/LeafYeeXYZ/MyAPIs)

### Modify src/config.json
```javascript
{
"SERVER": "https://api.xxx.workers.dev", // Your server address
}
```
### Set Server URL
Set `VITE_SERVER` environment variable in `.env` file, `Vercel` or `Cloudflare Pages`, such as `https://api.xxx.workers.dev`

### Install Bun
Please refer to [Bun.sh](https://bun.sh). Or simply run `npm i -g bun`
Expand Down
9 changes: 2 additions & 7 deletions README_ZH_CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,8 @@
### 部署服务器
[这个项目](https://github.com/LeafYeeXYZ/MyAPIs)

### 修改配置
```javascript
// 修改 src/config.json
{
"SERVER": "https://api.xxx.workers.dev", // 你的服务器地址
}
```
### 设置服务器地址
`.env` 文件, `Vercel``Cloudflare Pages` 中设置 `VITE_SERVER` 环境变量, 如 `https://api.xxx.workers.dev`

### 安装 Bun
请参考 [Bun.sh](https://bun.sh). 或直接运行 `npm i -g bun`
Expand Down
9 changes: 2 additions & 7 deletions README_ZH_TW.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,8 @@
### 部署伺服器
[這個項目](https://github.com/LeafYeeXYZ/MyAPIs)

### 修改配置
```javascript
// 修改 src/config.json
{
"SERVER": "https://api.xxx.workers.dev", // 你的伺服器地址
}
```
### 設置伺服器地址
`.env` 文件, `Vercel``Cloudflare Pages` 中設置 `VITE_SERVER` 環境變量, 如 `https://api.xxx.workers.dev`

### 安裝 Bun
請參考 [Bun.sh](https://bun.sh). 或直接運行 `npm i -g bun`
Expand Down
3 changes: 2 additions & 1 deletion src/components/Prompt.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import '../styles/Prompt.css'
import { useRef, useState, useContext } from 'react'
import { LangContext } from '../lang.tsx'
import { SERVER } from '../config.json'
import getHash from '../libs/getHash.ts'
import getLoadingImage from '../libs/getLoadingImage.tsx'
import { blobToBase64 } from '../libs/base64_blob.ts'
Expand All @@ -10,6 +9,8 @@ import { Image } from './App.tsx'
import { flushSync } from 'react-dom'
import { LoadingOutlined } from '@ant-design/icons'

const SERVER: string = import.meta.env.VITE_SERVER as string ?? ''

// 获取模型列表
type Models = {
[key: string]: {
Expand Down
3 changes: 2 additions & 1 deletion src/components/Widgets/PromptGenerator.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import type { DialogAction } from '../../libs/useDialog'
import { SERVER } from '../../config.json'
import { useRef, useState, useContext } from 'react'
import { LoadingOutlined } from '@ant-design/icons'
import { flushSync } from 'react-dom'
Expand All @@ -11,6 +10,8 @@ interface PromptGeneratorProps {
promptRef: React.RefObject<HTMLTextAreaElement | null>
}

const SERVER: string = import.meta.env.VITE_SERVER as string ?? ''

export default function PromptGenerator({ status, dialogAction, promptRef }: PromptGeneratorProps) {

const t = useContext(LangContext)
Expand Down
3 changes: 0 additions & 3 deletions src/config.json

This file was deleted.

0 comments on commit 6d4035d

Please sign in to comment.