build:dockerfile

This commit is contained in:
suziheng 2025-09-15 16:18:27 +08:00
parent 2174039fce
commit a529eab39e
4 changed files with 23 additions and 11 deletions

View File

@ -4,17 +4,15 @@ WORKDIR /web
COPY ./VERSION . COPY ./VERSION .
COPY ./web . COPY ./web .
WORKDIR /web/default RUN npm install --prefix /web/default & \
RUN npm install --force npm install --prefix /web/berry & \
RUN DISABLE_ESLINT_PLUGIN='true' REACT_APP_VERSION=$(cat VERSION) npm run build npm install --prefix /web/air & \
wait
WORKDIR /web/berry RUN DISABLE_ESLINT_PLUGIN='true' REACT_APP_VERSION=$(cat ./VERSION) npm run build --prefix /web/default & \
RUN npm install --force DISABLE_ESLINT_PLUGIN='true' REACT_APP_VERSION=$(cat ./VERSION) npm run build --prefix /web/berry & \
RUN DISABLE_ESLINT_PLUGIN='true' REACT_APP_VERSION=$(cat VERSION) npm run build DISABLE_ESLINT_PLUGIN='true' REACT_APP_VERSION=$(cat ./VERSION) npm run build --prefix /web/air & \
wait
WORKDIR /web/air
RUN npm install --force
RUN DISABLE_ESLINT_PLUGIN='true' REACT_APP_VERSION=$(cat VERSION) npm run build
FROM golang:alpine AS builder2 FROM golang:alpine AS builder2
@ -46,4 +44,4 @@ COPY --from=builder2 /build/one-api /
EXPOSE 3000 EXPOSE 3000
WORKDIR /data WORKDIR /data
ENTRYPOINT ["/one-api"] ENTRYPOINT ["/one-api"]

View File

@ -118,6 +118,13 @@ func ConvertRequest(textRequest model.GeneralOpenAIRequest) *ChatRequest {
parts = append(parts, Part{ parts = append(parts, Part{
Text: part.Text, Text: part.Text,
}) })
} else if part.Type == model.ContentTypeInputPdf {
parts = append(parts, Part{
FileData: &FileData{
MimeType: "application/pdf",
FileUri: part.ImageURL.Url,
},
})
} else if part.Type == model.ContentTypeImageURL { } else if part.Type == model.ContentTypeImageURL {
imageNum += 1 imageNum += 1
if imageNum > VisionMaxImageNum { if imageNum > VisionMaxImageNum {

View File

@ -40,6 +40,11 @@ type InlineData struct {
Data string `json:"data"` Data string `json:"data"`
} }
type FileData struct {
MimeType string `json:"mime_type"`
FileUri string `json:"file_uri"`
}
type FunctionCall struct { type FunctionCall struct {
FunctionName string `json:"name"` FunctionName string `json:"name"`
Arguments any `json:"args"` Arguments any `json:"args"`
@ -50,6 +55,7 @@ type Part struct {
InlineData *InlineData `json:"inlineData,omitempty"` InlineData *InlineData `json:"inlineData,omitempty"`
FunctionCall *FunctionCall `json:"functionCall,omitempty"` FunctionCall *FunctionCall `json:"functionCall,omitempty"`
Thought bool `json:"thought,omitempty"` Thought bool `json:"thought,omitempty"`
FileData *FileData `json:"fileData,omitempty"`
} }
type ChatContent struct { type ChatContent struct {

View File

@ -4,4 +4,5 @@ const (
ContentTypeText = "text" ContentTypeText = "text"
ContentTypeImageURL = "image_url" ContentTypeImageURL = "image_url"
ContentTypeInputAudio = "input_audio" ContentTypeInputAudio = "input_audio"
ContentTypeInputPdf = "application/pdf"
) )