liudong
2024-08-17 f848280fe3ed8841147fcc8f26a788580b82ae0c
src/views/dmx/agent/components/editAgent.vue
@@ -19,48 +19,87 @@
    title-align="start"
    fullscreen
  >
  <div class="main-container">
    <div class="main-container-lf">
      <div style="padding: 10px;font-size: 16px;background: var(--color-neutral-3);">智能体配置</div>
      <div style="display: flex;width: 100%;" :style="{height:height}">
        <div style="width: 50%;height: 100%">
          <div style="padding: 10px;font-size: 12px;color: #2a2a2b;">智能体画像</div>
          <div>
            <a-textarea v-model="system" placeholder="" disabled style="height: 400px;"  />
    <div class="main-container">
      <div class="main-container-lf">
        <div
          style="
            padding: 10px;
            font-size: 16px;
            background: var(--color-neutral-3);
          "
          >智能体配置</div
        >
        <div style="display: flex; width: 100%" :style="{ height: height }">
          <div style="width: 50%; height: 100%">
            <div style="padding: 10px; font-size: 12px; color: #2a2a2b"
              >智能体画像</div
            >
            <div>
              <a-textarea
                v-model="system"
                placeholder=""
                disabled
                style="height: 400px"
              />
            </div>
          </div>
        </div>
        <div style="width: 50%;border: 1px solid var(--color-neutral-3);background:  var(--color-neutral-3)">
          <a-form ref="formRef" :rules="rules" :model="form" @submit="handleSubmit"  layout="vertical" >
            <a-collapse :default-active-key="['1']">
              <a-collapse-item header="基础信息" key="0" v-if="typeAngint == 'edit'">
                <a-input v-model="form.name" placeholder="请输入智能体名称"  style="width:200px;margin-top: 10px" />
              </a-collapse-item>
              <a-collapse-item header="AI模型配置" key="1">
                <a-form-item field="llm_id" label="模型">
                  <a-space direction="vertical" size="large">
                    <a-select :size="'large'" field="llm_id" v-model="form.llm_id" :style="{width:'25rem'}" placeholder="请选择 ...">
                      <a-optgroup
                        :label="index"
                        v-for="(item, index) in modelList"
                        :key="index"
          <div
            style="
              width: 50%;
              border: 1px solid var(--color-neutral-3);
              background: var(--color-neutral-3);
            "
          >
            <a-form
              ref="formRef"
              :rules="rules"
              :model="form"
              @submit="handleSubmit"
              layout="vertical"
            >
              <a-collapse :default-active-key="['1']">
                <a-collapse-item
                  header="基础信息"
                  key="0"
                  v-if="typeAngint == 'edit'"
                >
                  <a-input
                    v-model="form.name"
                    placeholder="请输入智能体名称"
                    style="width: 200px; margin-top: 10px"
                  />
                </a-collapse-item>
                <a-collapse-item header="AI模型配置" key="1">
                  <a-form-item field="llm_id" label="模型">
                    <a-space direction="vertical" size="large">
                      <a-select
                        :size="'large'"
                        field="llm_id"
                        v-model="form.llm_id"
                        :style="{ width: '25rem' }"
                        placeholder="请选择 ..."
                      >
                        <a-option
                          v-for="obj in item"
                          :key="obj.fid"
                          :disabled="!obj.available"
                          :value="obj.llm_id"
                        <a-optgroup
                          :label="index"
                          v-for="(item, index) in modelList"
                          :key="index"
                        >
                          {{ obj.llm_name }}
                        </a-option>
                      </a-optgroup>
                    </a-select>
                  </a-space>
                </a-form-item>
                          <a-option
                            v-for="obj in item"
                            :key="obj.fid"
                            :disabled="!obj.available"
                            :value="obj.llm_id"
                          >
                            {{ obj.llm_name }}
                          </a-option>
                        </a-optgroup>
                      </a-select>
                    </a-space>
                  </a-form-item>
                </a-collapse-item>
                <a-collapse-item header="开场引导" :key="'2'" disabled>
                </a-collapse-item>
                <a-collapse-item  header="知识库" key="3">
                <a-collapse-item header="知识库" key="3">
                  <a-form-item field="kb_ids" label="知识库">
                    <a-select
                      v-model="form.kb_ids"
@@ -72,7 +111,7 @@
                        v-for="item in tabs"
                        :key="item.id"
                        :value="item.id"
                      >{{ item.name }}</a-option
                        >{{ item.name }}</a-option
                      >
                    </a-select>
                  </a-form-item>
@@ -119,8 +158,8 @@
  import useLoading from '@/hooks/loading';
  import { dialogSet } from '@/api/Agent';
  import { Message } from '@arco-design/web-vue';
  import EventBus from "@/utils/EventBus";
  import sessionAction  from "@/views/dmx/IntelligentAgent/components/sessionAction.vue";
  import EventBus from '@/utils/EventBus';
  import sessionAction from '@/views/dmx/IntelligentAgent/components/sessionAction.vue';
  const { setLoading } = useLoading(true);
  const props = defineProps(['typeAngint', 'formData']);
  const visible = ref(false);
@@ -193,7 +232,7 @@
  const handleSubmit = async ({ values, errors }) => {
    // console.log('values:', values, '\nerrors:', errors)
    if(!errors){
    if (!errors) {
      let title = '创建成功';
      let formNew = { ...form };
      if (props.typeAngint == 'edit') {
@@ -224,9 +263,9 @@
    visible.value = true;
    nextTick(() => {
      Object.assign(form, data);
      console.log(form,'传值');
      console.log(form, '传值');
      system.value = form.prompt_config.system;
      if(tabs.value && tabs.value.length>0){
      if (tabs.value && tabs.value.length > 0) {
        form.kb_ids = [tabs.value[0].id];
      }
    });
@@ -325,8 +364,8 @@
      line-height: 40px;
    }
  }
  :deep(.arco-textarea-wrapper.arco-textarea-disabled){
      background: var(--color-bg-2);
      color: var(--color-text-1);
  :deep(.arco-textarea-wrapper.arco-textarea-disabled) {
    background: var(--color-bg-2);
    color: var(--color-text-1);
  }
</style>