Skip to content

Commit

Permalink
build: 支持arm镜像
Browse files Browse the repository at this point in the history
  • Loading branch information
weaigc committed Aug 29, 2023
1 parent 28d3347 commit 2173ec8
Show file tree
Hide file tree
Showing 5 changed files with 143 additions and 83 deletions.
31 changes: 30 additions & 1 deletion .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:
- dev

jobs:
github:
x86-64:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
Expand All @@ -26,3 +26,32 @@ jobs:
uses: actions-hub/docker@master
with:
args: push weaigc/bingo:latest
arm:
runs-on: ubuntu-latest
steps:
-
name: Checkout
uses: actions/checkout@v3
-
name: Set up QEMU
uses: docker/setup-qemu-action@v2
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
-
name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Build :latest
run: docker build -t weaigc/bingo:arm -f ./docker/arm .
-
name: Build and push
uses: docker/build-push-action@v4
with:
context: .
dockerfile: ./docker/arm
platforms: linux/arm64
push: true
tags: weaigc/bingo:arm
4 changes: 3 additions & 1 deletion .github/workflows/huggingface.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,7 @@ jobs:
cd huggingface
git config user.name hf4all
git config user.email hf4all@gmail.com
git commit -am "auto build" --amend
echo "Last build time $(date)" > BUILD_INFO.txt
git add BUILD_INFO.txt
git commit -am "auto build"
git push https://$HF_USERNAME:$HF_TOKEN@huggingface.co/spaces/$HF_USERNAME/$SPACE_NAME main -f
26 changes: 26 additions & 0 deletions docker/arm
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
FROM arm64v8/node:18-bookworm


ARG DEBIAN_FRONTEND=noninteractive

ENV BING_HEADER ""

# Set the working directory to the user's home directory
WORKDIR $HOME/app

# Install app dependencies
# A wildcard is used to ensure both package.json AND package-lock.json are copied
# where available (npm@5+)
COPY package*.json $HOME/app/

RUN npm install

# Copy the current directory contents into the container at $HOME/app setting the owner to the user
COPY . $HOME/app/

RUN npm run build && rm -rf src

ENV PORT 7860
EXPOSE 7860

CMD npm start
163 changes: 83 additions & 80 deletions src/lib/bots/bing/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,71 +23,71 @@ type Params = SendMessageParams<{ bingConversationStyle: BingConversationStyle,
const getOptionSets = (conversationStyle: BingConversationStyle) => {
return {
[BingConversationStyle.Creative]: [
"nlu_direct_response_filter",
"deepleo",
"disable_emoji_spoken_text",
"responsible_ai_policy_235",
"enablemm",
"dv3sugg",
"machine_affinity",
"autosave",
"iyxapbing",
"iycapbing",
"h3imaginative",
"adsredirecturl",
"bof107v2",
"streamw",
"rctechalwlst",
"agicert",
"cdxedtgnd",
"eredirecturl",
"clgalileo",
"gencontentv3"
'nlu_direct_response_filter',
'deepleo',
'disable_emoji_spoken_text',
'responsible_ai_policy_235',
'enablemm',
'dv3sugg',
'machine_affinity',
'autosave',
'iyxapbing',
'iycapbing',
'h3imaginative',
'clgalileo',
'gencontentv3',
'adsredirecturl',
'bof107v2',
'streamw',
'rctechalwlst',
'agicert',
'cdxedtgnd',
'eredirecturl'
],
[BingConversationStyle.Balanced]: [
"nlu_direct_response_filter",
"deepleo",
"disable_emoji_spoken_text",
"responsible_ai_policy_235",
"enablemm",
"dv3sugg",
"machine_affinity",
"autosave",
"iyxapbing",
"iycapbing",
"galileo",
"adsredirecturl",
"bof107v2",
"streamw",
"rctechalwlst",
"agicert",
"cdxedtgnd",
"eredirecturl",
"saharagenconv5",
"fluxhint",
"glfluxv13"
'nlu_direct_response_filter',
'deepleo',
'disable_emoji_spoken_text',
'responsible_ai_policy_235',
'enablemm',
'dv3sugg',
'machine_affinity',
'autosave',
'iyxapbing',
'iycapbing',
'galileo',
'adsredirecturl',
'bof107v2',
'streamw',
'rctechalwlst',
'agicert',
'cdxedtgnd',
'eredirecturl',
'saharagenconv5',
'fluxhint',
'glfluxv13'
],
[BingConversationStyle.Precise]: [
"nlu_direct_response_filter",
"deepleo",
"disable_emoji_spoken_text",
"responsible_ai_policy_235",
"enablemm",
"dv3sugg",
"machine_affinity",
"autosave",
"iyxapbing",
"iycapbing",
"h3precise",
"adsredirecturl",
"bof107v2",
"streamw",
"rctechalwlst",
"agicert",
"cdxedtgnd",
"eredirecturl",
"clgalileo",
"gencontentv3"
'nlu_direct_response_filter',
'deepleo',
'disable_emoji_spoken_text',
'responsible_ai_policy_235',
'enablemm',
'dv3sugg',
'machine_affinity',
'autosave',
'iyxapbing',
'iycapbing',
'h3precise',
'adsredirecturl',
'bof107v2',
'streamw',
'rctechalwlst',
'agicert',
'cdxedtgnd',
'eredirecturl',
'clgalileo',
'gencontentv3'
]
}[conversationStyle]
}
Expand Down Expand Up @@ -128,30 +128,31 @@ export class BingWebBot {
'InternalLoaderMessage',
'Progress',
'RenderCardRequest',
'AdsQuery',
'SemanticSerp',
'GenerateContentQuery',
'SearchQuery',
],
sliceIds: [
"629adsredir",
"edi",
"divkorbl2p",
"wrapuxslimc",
"wrapnoins",
"sydconfigoptt",
"0731ziv2s0",
"0824cntors0",
"816bof107v2",
"806log2sphs0",
"0518logoss0",
"0529streamw",
"streamw",
"178gentech",
"824fluxhi52s0",
"0825agicert",
"804cdxedtgd",
"727udtupms0",
"727nrprdrt5"
'629adsredir',
'edi',
'divkorbl2p',
'wrapuxslimc',
'wrapnoins',
'sydconfigoptt',
'0731ziv2s0',
'0824cntors0',
'816bof107v2',
'806log2sphs0',
'0518logoss0',
'0529streamw',
'streamw',
'178gentech',
'824fluxhi52s0',
'0825agicert',
'804cdxedtgd',
'727udtupms0',
'727nrprdrt5'
],
isStartOfSession: conversation.invocationId === 0,
message: {
Expand All @@ -164,6 +165,8 @@ export class BingWebBot {
conversationId: conversation.conversationId,
conversationSignature: conversation.conversationSignature,
participant: { id: conversation.clientId },
spokenTextMode: 'None',
tone: conversation.conversationStyle,
},
],
invocationId: conversation.invocationId.toString(),
Expand Down
2 changes: 1 addition & 1 deletion src/pages/api/create.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse)
}) : ''
debug(`try ${count+1}`, endpoint, headers['x-forwarded-for'])
const response = await fetch(`https://${endpoint || 'www.bing.com'}/turing/conversation/create?${query}`, { method: 'GET', headers })
debug('status', headers, response.status, response.url)
debug('status', response.status, response.url)
if (response.status === 200) {
const json = await response.json().catch(e => {})
if (!json?.conversationSignature) {
Expand Down

0 comments on commit 2173ec8

Please sign in to comment.