chore(shell): auto cp .env form .env.example when debug
* chore(shell): auto cp .env form .env.example when debug * chore(docker): using default env example if env not exit when debug app See merge request: !910
This commit is contained in:
parent
5343a7718d
commit
f3934ccf62
11
Makefile
11
Makefile
|
|
@ -14,13 +14,19 @@ MYSQL_INIT_SQL := ./docker/volumes/mysql/sql_init.sql
|
|||
ENV_FILE := ./docker/.env
|
||||
STATIC_DIR := ./bin/resources/static
|
||||
|
||||
debug: middleware python server
|
||||
debug: env middleware python server
|
||||
|
||||
env:
|
||||
@if [ ! -f "$(ENV_FILE)" ]; then \
|
||||
echo "Env file '$(ENV_FILE)' not found, using example env..."; \
|
||||
cp ./docker/.env.example $(ENV_FILE); \
|
||||
fi
|
||||
|
||||
fe:
|
||||
@echo "Building frontend..."
|
||||
@bash $(BUILD_FE_SCRIPT)
|
||||
|
||||
server:
|
||||
server: env
|
||||
@if [ ! -d "$(STATIC_DIR)" ]; then \
|
||||
echo "Static directory '$(STATIC_DIR)' not found, building frontend..."; \
|
||||
$(MAKE) fe; \
|
||||
|
|
@ -83,6 +89,7 @@ help:
|
|||
@echo ""
|
||||
@echo "Targets:"
|
||||
@echo " debug - Start the debug environment."
|
||||
@echo " env - Setup env file."
|
||||
@echo " fe - Build the frontend."
|
||||
@echo " server - Build and run the server binary."
|
||||
@echo " build_server - Build the server binary."
|
||||
|
|
|
|||
|
|
@ -26,11 +26,11 @@ import (
|
|||
"github.com/cloudwego/eino/compose"
|
||||
"github.com/cloudwego/eino/flow/agent/react"
|
||||
"github.com/cloudwego/eino/schema"
|
||||
"github.com/coze-dev/coze-studio/backend/infra/contract/modelmgr"
|
||||
|
||||
"github.com/coze-dev/coze-studio/backend/domain/agent/singleagent/entity"
|
||||
"github.com/coze-dev/coze-studio/backend/domain/workflow"
|
||||
"github.com/coze-dev/coze-studio/backend/infra/contract/chatmodel"
|
||||
"github.com/coze-dev/coze-studio/backend/infra/contract/modelmgr"
|
||||
"github.com/coze-dev/coze-studio/backend/pkg/lang/ptr"
|
||||
"github.com/coze-dev/coze-studio/backend/pkg/lang/slices"
|
||||
)
|
||||
|
|
@ -97,7 +97,6 @@ func BuildAgent(ctx context.Context, conf *Config) (r *AgentRunner, err error) {
|
|||
modelFactory: conf.ModelFactory,
|
||||
modelInfo: modelInfo,
|
||||
})
|
||||
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
|
|
|||
|
|
@ -22,22 +22,20 @@ import (
|
|||
"math/rand"
|
||||
|
||||
"github.com/cloudwego/eino/compose"
|
||||
"github.com/coze-dev/coze-studio/backend/infra/contract/modelmgr"
|
||||
"github.com/jinzhu/copier"
|
||||
|
||||
"github.com/cloudwego/eino/schema"
|
||||
|
||||
"github.com/coze-dev/coze-studio/backend/api/model/ocean/cloud/bot_common"
|
||||
"github.com/coze-dev/coze-studio/backend/crossdomain/contract/crossplugin"
|
||||
"github.com/coze-dev/coze-studio/backend/domain/agent/singleagent/entity"
|
||||
"github.com/coze-dev/coze-studio/backend/domain/agent/singleagent/internal/agentflow"
|
||||
"github.com/coze-dev/coze-studio/backend/domain/agent/singleagent/repository"
|
||||
"github.com/coze-dev/coze-studio/backend/infra/contract/chatmodel"
|
||||
"github.com/coze-dev/coze-studio/backend/infra/contract/modelmgr"
|
||||
"github.com/coze-dev/coze-studio/backend/pkg/errorx"
|
||||
"github.com/coze-dev/coze-studio/backend/pkg/jsoncache"
|
||||
"github.com/coze-dev/coze-studio/backend/pkg/lang/slices"
|
||||
"github.com/coze-dev/coze-studio/backend/pkg/logs"
|
||||
"github.com/coze-dev/coze-studio/backend/types/errno"
|
||||
"github.com/jinzhu/copier"
|
||||
)
|
||||
|
||||
type singleAgentImpl struct {
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@ import (
|
|||
"context"
|
||||
|
||||
"github.com/cloudwego/eino/components/model"
|
||||
|
||||
"github.com/coze-dev/coze-studio/backend/infra/contract/modelmgr"
|
||||
)
|
||||
|
||||
|
|
|
|||
|
|
@ -31,7 +31,6 @@ import (
|
|||
model2 "github.com/cloudwego/eino/components/model"
|
||||
"github.com/cloudwego/eino/compose"
|
||||
"github.com/cloudwego/eino/schema"
|
||||
"github.com/coze-dev/coze-studio/backend/infra/contract/modelmgr"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"go.uber.org/mock/gomock"
|
||||
|
||||
|
|
@ -42,6 +41,7 @@ import (
|
|||
compose2 "github.com/coze-dev/coze-studio/backend/domain/workflow/internal/compose"
|
||||
"github.com/coze-dev/coze-studio/backend/domain/workflow/internal/nodes"
|
||||
"github.com/coze-dev/coze-studio/backend/domain/workflow/internal/nodes/llm"
|
||||
"github.com/coze-dev/coze-studio/backend/infra/contract/modelmgr"
|
||||
"github.com/coze-dev/coze-studio/backend/internal/testutil"
|
||||
"github.com/coze-dev/coze-studio/backend/pkg/ctxcache"
|
||||
)
|
||||
|
|
|
|||
|
|
@ -28,7 +28,6 @@ import (
|
|||
"github.com/cloudwego/eino/components/tool"
|
||||
"github.com/cloudwego/eino/compose"
|
||||
"github.com/cloudwego/eino/schema"
|
||||
"github.com/coze-dev/coze-studio/backend/infra/contract/modelmgr"
|
||||
|
||||
workflow3 "github.com/coze-dev/coze-studio/backend/api/model/ocean/cloud/workflow"
|
||||
workflow2 "github.com/coze-dev/coze-studio/backend/domain/workflow"
|
||||
|
|
@ -62,6 +61,7 @@ import (
|
|||
"github.com/coze-dev/coze-studio/backend/domain/workflow/internal/nodes/textprocessor"
|
||||
"github.com/coze-dev/coze-studio/backend/domain/workflow/internal/nodes/variableaggregator"
|
||||
"github.com/coze-dev/coze-studio/backend/domain/workflow/internal/nodes/variableassigner"
|
||||
"github.com/coze-dev/coze-studio/backend/infra/contract/modelmgr"
|
||||
"github.com/coze-dev/coze-studio/backend/pkg/lang/ptr"
|
||||
"github.com/coze-dev/coze-studio/backend/pkg/safego"
|
||||
)
|
||||
|
|
@ -501,7 +501,6 @@ func (s *NodeSchema) ToDatabaseCustomSQLConfig() (*database.CustomSQLConfig, err
|
|||
OutputConfig: s.OutputTypes,
|
||||
CustomSQLExecutor: crossdatabase.GetDatabaseOperator(),
|
||||
}, nil
|
||||
|
||||
}
|
||||
|
||||
func (s *NodeSchema) ToDatabaseQueryConfig() (*database.QueryConfig, error) {
|
||||
|
|
@ -517,7 +516,6 @@ func (s *NodeSchema) ToDatabaseQueryConfig() (*database.QueryConfig, error) {
|
|||
}
|
||||
|
||||
func (s *NodeSchema) ToDatabaseInsertConfig() (*database.InsertConfig, error) {
|
||||
|
||||
return &database.InsertConfig{
|
||||
DatabaseInfoID: mustGetKey[int64]("DatabaseInfoID", s.Configs),
|
||||
OutputConfig: s.OutputTypes,
|
||||
|
|
@ -535,7 +533,6 @@ func (s *NodeSchema) ToDatabaseDeleteConfig() (*database.DeleteConfig, error) {
|
|||
}
|
||||
|
||||
func (s *NodeSchema) ToDatabaseUpdateConfig() (*database.UpdateConfig, error) {
|
||||
|
||||
return &database.UpdateConfig{
|
||||
DatabaseInfoID: mustGetKey[int64]("DatabaseInfoID", s.Configs),
|
||||
ClauseGroup: mustGetKey[*crossdatabase.ClauseGroup]("ClauseGroup", s.Configs),
|
||||
|
|
@ -575,7 +572,6 @@ func (s *NodeSchema) ToPluginConfig() (*plugin.Config, error) {
|
|||
PluginVersion: mustGetKey[string]("PluginVersion", s.Configs),
|
||||
PluginService: crossplugin.GetPluginService(),
|
||||
}, nil
|
||||
|
||||
}
|
||||
|
||||
func (s *NodeSchema) ToCodeRunnerConfig() (*code.Config, error) {
|
||||
|
|
|
|||
|
|
@ -24,6 +24,7 @@ import (
|
|||
"github.com/cloudwego/eino/components"
|
||||
"github.com/cloudwego/eino/components/model"
|
||||
"github.com/cloudwego/eino/schema"
|
||||
|
||||
"github.com/coze-dev/coze-studio/backend/domain/workflow/internal/execute"
|
||||
"github.com/coze-dev/coze-studio/backend/infra/contract/modelmgr"
|
||||
)
|
||||
|
|
@ -77,7 +78,8 @@ func NewModelWithFallback(m, f model.BaseChatModel, info, fInfo *modelmgr.Model)
|
|||
}
|
||||
|
||||
func (m *ModelForLLM) Generate(ctx context.Context, input []*schema.Message, opts ...model.Option) (
|
||||
output *schema.Message, err error) {
|
||||
output *schema.Message, err error,
|
||||
) {
|
||||
if m.UseFallback(ctx) {
|
||||
if !m.fallbackEnableCallback {
|
||||
defer func() {
|
||||
|
|
@ -106,7 +108,8 @@ func (m *ModelForLLM) Generate(ctx context.Context, input []*schema.Message, opt
|
|||
}
|
||||
|
||||
func (m *ModelForLLM) Stream(ctx context.Context, input []*schema.Message, opts ...model.Option) (
|
||||
output *schema.StreamReader[*schema.Message], err error) {
|
||||
output *schema.StreamReader[*schema.Message], err error,
|
||||
) {
|
||||
if m.UseFallback(ctx) {
|
||||
if !m.fallbackEnableCallback {
|
||||
defer func() {
|
||||
|
|
|
|||
|
|
@ -22,11 +22,11 @@ import (
|
|||
|
||||
"github.com/cloudwego/eino/components/prompt"
|
||||
"github.com/cloudwego/eino/schema"
|
||||
"github.com/coze-dev/coze-studio/backend/infra/contract/modelmgr"
|
||||
|
||||
"github.com/coze-dev/coze-studio/backend/domain/workflow/entity/vo"
|
||||
"github.com/coze-dev/coze-studio/backend/domain/workflow/internal/execute"
|
||||
"github.com/coze-dev/coze-studio/backend/domain/workflow/internal/nodes"
|
||||
"github.com/coze-dev/coze-studio/backend/infra/contract/modelmgr"
|
||||
"github.com/coze-dev/coze-studio/backend/pkg/ctxcache"
|
||||
"github.com/coze-dev/coze-studio/backend/pkg/sonic"
|
||||
)
|
||||
|
|
@ -108,7 +108,8 @@ func newPrompts(sp, up *promptTpl, model ModelWithInfo) *prompts {
|
|||
|
||||
func (pl *promptTpl) render(ctx context.Context, vs map[string]any,
|
||||
sources map[string]*nodes.SourceInfo,
|
||||
supportedModals map[modelmgr.Modal]bool) (*schema.Message, error) {
|
||||
supportedModals map[modelmgr.Modal]bool,
|
||||
) (*schema.Message, error) {
|
||||
if !pl.hasMultiModal || len(supportedModals) == 0 {
|
||||
var opts []nodes.RenderOption
|
||||
if len(pl.reservedKeys) > 0 {
|
||||
|
|
@ -237,7 +238,8 @@ func (pl *promptTpl) render(ctx context.Context, vs map[string]any,
|
|||
}
|
||||
|
||||
func (p *prompts) Format(ctx context.Context, vs map[string]any, _ ...prompt.Option) (
|
||||
_ []*schema.Message, err error) {
|
||||
_ []*schema.Message, err error,
|
||||
) {
|
||||
exeCtx := execute.GetExeCtx(ctx)
|
||||
var nodeKey vo.NodeKey
|
||||
if exeCtx != nil && exeCtx.NodeCtx != nil {
|
||||
|
|
|
|||
Loading…
Reference in New Issue