mirror of
https://git.mirrors.martin98.com/https://github.com/langgenius/dify.git
synced 2025-08-19 10:55:59 +08:00
Merge branch 'main' into feat/attachments
This commit is contained in:
commit
d77521e65f
@ -94,7 +94,7 @@ class LargeLanguageModel(AIModel):
|
||||
)
|
||||
|
||||
try:
|
||||
if "response_format" in model_parameters:
|
||||
if "response_format" in model_parameters and model_parameters["response_format"] in {"JSON", "XML"}:
|
||||
result = self._code_block_mode_wrapper(
|
||||
model=model,
|
||||
credentials=credentials,
|
||||
|
@ -53,6 +53,9 @@ model_credential_schema:
|
||||
type: select
|
||||
required: true
|
||||
options:
|
||||
- label:
|
||||
en_US: 2024-09-01-preview
|
||||
value: 2024-09-01-preview
|
||||
- label:
|
||||
en_US: 2024-08-01-preview
|
||||
value: 2024-08-01-preview
|
||||
|
@ -7,6 +7,7 @@ from collections.abc import Generator
|
||||
from typing import Optional, Union, cast
|
||||
|
||||
import google.auth.transport.requests
|
||||
import requests
|
||||
import vertexai.generative_models as glm
|
||||
from anthropic import AnthropicVertex, Stream
|
||||
from anthropic.types import (
|
||||
@ -653,9 +654,15 @@ class VertexAiLargeLanguageModel(LargeLanguageModel):
|
||||
if c.type == PromptMessageContentType.TEXT:
|
||||
parts.append(glm.Part.from_text(c.data))
|
||||
else:
|
||||
metadata, data = c.data.split(",", 1)
|
||||
mime_type = metadata.split(";", 1)[0].split(":")[1]
|
||||
parts.append(glm.Part.from_data(mime_type=mime_type, data=data))
|
||||
message_content = cast(ImagePromptMessageContent, c)
|
||||
if not message_content.data.startswith("data:"):
|
||||
url_arr = message_content.data.split(".")
|
||||
mime_type = f"image/{url_arr[-1]}"
|
||||
parts.append(glm.Part.from_uri(mime_type=mime_type, uri=message_content.data))
|
||||
else:
|
||||
metadata, data = c.data.split(",", 1)
|
||||
mime_type = metadata.split(";", 1)[0].split(":")[1]
|
||||
parts.append(glm.Part.from_data(mime_type=mime_type, data=data))
|
||||
glm_content = glm.Content(role="user", parts=parts)
|
||||
return glm_content
|
||||
elif isinstance(message, AssistantPromptMessage):
|
||||
|
@ -0,0 +1,48 @@
|
||||
"""fix wrong service-api history
|
||||
|
||||
Revision ID: d8e744d88ed6
|
||||
Revises: 33f5fac87f29
|
||||
Create Date: 2024-10-09 13:29:23.548498
|
||||
|
||||
"""
|
||||
from alembic import op
|
||||
from constants import UUID_NIL
|
||||
import models as models
|
||||
import sqlalchemy as sa
|
||||
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = 'd8e744d88ed6'
|
||||
down_revision = '33f5fac87f29'
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
# (UTC) release date of v0.9.0
|
||||
v0_9_0_release_date= '2024-09-29 12:00:00'
|
||||
|
||||
def upgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
sql = f"""UPDATE
|
||||
public.messages
|
||||
SET
|
||||
parent_message_id = '{UUID_NIL}'
|
||||
WHERE
|
||||
invoke_from = 'service-api'
|
||||
AND parent_message_id IS NULL
|
||||
AND created_at >= '{v0_9_0_release_date}';"""
|
||||
op.execute(sql)
|
||||
# ### end Alembic commands ###
|
||||
|
||||
|
||||
def downgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
sql = f"""UPDATE
|
||||
public.messages
|
||||
SET
|
||||
parent_message_id = NULL
|
||||
WHERE
|
||||
invoke_from = 'service-api'
|
||||
AND parent_message_id = '{UUID_NIL}'
|
||||
AND created_at >= '{v0_9_0_release_date}';"""
|
||||
op.execute(sql)
|
||||
# ### end Alembic commands ###
|
@ -26,7 +26,7 @@ export class Theme {
|
||||
if (this.chatColorTheme !== null && this.chatColorTheme !== '') {
|
||||
this.primaryColor = this.chatColorTheme ?? '#1C64F2'
|
||||
this.backgroundHeaderColorStyle = `backgroundColor: ${this.primaryColor}`
|
||||
this.backgroundButtonDefaultColorStyle = `backgroundColor: ${this.primaryColor}; color: ${colorFontOnHeaderStyle};`
|
||||
this.backgroundButtonDefaultColorStyle = `backgroundColor: ${this.primaryColor}; color: ${this.colorFontOnHeaderStyle};`
|
||||
this.roundedBackgroundColorStyle = `backgroundColor: ${hexToRGBA(this.primaryColor, 0.05)}`
|
||||
this.chatBubbleColorStyle = `backgroundColor: ${hexToRGBA(this.primaryColor, 0.15)}`
|
||||
this.chatBubbleColor = `${hexToRGBA(this.primaryColor, 0.15)}`
|
||||
|
Loading…
x
Reference in New Issue
Block a user