fix(singleagent): chatsdk shortcmd is not display (#1981)

This commit is contained in:
junwen-lee
2025-09-03 15:16:52 +08:00
committed by GitHub
parent f7b5096d69
commit 18a1b7e3ec
4 changed files with 894 additions and 13 deletions

View File

@ -1,4 +1,20 @@
// Code generated by thriftgo (0.4.1). DO NOT EDIT.
/*
* 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.2). DO NOT EDIT.
package bot_common
@ -9,6 +25,12 @@ import (
"github.com/apache/thrift/lib/go/thrift"
)
const (
ShortcutSendTypeQuery = "query"
ShortcutSendTypePanel = "panel"
)
type ModelStyle int64
const (
@ -1993,6 +2015,8 @@ func (p *ReferenceInfoStatus) Value() (driver.Value, error) {
return int64(*p), nil
}
type ShortcutSendType = string
type AuthToken struct {
ServiceID string `thrift:"service_id,1" form:"service_id" json:"service_id" query:"service_id"`
AccessKeyID string `thrift:"access_key_id,2" form:"access_key_id" json:"access_key_id" query:"access_key_id"`
@ -15575,11 +15599,380 @@ func (p *ShortcutCommandComponent) String() string {
}
type ShortcutToolParam struct {
Name string `thrift:"name,1" form:"name" json:"name" query:"name"`
IsRequired bool `thrift:"is_required,2" form:"is_required" json:"is_required" query:"is_required"`
Description string `thrift:"description,3" form:"description" json:"description" query:"description"`
Type string `thrift:"type,4" form:"type" json:"type" query:"type"`
DefaultValue string `thrift:"default_value,5" form:"default_value" json:"default_value" query:"default_value"`
// 是否是panel参数
IsReferComponent bool `thrift:"is_refer_component,6" form:"is_refer_component" json:"is_refer_component" query:"is_refer_component"`
}
func NewShortcutToolParam() *ShortcutToolParam {
return &ShortcutToolParam{}
}
func (p *ShortcutToolParam) InitDefault() {
}
func (p *ShortcutToolParam) GetName() (v string) {
return p.Name
}
func (p *ShortcutToolParam) GetIsRequired() (v bool) {
return p.IsRequired
}
func (p *ShortcutToolParam) GetDescription() (v string) {
return p.Description
}
func (p *ShortcutToolParam) GetType() (v string) {
return p.Type
}
func (p *ShortcutToolParam) GetDefaultValue() (v string) {
return p.DefaultValue
}
func (p *ShortcutToolParam) GetIsReferComponent() (v bool) {
return p.IsReferComponent
}
var fieldIDToName_ShortcutToolParam = map[int16]string{
1: "name",
2: "is_required",
3: "description",
4: "type",
5: "default_value",
6: "is_refer_component",
}
func (p *ShortcutToolParam) 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.BOOL {
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
}
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_ShortcutToolParam[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 *ShortcutToolParam) ReadField1(iprot thrift.TProtocol) error {
var _field string
if v, err := iprot.ReadString(); err != nil {
return err
} else {
_field = v
}
p.Name = _field
return nil
}
func (p *ShortcutToolParam) ReadField2(iprot thrift.TProtocol) error {
var _field bool
if v, err := iprot.ReadBool(); err != nil {
return err
} else {
_field = v
}
p.IsRequired = _field
return nil
}
func (p *ShortcutToolParam) ReadField3(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 *ShortcutToolParam) ReadField4(iprot thrift.TProtocol) error {
var _field string
if v, err := iprot.ReadString(); err != nil {
return err
} else {
_field = v
}
p.Type = _field
return nil
}
func (p *ShortcutToolParam) ReadField5(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 *ShortcutToolParam) ReadField6(iprot thrift.TProtocol) error {
var _field bool
if v, err := iprot.ReadBool(); err != nil {
return err
} else {
_field = v
}
p.IsReferComponent = _field
return nil
}
func (p *ShortcutToolParam) Write(oprot thrift.TProtocol) (err error) {
var fieldId int16
if err = oprot.WriteStructBegin("ShortcutToolParam"); 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 = 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 *ShortcutToolParam) writeField1(oprot thrift.TProtocol) (err error) {
if err = oprot.WriteFieldBegin("name", thrift.STRING, 1); err != nil {
goto WriteFieldBeginError
}
if err := oprot.WriteString(p.Name); 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 *ShortcutToolParam) writeField2(oprot thrift.TProtocol) (err error) {
if err = oprot.WriteFieldBegin("is_required", thrift.BOOL, 2); err != nil {
goto WriteFieldBeginError
}
if err := oprot.WriteBool(p.IsRequired); 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 *ShortcutToolParam) writeField3(oprot thrift.TProtocol) (err error) {
if err = oprot.WriteFieldBegin("description", thrift.STRING, 3); 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 3 begin error: ", p), err)
WriteFieldEndError:
return thrift.PrependError(fmt.Sprintf("%T write field 3 end error: ", p), err)
}
func (p *ShortcutToolParam) writeField4(oprot thrift.TProtocol) (err error) {
if err = oprot.WriteFieldBegin("type", thrift.STRING, 4); err != nil {
goto WriteFieldBeginError
}
if err := oprot.WriteString(p.Type); 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 *ShortcutToolParam) writeField5(oprot thrift.TProtocol) (err error) {
if err = oprot.WriteFieldBegin("default_value", thrift.STRING, 5); 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 5 begin error: ", p), err)
WriteFieldEndError:
return thrift.PrependError(fmt.Sprintf("%T write field 5 end error: ", p), err)
}
func (p *ShortcutToolParam) writeField6(oprot thrift.TProtocol) (err error) {
if err = oprot.WriteFieldBegin("is_refer_component", thrift.BOOL, 6); err != nil {
goto WriteFieldBeginError
}
if err := oprot.WriteBool(p.IsReferComponent); 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 *ShortcutToolParam) String() string {
if p == nil {
return "<nil>"
}
return fmt.Sprintf("ShortcutToolParam(%+v)", *p)
}
type ShortcutCommandToolInfo struct {
//
Name string `thrift:"name,1" form:"name" json:"name" query:"name"`
// Tool type workflow plugin
Type string `thrift:"type,2" form:"type" json:"type" query:"type"`
Type string `thrift:"type,2" form:"type" json:"type" query:"type"`
PluginID *int64 `thrift:"plugin_id,3,optional" form:"plugin_id" json:"plugin_id,string,omitempty" query:"plugin_id"`
PluginAPIName *string `thrift:"plugin_api_name,4,optional" form:"plugin_api_name" json:"plugin_api_name,omitempty" query:"plugin_api_name"`
WorkflowID *int64 `thrift:"workflow_id,5,optional" form:"workflow_id" json:"workflow_id,string,omitempty" query:"workflow_id"`
Params []*ShortcutToolParam `thrift:"params,6,optional" form:"params" json:"params,omitempty" query:"params"`
}
func NewShortcutCommandToolInfo() *ShortcutCommandToolInfo {
@ -15597,9 +15990,65 @@ func (p *ShortcutCommandToolInfo) GetType() (v string) {
return p.Type
}
var ShortcutCommandToolInfo_PluginID_DEFAULT int64
func (p *ShortcutCommandToolInfo) GetPluginID() (v int64) {
if !p.IsSetPluginID() {
return ShortcutCommandToolInfo_PluginID_DEFAULT
}
return *p.PluginID
}
var ShortcutCommandToolInfo_PluginAPIName_DEFAULT string
func (p *ShortcutCommandToolInfo) GetPluginAPIName() (v string) {
if !p.IsSetPluginAPIName() {
return ShortcutCommandToolInfo_PluginAPIName_DEFAULT
}
return *p.PluginAPIName
}
var ShortcutCommandToolInfo_WorkflowID_DEFAULT int64
func (p *ShortcutCommandToolInfo) GetWorkflowID() (v int64) {
if !p.IsSetWorkflowID() {
return ShortcutCommandToolInfo_WorkflowID_DEFAULT
}
return *p.WorkflowID
}
var ShortcutCommandToolInfo_Params_DEFAULT []*ShortcutToolParam
func (p *ShortcutCommandToolInfo) GetParams() (v []*ShortcutToolParam) {
if !p.IsSetParams() {
return ShortcutCommandToolInfo_Params_DEFAULT
}
return p.Params
}
var fieldIDToName_ShortcutCommandToolInfo = map[int16]string{
1: "name",
2: "type",
3: "plugin_id",
4: "plugin_api_name",
5: "workflow_id",
6: "params",
}
func (p *ShortcutCommandToolInfo) IsSetPluginID() bool {
return p.PluginID != nil
}
func (p *ShortcutCommandToolInfo) IsSetPluginAPIName() bool {
return p.PluginAPIName != nil
}
func (p *ShortcutCommandToolInfo) IsSetWorkflowID() bool {
return p.WorkflowID != nil
}
func (p *ShortcutCommandToolInfo) IsSetParams() bool {
return p.Params != nil
}
func (p *ShortcutCommandToolInfo) Read(iprot thrift.TProtocol) (err error) {
@ -15636,6 +16085,38 @@ func (p *ShortcutCommandToolInfo) Read(iprot thrift.TProtocol) (err error) {
} else if err = iprot.Skip(fieldTypeId); err != nil {
goto SkipFieldError
}
case 3:
if fieldTypeId == thrift.I64 {
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.I64 {
if err = p.ReadField5(iprot); err != nil {
goto ReadFieldError
}
} else if err = iprot.Skip(fieldTypeId); err != nil {
goto SkipFieldError
}
case 6:
if fieldTypeId == thrift.LIST {
if err = p.ReadField6(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
@ -15687,6 +16168,62 @@ func (p *ShortcutCommandToolInfo) ReadField2(iprot thrift.TProtocol) error {
p.Type = _field
return nil
}
func (p *ShortcutCommandToolInfo) ReadField3(iprot thrift.TProtocol) error {
var _field *int64
if v, err := iprot.ReadI64(); err != nil {
return err
} else {
_field = &v
}
p.PluginID = _field
return nil
}
func (p *ShortcutCommandToolInfo) ReadField4(iprot thrift.TProtocol) error {
var _field *string
if v, err := iprot.ReadString(); err != nil {
return err
} else {
_field = &v
}
p.PluginAPIName = _field
return nil
}
func (p *ShortcutCommandToolInfo) ReadField5(iprot thrift.TProtocol) error {
var _field *int64
if v, err := iprot.ReadI64(); err != nil {
return err
} else {
_field = &v
}
p.WorkflowID = _field
return nil
}
func (p *ShortcutCommandToolInfo) ReadField6(iprot thrift.TProtocol) error {
_, size, err := iprot.ReadListBegin()
if err != nil {
return err
}
_field := make([]*ShortcutToolParam, 0, size)
values := make([]ShortcutToolParam, size)
for i := 0; i < size; i++ {
_elem := &values[i]
_elem.InitDefault()
if err := _elem.Read(iprot); err != nil {
return err
}
_field = append(_field, _elem)
}
if err := iprot.ReadListEnd(); err != nil {
return err
}
p.Params = _field
return nil
}
func (p *ShortcutCommandToolInfo) Write(oprot thrift.TProtocol) (err error) {
var fieldId int16
@ -15702,6 +16239,22 @@ func (p *ShortcutCommandToolInfo) Write(oprot thrift.TProtocol) (err error) {
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 = oprot.WriteFieldStop(); err != nil {
goto WriteFieldStopError
@ -15752,6 +16305,86 @@ WriteFieldBeginError:
WriteFieldEndError:
return thrift.PrependError(fmt.Sprintf("%T write field 2 end error: ", p), err)
}
func (p *ShortcutCommandToolInfo) writeField3(oprot thrift.TProtocol) (err error) {
if p.IsSetPluginID() {
if err = oprot.WriteFieldBegin("plugin_id", thrift.I64, 3); err != nil {
goto WriteFieldBeginError
}
if err := oprot.WriteI64(*p.PluginID); 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 *ShortcutCommandToolInfo) writeField4(oprot thrift.TProtocol) (err error) {
if p.IsSetPluginAPIName() {
if err = oprot.WriteFieldBegin("plugin_api_name", thrift.STRING, 4); err != nil {
goto WriteFieldBeginError
}
if err := oprot.WriteString(*p.PluginAPIName); 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 *ShortcutCommandToolInfo) writeField5(oprot thrift.TProtocol) (err error) {
if p.IsSetWorkflowID() {
if err = oprot.WriteFieldBegin("workflow_id", thrift.I64, 5); err != nil {
goto WriteFieldBeginError
}
if err := oprot.WriteI64(*p.WorkflowID); 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 *ShortcutCommandToolInfo) writeField6(oprot thrift.TProtocol) (err error) {
if p.IsSetParams() {
if err = oprot.WriteFieldBegin("params", thrift.LIST, 6); err != nil {
goto WriteFieldBeginError
}
if err := oprot.WriteListBegin(thrift.STRUCT, len(p.Params)); err != nil {
return err
}
for _, v := range p.Params {
if err := v.Write(oprot); err != nil {
return err
}
}
if err := oprot.WriteListEnd(); 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 *ShortcutCommandToolInfo) String() string {
if p == nil {
@ -15780,6 +16413,10 @@ type ShortcutCommandInfo struct {
Tool *ShortcutCommandToolInfo `thrift:"tool,8,optional" form:"tool" json:"tool,omitempty" query:"tool"`
//When the multi instruction is executed by which node, it will not be returned without configuration
AgentID *int64 `thrift:"agent_id,9,optional" form:"agent_id" json:"agent_id,string,omitempty" query:"agent_id"`
// chatsdk 使用
SendType *ShortcutSendType `thrift:"send_type,10,optional" form:"send_type" json:"send_type,omitempty" query:"send_type"`
// chatsdk 使用表单的schema
CardSchema *string `thrift:"card_schema,11,optional" form:"card_schema" json:"card_schema,omitempty" query:"card_schema"`
}
func NewShortcutCommandInfo() *ShortcutCommandInfo {
@ -15840,16 +16477,36 @@ func (p *ShortcutCommandInfo) GetAgentID() (v int64) {
return *p.AgentID
}
var ShortcutCommandInfo_SendType_DEFAULT ShortcutSendType
func (p *ShortcutCommandInfo) GetSendType() (v ShortcutSendType) {
if !p.IsSetSendType() {
return ShortcutCommandInfo_SendType_DEFAULT
}
return *p.SendType
}
var ShortcutCommandInfo_CardSchema_DEFAULT string
func (p *ShortcutCommandInfo) GetCardSchema() (v string) {
if !p.IsSetCardSchema() {
return ShortcutCommandInfo_CardSchema_DEFAULT
}
return *p.CardSchema
}
var fieldIDToName_ShortcutCommandInfo = map[int16]string{
1: "id",
2: "name",
3: "command",
4: "description",
5: "query_template",
6: "icon_url",
7: "components",
8: "tool",
9: "agent_id",
1: "id",
2: "name",
3: "command",
4: "description",
5: "query_template",
6: "icon_url",
7: "components",
8: "tool",
9: "agent_id",
10: "send_type",
11: "card_schema",
}
func (p *ShortcutCommandInfo) IsSetComponents() bool {
@ -15864,6 +16521,14 @@ func (p *ShortcutCommandInfo) IsSetAgentID() bool {
return p.AgentID != nil
}
func (p *ShortcutCommandInfo) IsSetSendType() bool {
return p.SendType != nil
}
func (p *ShortcutCommandInfo) IsSetCardSchema() bool {
return p.CardSchema != nil
}
func (p *ShortcutCommandInfo) Read(iprot thrift.TProtocol) (err error) {
var fieldTypeId thrift.TType
var fieldId int16
@ -15954,6 +16619,22 @@ func (p *ShortcutCommandInfo) Read(iprot thrift.TProtocol) (err error) {
} else if err = iprot.Skip(fieldTypeId); err != nil {
goto SkipFieldError
}
case 10:
if fieldTypeId == thrift.STRING {
if err = p.ReadField10(iprot); err != nil {
goto ReadFieldError
}
} else if err = iprot.Skip(fieldTypeId); err != nil {
goto SkipFieldError
}
case 11:
if fieldTypeId == thrift.STRING {
if err = p.ReadField11(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
@ -16091,6 +16772,28 @@ func (p *ShortcutCommandInfo) ReadField9(iprot thrift.TProtocol) error {
p.AgentID = _field
return nil
}
func (p *ShortcutCommandInfo) ReadField10(iprot thrift.TProtocol) error {
var _field *ShortcutSendType
if v, err := iprot.ReadString(); err != nil {
return err
} else {
_field = &v
}
p.SendType = _field
return nil
}
func (p *ShortcutCommandInfo) ReadField11(iprot thrift.TProtocol) error {
var _field *string
if v, err := iprot.ReadString(); err != nil {
return err
} else {
_field = &v
}
p.CardSchema = _field
return nil
}
func (p *ShortcutCommandInfo) Write(oprot thrift.TProtocol) (err error) {
var fieldId int16
@ -16134,6 +16837,14 @@ func (p *ShortcutCommandInfo) Write(oprot thrift.TProtocol) (err error) {
fieldId = 9
goto WriteFieldError
}
if err = p.writeField10(oprot); err != nil {
fieldId = 10
goto WriteFieldError
}
if err = p.writeField11(oprot); err != nil {
fieldId = 11
goto WriteFieldError
}
}
if err = oprot.WriteFieldStop(); err != nil {
goto WriteFieldStopError
@ -16310,6 +17021,42 @@ WriteFieldBeginError:
WriteFieldEndError:
return thrift.PrependError(fmt.Sprintf("%T write field 9 end error: ", p), err)
}
func (p *ShortcutCommandInfo) writeField10(oprot thrift.TProtocol) (err error) {
if p.IsSetSendType() {
if err = oprot.WriteFieldBegin("send_type", thrift.STRING, 10); err != nil {
goto WriteFieldBeginError
}
if err := oprot.WriteString(*p.SendType); err != nil {
return err
}
if err = oprot.WriteFieldEnd(); err != nil {
goto WriteFieldEndError
}
}
return nil
WriteFieldBeginError:
return thrift.PrependError(fmt.Sprintf("%T write field 10 begin error: ", p), err)
WriteFieldEndError:
return thrift.PrependError(fmt.Sprintf("%T write field 10 end error: ", p), err)
}
func (p *ShortcutCommandInfo) writeField11(oprot thrift.TProtocol) (err error) {
if p.IsSetCardSchema() {
if err = oprot.WriteFieldBegin("card_schema", thrift.STRING, 11); err != nil {
goto WriteFieldBeginError
}
if err := oprot.WriteString(*p.CardSchema); err != nil {
return err
}
if err = oprot.WriteFieldEnd(); err != nil {
goto WriteFieldEndError
}
}
return nil
WriteFieldBeginError:
return thrift.PrependError(fmt.Sprintf("%T write field 11 begin error: ", p), err)
WriteFieldEndError:
return thrift.PrependError(fmt.Sprintf("%T write field 11 end error: ", p), err)
}
func (p *ShortcutCommandInfo) String() string {
if p == nil {

View File

@ -38,6 +38,7 @@ import (
"github.com/coze-dev/coze-studio/backend/api/model/data/database/table"
"github.com/coze-dev/coze-studio/backend/api/model/playground"
"github.com/coze-dev/coze-studio/backend/application/base/ctxutil"
"github.com/coze-dev/coze-studio/backend/crossdomain/contract/agent"
crossdatabase "github.com/coze-dev/coze-studio/backend/crossdomain/contract/database"
"github.com/coze-dev/coze-studio/backend/domain/agent/singleagent/entity"
singleagent "github.com/coze-dev/coze-studio/backend/domain/agent/singleagent/service"
@ -733,16 +734,64 @@ func (s *SingleAgentApplicationService) getAgentInfo(ctx context.Context, botID
sc := &bot_common.ShortcutCommandComponent{
Name: i.Name,
Description: i.Description,
Type: i.InputType.String(),
Type: getShortcutCommandComponentType(i.InputType),
ToolParameter: ptr.Of(i.Parameter),
Options: i.Options,
IsHide: i.Hide,
}
if i.DefaultValue != nil {
sc.DefaultValue = ptr.Of(i.DefaultValue.Value)
}
switch i.InputType {
case playground.InputType_Select:
sc.Options = i.Options
case playground.InputType_MixUpload:
options := make([]string, 0, len(i.UploadOptions))
for _, uploadOption := range i.UploadOptions {
options = append(options, string(getShortcutCommandComponentFileType(uploadOption)))
}
sc.Options = options
case playground.InputType_UploadImage, playground.InputType_UploadDoc, playground.InputType_UploadTable, playground.InputType_UploadAudio,
playground.InputType_VIDEO, playground.InputType_ARCHIVE, playground.InputType_CODE, playground.InputType_TXT,
playground.InputType_PPT:
sc.Options = []string{string(getShortcutCommandComponentFileType(i.InputType))}
default:
}
return sc
}),
Tool: &bot_common.ShortcutCommandToolInfo{
Name: si.ToolInfo.ToolName,
Type: func() string {
if si.ToolType == 1 {
return string(agent.ShortcutCommandToolTypePlugin)
}
if si.ToolType == 2 {
return string(agent.ShortcutCommandToolTypeWorkflow)
}
return ""
}(),
PluginID: ptr.Of(si.PluginID),
WorkflowID: ptr.Of(si.WorkFlowID),
PluginAPIName: &si.PluginToolName,
Params: slices.Transform(si.ToolInfo.ToolParamsList, func(i *playground.ToolParams) *bot_common.ShortcutToolParam {
return &bot_common.ShortcutToolParam{
Name: i.Name,
Type: i.Type,
DefaultValue: i.DefaultValue,
IsReferComponent: i.ReferComponent,
IsRequired: i.Required,
Description: i.Desc,
}
}),
},
SendType: func() *bot_common.ShortcutSendType {
if si.SendType == 1 {
return ptr.Of(bot_common.ShortcutSendTypePanel)
}
return ptr.Of(bot_common.ShortcutSendTypeQuery)
}(),
CardSchema: ptr.Of(si.CardSchema),
}
})
@ -767,3 +816,12 @@ func (s *SingleAgentApplicationService) OpenGetBotInfo(ctx context.Context, req
resp.Data = agentInfo
return resp, nil
}
func getShortcutCommandComponentType(inputType playground.InputType) string {
componentType := agent.ShortcutCommandComponentTypeMapping[inputType]
return string(componentType)
}
func getShortcutCommandComponentFileType(inputType playground.InputType) string {
return string(agent.ShortcutCommandComponentFileTypeMapping[inputType])
}

View File

@ -23,6 +23,7 @@ import (
"github.com/coze-dev/coze-studio/backend/api/model/crossdomain/agentrun"
"github.com/coze-dev/coze-studio/backend/api/model/crossdomain/singleagent"
"github.com/coze-dev/coze-studio/backend/api/model/playground"
)
// Requests and responses must not reference domain entities and can only use models under api/model/crossdomain.
@ -59,3 +60,60 @@ func DefaultSVC() SingleAgent {
func SetDefaultSVC(svc SingleAgent) {
defaultSVC = svc
}
type ShortcutCommandComponentType string
const (
ShortcutCommandComponentTypeText ShortcutCommandComponentType = "text"
ShortcutCommandComponentTypeSelect ShortcutCommandComponentType = "select"
ShortcutCommandComponentTypeFile ShortcutCommandComponentType = "file"
)
var ShortcutCommandComponentTypeMapping = map[playground.InputType]ShortcutCommandComponentType{
playground.InputType_TextInput: ShortcutCommandComponentTypeText,
playground.InputType_Select: ShortcutCommandComponentTypeSelect,
playground.InputType_MixUpload: ShortcutCommandComponentTypeFile,
playground.InputType_UploadImage: ShortcutCommandComponentTypeFile,
playground.InputType_UploadDoc: ShortcutCommandComponentTypeFile,
playground.InputType_UploadTable: ShortcutCommandComponentTypeFile,
playground.InputType_UploadAudio: ShortcutCommandComponentTypeFile,
playground.InputType_VIDEO: ShortcutCommandComponentTypeFile,
playground.InputType_ARCHIVE: ShortcutCommandComponentTypeFile,
playground.InputType_CODE: ShortcutCommandComponentTypeFile,
playground.InputType_TXT: ShortcutCommandComponentTypeFile,
playground.InputType_PPT: ShortcutCommandComponentTypeFile,
}
type ShortcutCommandComponentFileType string
const (
ShortcutCommandComponentFileTypeImage ShortcutCommandComponentFileType = "image"
ShortcutCommandComponentFileTypeDoc ShortcutCommandComponentFileType = "doc"
ShortcutCommandComponentFileTypeTable ShortcutCommandComponentFileType = "table"
ShortcutCommandComponentFileTypeAudio ShortcutCommandComponentFileType = "audio"
ShortcutCommandComponentFileTypeVideo ShortcutCommandComponentFileType = "video"
ShortcutCommandComponentFileTypeZip ShortcutCommandComponentFileType = "zip"
ShortcutCommandComponentFileTypeCode ShortcutCommandComponentFileType = "code"
ShortcutCommandComponentFileTypeTxt ShortcutCommandComponentFileType = "txt"
ShortcutCommandComponentFileTypePPT ShortcutCommandComponentFileType = "ppt"
)
var ShortcutCommandComponentFileTypeMapping = map[playground.InputType]ShortcutCommandComponentFileType{
playground.InputType_UploadImage: ShortcutCommandComponentFileTypeImage,
playground.InputType_UploadDoc: ShortcutCommandComponentFileTypeDoc,
playground.InputType_UploadTable: ShortcutCommandComponentFileTypeTable,
playground.InputType_UploadAudio: ShortcutCommandComponentFileTypeAudio,
playground.InputType_VIDEO: ShortcutCommandComponentFileTypeVideo,
playground.InputType_ARCHIVE: ShortcutCommandComponentFileTypeZip,
playground.InputType_CODE: ShortcutCommandComponentFileTypeCode,
playground.InputType_TXT: ShortcutCommandComponentFileTypeTxt,
playground.InputType_PPT: ShortcutCommandComponentFileTypePPT,
}
type ShortcutCommandToolType string
const (
ShortcutCommandToolTypeWorkflow ShortcutCommandToolType = "workflow"
ShortcutCommandToolTypePlugin ShortcutCommandToolType = "plugin"
)

View File

@ -487,10 +487,26 @@ struct ShortcutCommandComponent { // Panel parameters
7 : bool is_hide // Whether to hide or not to show, the shortcut command of the online bot tool type does not return the component with hide = true
}
struct ShortcutToolParam {
1: string name
2: bool is_required
3: string description
4: string type
5: string default_value
6: bool is_refer_component
}
struct ShortcutCommandToolInfo {
1: string name //
2: string type // Tool type workflow plugin
3: optional i64 plugin_id (api.js_conv="true")
4: optional string plugin_api_name
5: optional i64 workflow_id (api.js_conv="true")
6: optional list<ShortcutToolParam> params
}
typedef string ShortcutSendType
const ShortcutSendType ShortcutSendTypeQuery = 'query'
const ShortcutSendType ShortcutSendTypePanel = 'panel'
struct ShortcutCommandInfo {
1: i64 id (api.js_conv="true") // Quick Command ID
@ -502,6 +518,8 @@ struct ShortcutCommandInfo {
7: optional list<ShortcutCommandComponent> components // Component list (parameter list)
8: optional ShortcutCommandToolInfo tool // Tool information
9: optional i64 agent_id (api.js_conv="true") //When the multi instruction is executed by which node, it will not be returned without configuration
10: optional ShortcutSendType send_type // chatsdk used
11: optional string card_schema // chatsdk schema
}