feat: Support for Chat Flow & Agent Support for binding a single chat flow (#765)

Co-authored-by: Yu Yang <72337138+tomasyu985@users.noreply.github.com>
Co-authored-by: zengxiaohui <csu.zengxiaohui@gmail.com>
Co-authored-by: lijunwen.gigoo <lijunwen.gigoo@bytedance.com>
Co-authored-by: lvxinyu.1117 <lvxinyu.1117@bytedance.com>
Co-authored-by: liuyunchao.0510 <liuyunchao.0510@bytedance.com>
Co-authored-by: haozhenfei <37089575+haozhenfei@users.noreply.github.com>
Co-authored-by: July <jiangxujin@bytedance.com>
Co-authored-by: tecvan-fe <fanwenjie.fe@bytedance.com>
This commit is contained in:
Zhj
2025-08-28 21:53:32 +08:00
committed by GitHub
parent bbc615a18e
commit d70101c979
503 changed files with 48036 additions and 3427 deletions

View File

@@ -1,3 +1,19 @@
/*
* Copyright 2025 coze-dev Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// Code generated by thriftgo (0.4.1). DO NOT EDIT.
package common
@@ -6,9 +22,26 @@ import (
"database/sql"
"database/sql/driver"
"fmt"
"github.com/apache/thrift/lib/go/thrift"
)
const (
VariableTypeKVVariable = "KVVariable"
VariableTypeListVariable = "ListVariable"
VariableChannelCustom = "custom"
VariableChannelSystem = "system"
VariableChannelLocation = "location"
VariableChannelFeishu = "feishu"
VariableChannelAPP = "app"
)
/****************************** audit **********************************/
type AuditStatus int64
@@ -314,6 +347,10 @@ func (p *SpaceStatus) Value() (driver.Value, error) {
return int64(*p), nil
}
type VariableType = string
type VariableChannel = string
type UserLabel struct {
LabelID string `thrift:"label_id,1" form:"label_id" json:"label_id" query:"label_id"`
LabelName string `thrift:"label_name,2" form:"label_name" json:"label_name" query:"label_name"`
@@ -2275,3 +2312,412 @@ func (p *Space) String() string {
return fmt.Sprintf("Space(%+v)", *p)
}
type Variable struct {
Keyword string `thrift:"keyword,1" form:"keyword" json:"keyword" query:"keyword"`
DefaultValue string `thrift:"default_value,2" form:"default_value" json:"default_value" query:"default_value"`
VariableType VariableType `thrift:"variable_type,3" form:"variable_type" json:"variable_type" query:"variable_type"`
Channel VariableChannel `thrift:"channel,4" form:"channel" json:"channel" query:"channel"`
Description string `thrift:"description,5" form:"description" json:"description" query:"description"`
Enable bool `thrift:"enable,6" form:"enable" json:"enable" query:"enable"`
PromptEnable bool `thrift:"prompt_enable,7" form:"prompt_enable" json:"prompt_enable" query:"prompt_enable"`
}
func NewVariable() *Variable {
return &Variable{}
}
func (p *Variable) InitDefault() {
}
func (p *Variable) GetKeyword() (v string) {
return p.Keyword
}
func (p *Variable) GetDefaultValue() (v string) {
return p.DefaultValue
}
func (p *Variable) GetVariableType() (v VariableType) {
return p.VariableType
}
func (p *Variable) GetChannel() (v VariableChannel) {
return p.Channel
}
func (p *Variable) GetDescription() (v string) {
return p.Description
}
func (p *Variable) GetEnable() (v bool) {
return p.Enable
}
func (p *Variable) GetPromptEnable() (v bool) {
return p.PromptEnable
}
var fieldIDToName_Variable = map[int16]string{
1: "keyword",
2: "default_value",
3: "variable_type",
4: "channel",
5: "description",
6: "enable",
7: "prompt_enable",
}
func (p *Variable) Read(iprot thrift.TProtocol) (err error) {
var fieldTypeId thrift.TType
var fieldId int16
if _, err = iprot.ReadStructBegin(); err != nil {
goto ReadStructBeginError
}
for {
_, fieldTypeId, fieldId, err = iprot.ReadFieldBegin()
if err != nil {
goto ReadFieldBeginError
}
if fieldTypeId == thrift.STOP {
break
}
switch fieldId {
case 1:
if fieldTypeId == thrift.STRING {
if err = p.ReadField1(iprot); err != nil {
goto ReadFieldError
}
} else if err = iprot.Skip(fieldTypeId); err != nil {
goto SkipFieldError
}
case 2:
if fieldTypeId == thrift.STRING {
if err = p.ReadField2(iprot); err != nil {
goto ReadFieldError
}
} else if err = iprot.Skip(fieldTypeId); err != nil {
goto SkipFieldError
}
case 3:
if fieldTypeId == thrift.STRING {
if err = p.ReadField3(iprot); err != nil {
goto ReadFieldError
}
} else if err = iprot.Skip(fieldTypeId); err != nil {
goto SkipFieldError
}
case 4:
if fieldTypeId == thrift.STRING {
if err = p.ReadField4(iprot); err != nil {
goto ReadFieldError
}
} else if err = iprot.Skip(fieldTypeId); err != nil {
goto SkipFieldError
}
case 5:
if fieldTypeId == thrift.STRING {
if err = p.ReadField5(iprot); err != nil {
goto ReadFieldError
}
} else if err = iprot.Skip(fieldTypeId); err != nil {
goto SkipFieldError
}
case 6:
if fieldTypeId == thrift.BOOL {
if err = p.ReadField6(iprot); err != nil {
goto ReadFieldError
}
} else if err = iprot.Skip(fieldTypeId); err != nil {
goto SkipFieldError
}
case 7:
if fieldTypeId == thrift.BOOL {
if err = p.ReadField7(iprot); err != nil {
goto ReadFieldError
}
} else if err = iprot.Skip(fieldTypeId); err != nil {
goto SkipFieldError
}
default:
if err = iprot.Skip(fieldTypeId); err != nil {
goto SkipFieldError
}
}
if err = iprot.ReadFieldEnd(); err != nil {
goto ReadFieldEndError
}
}
if err = iprot.ReadStructEnd(); err != nil {
goto ReadStructEndError
}
return nil
ReadStructBeginError:
return thrift.PrependError(fmt.Sprintf("%T read struct begin error: ", p), err)
ReadFieldBeginError:
return thrift.PrependError(fmt.Sprintf("%T read field %d begin error: ", p, fieldId), err)
ReadFieldError:
return thrift.PrependError(fmt.Sprintf("%T read field %d '%s' error: ", p, fieldId, fieldIDToName_Variable[fieldId]), err)
SkipFieldError:
return thrift.PrependError(fmt.Sprintf("%T field %d skip type %d error: ", p, fieldId, fieldTypeId), err)
ReadFieldEndError:
return thrift.PrependError(fmt.Sprintf("%T read field end error", p), err)
ReadStructEndError:
return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err)
}
func (p *Variable) ReadField1(iprot thrift.TProtocol) error {
var _field string
if v, err := iprot.ReadString(); err != nil {
return err
} else {
_field = v
}
p.Keyword = _field
return nil
}
func (p *Variable) ReadField2(iprot thrift.TProtocol) error {
var _field string
if v, err := iprot.ReadString(); err != nil {
return err
} else {
_field = v
}
p.DefaultValue = _field
return nil
}
func (p *Variable) ReadField3(iprot thrift.TProtocol) error {
var _field VariableType
if v, err := iprot.ReadString(); err != nil {
return err
} else {
_field = v
}
p.VariableType = _field
return nil
}
func (p *Variable) ReadField4(iprot thrift.TProtocol) error {
var _field VariableChannel
if v, err := iprot.ReadString(); err != nil {
return err
} else {
_field = v
}
p.Channel = _field
return nil
}
func (p *Variable) ReadField5(iprot thrift.TProtocol) error {
var _field string
if v, err := iprot.ReadString(); err != nil {
return err
} else {
_field = v
}
p.Description = _field
return nil
}
func (p *Variable) ReadField6(iprot thrift.TProtocol) error {
var _field bool
if v, err := iprot.ReadBool(); err != nil {
return err
} else {
_field = v
}
p.Enable = _field
return nil
}
func (p *Variable) ReadField7(iprot thrift.TProtocol) error {
var _field bool
if v, err := iprot.ReadBool(); err != nil {
return err
} else {
_field = v
}
p.PromptEnable = _field
return nil
}
func (p *Variable) Write(oprot thrift.TProtocol) (err error) {
var fieldId int16
if err = oprot.WriteStructBegin("Variable"); err != nil {
goto WriteStructBeginError
}
if p != nil {
if err = p.writeField1(oprot); err != nil {
fieldId = 1
goto WriteFieldError
}
if err = p.writeField2(oprot); err != nil {
fieldId = 2
goto WriteFieldError
}
if err = p.writeField3(oprot); err != nil {
fieldId = 3
goto WriteFieldError
}
if err = p.writeField4(oprot); err != nil {
fieldId = 4
goto WriteFieldError
}
if err = p.writeField5(oprot); err != nil {
fieldId = 5
goto WriteFieldError
}
if err = p.writeField6(oprot); err != nil {
fieldId = 6
goto WriteFieldError
}
if err = p.writeField7(oprot); err != nil {
fieldId = 7
goto WriteFieldError
}
}
if err = oprot.WriteFieldStop(); err != nil {
goto WriteFieldStopError
}
if err = oprot.WriteStructEnd(); err != nil {
goto WriteStructEndError
}
return nil
WriteStructBeginError:
return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err)
WriteFieldError:
return thrift.PrependError(fmt.Sprintf("%T write field %d error: ", p, fieldId), err)
WriteFieldStopError:
return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", p), err)
WriteStructEndError:
return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", p), err)
}
func (p *Variable) writeField1(oprot thrift.TProtocol) (err error) {
if err = oprot.WriteFieldBegin("keyword", thrift.STRING, 1); err != nil {
goto WriteFieldBeginError
}
if err := oprot.WriteString(p.Keyword); err != nil {
return err
}
if err = oprot.WriteFieldEnd(); err != nil {
goto WriteFieldEndError
}
return nil
WriteFieldBeginError:
return thrift.PrependError(fmt.Sprintf("%T write field 1 begin error: ", p), err)
WriteFieldEndError:
return thrift.PrependError(fmt.Sprintf("%T write field 1 end error: ", p), err)
}
func (p *Variable) writeField2(oprot thrift.TProtocol) (err error) {
if err = oprot.WriteFieldBegin("default_value", thrift.STRING, 2); err != nil {
goto WriteFieldBeginError
}
if err := oprot.WriteString(p.DefaultValue); err != nil {
return err
}
if err = oprot.WriteFieldEnd(); err != nil {
goto WriteFieldEndError
}
return nil
WriteFieldBeginError:
return thrift.PrependError(fmt.Sprintf("%T write field 2 begin error: ", p), err)
WriteFieldEndError:
return thrift.PrependError(fmt.Sprintf("%T write field 2 end error: ", p), err)
}
func (p *Variable) writeField3(oprot thrift.TProtocol) (err error) {
if err = oprot.WriteFieldBegin("variable_type", thrift.STRING, 3); err != nil {
goto WriteFieldBeginError
}
if err := oprot.WriteString(p.VariableType); err != nil {
return err
}
if err = oprot.WriteFieldEnd(); err != nil {
goto WriteFieldEndError
}
return nil
WriteFieldBeginError:
return thrift.PrependError(fmt.Sprintf("%T write field 3 begin error: ", p), err)
WriteFieldEndError:
return thrift.PrependError(fmt.Sprintf("%T write field 3 end error: ", p), err)
}
func (p *Variable) writeField4(oprot thrift.TProtocol) (err error) {
if err = oprot.WriteFieldBegin("channel", thrift.STRING, 4); err != nil {
goto WriteFieldBeginError
}
if err := oprot.WriteString(p.Channel); err != nil {
return err
}
if err = oprot.WriteFieldEnd(); err != nil {
goto WriteFieldEndError
}
return nil
WriteFieldBeginError:
return thrift.PrependError(fmt.Sprintf("%T write field 4 begin error: ", p), err)
WriteFieldEndError:
return thrift.PrependError(fmt.Sprintf("%T write field 4 end error: ", p), err)
}
func (p *Variable) writeField5(oprot thrift.TProtocol) (err error) {
if err = oprot.WriteFieldBegin("description", thrift.STRING, 5); err != nil {
goto WriteFieldBeginError
}
if err := oprot.WriteString(p.Description); err != nil {
return err
}
if err = oprot.WriteFieldEnd(); err != nil {
goto WriteFieldEndError
}
return nil
WriteFieldBeginError:
return thrift.PrependError(fmt.Sprintf("%T write field 5 begin error: ", p), err)
WriteFieldEndError:
return thrift.PrependError(fmt.Sprintf("%T write field 5 end error: ", p), err)
}
func (p *Variable) writeField6(oprot thrift.TProtocol) (err error) {
if err = oprot.WriteFieldBegin("enable", thrift.BOOL, 6); err != nil {
goto WriteFieldBeginError
}
if err := oprot.WriteBool(p.Enable); err != nil {
return err
}
if err = oprot.WriteFieldEnd(); err != nil {
goto WriteFieldEndError
}
return nil
WriteFieldBeginError:
return thrift.PrependError(fmt.Sprintf("%T write field 6 begin error: ", p), err)
WriteFieldEndError:
return thrift.PrependError(fmt.Sprintf("%T write field 6 end error: ", p), err)
}
func (p *Variable) writeField7(oprot thrift.TProtocol) (err error) {
if err = oprot.WriteFieldBegin("prompt_enable", thrift.BOOL, 7); err != nil {
goto WriteFieldBeginError
}
if err := oprot.WriteBool(p.PromptEnable); err != nil {
return err
}
if err = oprot.WriteFieldEnd(); err != nil {
goto WriteFieldEndError
}
return nil
WriteFieldBeginError:
return thrift.PrependError(fmt.Sprintf("%T write field 7 begin error: ", p), err)
WriteFieldEndError:
return thrift.PrependError(fmt.Sprintf("%T write field 7 end error: ", p), err)
}
func (p *Variable) String() string {
if p == nil {
return "<nil>"
}
return fmt.Sprintf("Variable(%+v)", *p)
}