Skip to content

Commit

Permalink
add support docker 19 (#24)
Browse files Browse the repository at this point in the history
  • Loading branch information
yaojin3616 committed Sep 12, 2023
2 parents 7f5c469 + 6f4c0d1 commit e0df4bd
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 17 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ build/
./third_party
output/
develop-eggs/
config.dev.yaml
dist/
downloads/
eggs/
Expand Down
4 changes: 3 additions & 1 deletion docker/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,9 @@ services:
- ${DOCKER_VOLUME_DIRECTORY:-.}/bisheng/config/config.yaml:/app/bisheng/config.yaml
- ${DOCKER_VOLUME_DIRECTORY:-.}/bisheng/data/:/app/data/
ports:
- "7861:7860"
- "7860:7860"
security_opt:
- seccomp:unconfined
command: bash -c "uvicorn bisheng.main:app --host 0.0.0.0 --port 7860 --workers 2" # --workers 表示使用几个进程,提高并发度
restart: on-failure

Expand Down
18 changes: 3 additions & 15 deletions src/backend/bisheng/database/models/template.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,29 +10,17 @@

class TemplateSkillBase(SQLModelSerializable):
name: str = Field(index=True)
description: Optional[str] = Field(index=True)
parameters: Optional[Dict] = Field(index=False)
flow_id: Optional[UUID] = Field(index=True)
api_parameters: Optional[str] = Field(index=False)
description: str = Field(index=False)

flow_id: Optional[UUID] = Field(default=None, index=True)
create_time: Optional[datetime] = Field(
sa_column=Column(DateTime, nullable=False, index=True, server_default=text('CURRENT_TIMESTAMP')))
update_time: Optional[datetime] = Field(sa_column=Column(
DateTime, nullable=False, server_default=text('CURRENT_TIMESTAMP'), onupdate=text('CURRENT_TIMESTAMP')))

@validator('parameters')
def validate_json(v):
# dict_keys(['description', 'name', 'id', 'data'])
if not v:
return v
if not isinstance(v, dict):
raise ValueError('Template must be a valid JSON')

return v


class Template(TemplateSkillBase, table=True):
id: Optional[int] = Field(default=None, primary_key=True)
parameters: Optional[Dict] = Field(default=None, sa_column=Column(JSON))


class TemplateRead(TemplateSkillBase):
Expand Down
3 changes: 2 additions & 1 deletion src/backend/bisheng/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,4 +99,5 @@ def load_settings_from_yaml(file_path: str) -> Settings:
return Settings(**settings_dict)


settings = load_settings_from_yaml('config.yaml')
config_file = os.getenv('config', 'config.yaml')
settings = load_settings_from_yaml(config_file)

0 comments on commit e0df4bd

Please sign in to comment.