Skip to content

Commit

Permalink
Merge pull request #2 from ZhiShuYun/germey/resolve
Browse files Browse the repository at this point in the history
Apply latest feature changes
  • Loading branch information
Germey authored Feb 26, 2024
2 parents e34abaa + 60d094b commit d98cc42
Show file tree
Hide file tree
Showing 53 changed files with 2,902 additions and 34 deletions.
3 changes: 2 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -71,5 +71,6 @@
},
"[json]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
}
},
"cSpell.words": ["Chatdoc"]
}
42 changes: 36 additions & 6 deletions CHANGELOG.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,46 @@
"name": "@acedatacloud/hub",
"entries": [
{
"date": "Tue, 09 Jan 2024 19:15:08 GMT",
"date": "Mon, 29 Jan 2024 16:17:58 GMT",
"version": "1.0.1",
"tag": "@zhishuyun/hub_v1.0.1",
"comments": {
"patch": [
{
"author": "[email protected]",
"package": "@zhishuyun/hub",
"commit": "5c925f97128e2fa12efe0e9f8d151419d1203dc3",
"comment": "fix chatdoc upload issue"
}
]
}
},
{
"date": "Sun, 28 Jan 2024 07:24:49 GMT",
"version": "1.0.0",
"tag": "@zhishuyun/hub_v1.0.0",
"comments": {
"major": [
{
"author": "[email protected]",
"package": "@zhishuyun/hub",
"commit": "1a7fc4a59a1eeb11bbcdd668ff7fc325f940f5f0",
"comment": "add chatdoc feature"
}
]
}
},
{
"date": "Sun, 21 Jan 2024 03:37:14 GMT",
"version": "0.12.2",
"tag": "@acedatacloud/hub_v0.12.2",
"tag": "@zhishuyun/hub_v0.12.2",
"comments": {
"patch": [
{
"author": "[email protected]",
"package": "@acedatacloud/hub",
"commit": "f64be98a29b799cbce18c8b7c13e3385c7d065b3",
"comment": "migrate to acedata"
"author": "[email protected]",
"package": "@zhishuyun/hub",
"commit": "1dc324c35c1c9cf9b533a9e75eff8a25fda59f95",
"comment": "add docs for docker deploy"
}
]
}
Expand Down
22 changes: 19 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,32 @@
# Change Log - @acedatacloud/hub

This log was last generated on Tue, 09 Jan 2024 19:15:08 GMT and should not be manually modified.
This log was last generated on Mon, 29 Jan 2024 16:17:58 GMT and should not be manually modified.

<!-- Start content -->

## 1.0.1

Mon, 29 Jan 2024 16:17:58 GMT

### Patches

- fix chatdoc upload issue ([email protected])

## 1.0.0

Sun, 28 Jan 2024 07:24:49 GMT

### Major changes

- add chatdoc feature ([email protected])

## 0.12.2

Tue, 09 Jan 2024 19:15:08 GMT
Sun, 21 Jan 2024 03:37:14 GMT

### Patches

- migrate to acedata ([email protected])
- add docs for docker deploy ([email protected])

## 0.12.1

Expand Down
109 changes: 109 additions & 0 deletions docs/deploy/Docker.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
# Docker Deployment

## Requirements

Install [Docker](https://www.docker.com/), to ensure you can execute `docker` command:

```
$ docker
Usage: docker [OPTIONS] COMMAND
A self-sufficient runtime for containers
Common Commands:
run Create and run a new container from an image
exec Execute a command in a running container
ps List containers
build Build an image from a Dockerfile
pull Download an image from a registry
push Upload an image to a registry
...
```

## Login to Docker

Register an account in [Docker Hub](https://hub.docker.com/), then use command to login:

```
docker login
```

Then enter your username and password to login, then you will see like:

```
Login Succeeded
```

## Build with Docker

```
docker build -t <username>/<image> .
```

Replace `<username>` to your username in Docker Hub, and replace `<image>` with any name you want as the image name, like:

```
docker build -t foobar/hub .
```

Then you will see like this:

```
[+] Building 5.9s (8/16) docker:desktop-linux
=> [build-stage 1/6] FROM docker.io/library/node:18@sha256:995a5f4314885452a4a785abc25a0fec40e26c346559e11e709d58bb7a927c 2.0s
=> => resolve docker.io/library/node:18@sha256:995a5f4314885452a4a785abc25a0fec40e26c346559e11e709d58bb7a927cf4 0.0s
=> => sha256:30d85599795460b2d9d24c6b87c53ec60555b601705cc83bea31632240500980 0B / 64.14MB 2.0s
=> => sha256:995a5f4314885452a4a785abc25a0fec40e26c346559e11e709d58bb7a927cf4 1.21kB / 1.21kB 0.0s
=> => sha256:084b3c822003a20d41f793237286e112d1b5a1c0c7b8b04cb53a17a963a76ed7 2.00kB / 2.00kB 0.0s
=> => sha256:ef847f8b5ae3554df13851034f22683a8b9aef31b3659033211775d8d6cb6b79 7.34kB / 7.34kB
...
=> [build-stage 4/6] RUN yarn 83.5s
=> [build-stage 5/6] COPY . . 0.3s
=> [build-stage 6/6] RUN yarn build 16.3s
=> [production-stage 2/3] COPY --from=build-stage /app/dist /usr/share/nginx/html 0.0s
=> [production-stage 3/3] COPY nginx.conf /etc/nginx/conf.d/default.conf 0.0s
=> exporting to image 0.0s
=> => exporting layers 0.0s
=> => writing image sha256:f4e06895b43560b3cd43970c8942f35d56643959de5272eebee1a887a1b7798a 0.0s
=> => naming to docker.io/germey/hub
```

## Push Docker

```
docker push <username>/<image>
```

Now you have pushed your image to Docker Hub, then you can deploy this image to any server.

## Deploy Docker

In your server machine, you can then pull this image and then run it

```
docker run -d -p 8000:80 <username>/<image>
```

Then visit [http://localhost:8000](http://localhost:8000) you will see it.

## Configure HTTPS

If you want to configure HTTPS and domain, like example.abc.com, you can install Nginx to forward the traffic from Docker:

Apply the HTTPS cert for your domain, you will have 2 files, one is cert, the other is private key, like `example.abc.com.pem` and `example.abc.com.key`, change the nginx conf file as below:

```
server {
listen 443;
server_name example.abc.com;
ssl_certificate /path/to/your/example.abc.com.pem;
ssl_certificate_key /path/to/your/example.abc.com.key;
location / {
proxy_pass http://127.0.0.1:8000;
}
}
```

Also please set the Domain to server's ip address, then restart nginx, it will work.
8 changes: 3 additions & 5 deletions src/components/chat/Message.vue
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ import AnsweringMark from './AnsweringMark.vue';
import copy from 'copy-to-clipboard';
import { ElAlert, ElButton } from 'element-plus';
import MarkdownRenderer from '@/components/common/MarkdownRenderer.vue';
import { IApplication, IChatMessage, IChatMessageState, ROLE_ASSISTANT } from '@/operators';
import { IApplication, IChatMessage, IChatMessageState } from '@/operators';
import CopyToClipboard from '../common/CopyToClipboard.vue';
import {
ERROR_CODE_API_ERROR,
Expand All @@ -43,7 +43,8 @@ import {
ERROR_CODE_TIMEOUT,
ERROR_CODE_TOO_MANY_REQUESTS,
ERROR_CODE_UNKNOWN,
ERROR_CODE_USED_UP
ERROR_CODE_USED_UP,
ROLE_ASSISTANT
} from '@/constants';
import message from '@/i18n/zh/common/message';
import { ROUTE_CONSOLE_APPLICATION_BUY } from '@/router';
Expand Down Expand Up @@ -125,9 +126,6 @@ export default defineComponent({
}
});
}
// onStop() {
// this.$emit('stop');
// }
}
});
</script>
Expand Down
40 changes: 40 additions & 0 deletions src/components/chatdoc/AnsweringMark.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
<template>
<div class="box"></div>
</template>

<script lang="ts">
import { defineComponent } from 'vue';
export default defineComponent({
name: 'AnsweringMark',
data() {
return {};
},
computed: {
conversationId() {
return this.$route.params?.conversationId?.toString();
}
}
});
</script>

<style lang="scss">
@keyframes blink {
0% {
opacity: 1;
}
50% {
opacity: 0;
}
100% {
opacity: 1;
}
}
.box {
width: 2px;
height: 16px;
margin-top: 3px;
background-color: var(--el-color-black);
animation: blink 1s infinite;
}
</style>
Loading

0 comments on commit d98cc42

Please sign in to comment.