mirror of
https://github.com/ChatGPTNextWeb/ChatGPT-Next-Web.git
synced 2025-10-02 08:06:38 +08:00
commit
780cdbc152
6
.github/workflows/dockerToHub.yml
vendored
6
.github/workflows/dockerToHub.yml
vendored
@ -25,7 +25,7 @@ jobs:
|
|||||||
github-server-url: 'https://gh.sivpn.cn'
|
github-server-url: 'https://gh.sivpn.cn'
|
||||||
- name: build and deploy to Docker Hub
|
- name: build and deploy to Docker Hub
|
||||||
run: |
|
run: |
|
||||||
echo ${{ secrets.DOCKER_PASSWORD }} | docker login registry.gitlab.si.icu -u ${{ secrets.DOCKER_USERNAME }} --password-stdin
|
echo ${{ secrets.DOCKER_PASSWORD }} | docker login registry.si.icu -u ${{ secrets.DOCKER_USERNAME }} --password-stdin
|
||||||
echo "${{ secrets.DOCKER_ENV }}" > .env
|
echo "${{ secrets.DOCKER_ENV }}" > .env
|
||||||
- name: Get current date
|
- name: Get current date
|
||||||
run: echo "DATE_TAG=$(date +'%Y%m%d')" >> $GITHUB_ENV
|
run: echo "DATE_TAG=$(date +'%Y%m%d')" >> $GITHUB_ENV
|
||||||
@ -35,8 +35,8 @@ jobs:
|
|||||||
context: .
|
context: .
|
||||||
push: true
|
push: true
|
||||||
tags: |
|
tags: |
|
||||||
registry.gitlab.si.icu/sijinhui/chatgpt-next-web:latest
|
registry.si.icu/sijinhui/chatgpt-next-web:latest
|
||||||
registry.gitlab.si.icu/sijinhui/chatgpt-next-web:${{ env.DATE_TAG }}
|
registry.si.icu/sijinhui/chatgpt-next-web:${{ env.DATE_TAG }}
|
||||||
- name: clean build history
|
- name: clean build history
|
||||||
run: |
|
run: |
|
||||||
yes | docker system prune --filter "until=720h"
|
yes | docker system prune --filter "until=720h"
|
||||||
|
@ -77,17 +77,25 @@ export class ErnieApi implements LLMApi {
|
|||||||
|
|
||||||
async chat(options: ChatOptions) {
|
async chat(options: ChatOptions) {
|
||||||
const messages = options.messages.map((v) => ({
|
const messages = options.messages.map((v) => ({
|
||||||
role: v.role,
|
// "error_code": 336006, "error_msg": "the role of message with even index in the messages must be user or function",
|
||||||
|
role: v.role === "system" ? "user" : v.role,
|
||||||
content: getMessageTextContent(v),
|
content: getMessageTextContent(v),
|
||||||
}));
|
}));
|
||||||
|
|
||||||
// "error_code": 336006, "error_msg": "the length of messages must be an odd number",
|
// "error_code": 336006, "error_msg": "the length of messages must be an odd number",
|
||||||
if (messages.length % 2 === 0) {
|
if (messages.length % 2 === 0) {
|
||||||
|
if (messages.at(0)?.role === "user") {
|
||||||
|
messages.splice(1, 0, {
|
||||||
|
role: "assistant",
|
||||||
|
content: " ",
|
||||||
|
});
|
||||||
|
} else {
|
||||||
messages.unshift({
|
messages.unshift({
|
||||||
role: "user",
|
role: "user",
|
||||||
content: " ",
|
content: " ",
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const modelConfig = {
|
const modelConfig = {
|
||||||
...useAppConfig.getState().modelConfig,
|
...useAppConfig.getState().modelConfig,
|
||||||
|
@ -91,8 +91,9 @@ export class HunyuanApi implements LLMApi {
|
|||||||
|
|
||||||
async chat(options: ChatOptions) {
|
async chat(options: ChatOptions) {
|
||||||
const visionModel = isVisionModel(options.config.model);
|
const visionModel = isVisionModel(options.config.model);
|
||||||
const messages = options.messages.map((v) => ({
|
const messages = options.messages.map((v, index) => ({
|
||||||
role: v.role,
|
// "Messages 中 system 角色必须位于列表的最开始"
|
||||||
|
role: index !== 0 && v.role === "system" ? "user" : v.role,
|
||||||
content: visionModel ? v.content : getMessageTextContent(v),
|
content: visionModel ? v.content : getMessageTextContent(v),
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
@ -3,7 +3,7 @@ services:
|
|||||||
chatgpt-next-web:
|
chatgpt-next-web:
|
||||||
container_name: chatgpt-next-web
|
container_name: chatgpt-next-web
|
||||||
restart: always
|
restart: always
|
||||||
image: registry.gitlab.si.icu/sijinhui/chatgpt-next-web
|
image: registry.si.icu/sijinhui/chatgpt-next-web
|
||||||
build:
|
build:
|
||||||
context: .
|
context: .
|
||||||
dockerfile: Dockerfile
|
dockerfile: Dockerfile
|
||||||
|
Loading…
Reference in New Issue
Block a user