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 33e32f9
Show file tree
Hide file tree
Showing 4 changed files with 141 additions and 82 deletions.
22 changes: 21 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,23 @@ jobs:
uses: actions-hub/docker@master
with:
args: push weaigc/bingo:latest
arm:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1

- name: Login to github registry
uses: actions-hub/docker/login@master
env:
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}

- name: Build :latest
if: success()
run: docker build -t weaigc/bingo:arm -f ./docker/arm .

- name: Push to docker hub :arm
if: success()
uses: actions-hub/docker@master
with:
args: push weaigc/bingo:arm
36 changes: 36 additions & 0 deletions docker/arm
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
FROM arm32v7/node:18-bookworm


ARG DEBIAN_FRONTEND=noninteractive

ENV BING_HEADER ""

# Set home to the user's home directory
ENV HOME=/home/user \
PATH=/home/user/.local/bin:$PATH

# Set up a new user named "user" with user ID 1000
RUN useradd -o -u 1000 user && mkdir -p $HOME/app && chown -R user $HOME

# Switch to the "user" user
USER user

# 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 --chown=user 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 --chown=user . $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 33e32f9

Please sign in to comment.