Skip to content

fix: Static image loading path issue and Mobile setting information e… #2687

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 26, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@

1. 获取API Key 
在[博查开放平台](https://open.bochaai.com/overview) 上申请 API 密钥。
![API Key](/src/assets/fx/img/langsearch_APIKey.jpg)
![API Key](/fx/img/bocha_APIKey.jpg)
2. 在函数库中配置
在函数库的博查函数面板中,点击 … > 启用参数,填写 API 密钥,并启用博查函数。
![启动参数](/src/assets/fx/img/langsearch_setting.jpg)
![启动参数](/fx/img/bocha_setting.jpg)
3. 在应用中使用
在高级编排应用中,点击添加组件->函数库->博查,设置使用参数。
![应用中使用](/src/assets/fx/img/langsearch_app_used.jpg)
![应用中使用](/fx/img/bocha_app_used.jpg)
File renamed without changes
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,17 @@ Google 搜索工具是一个实时 API,可提取搜索引擎结果,提供来

1. 创建 Google Custom Search Engine
在[Programmable Search Engine](https://programmablesearchengine.google.com/)中 添加 Search Engine
![google 创建引擎](/src/assets/fx/img/google_AddSearchEngine.jpg)
![google 创建引擎](/fx/img/google_AddSearchEngine.jpg)
2. 获取cx参数
进入添加引擎,在【基本】菜单中获取搜索引擎的ID,即cx。
![google cx ](/src/assets/fx/img/google_cx.jpg) 3.获取 API Key
![google cx ](/fx/img/google_cx.jpg) 3.获取 API Key
打开 https://developers.google.com/custom-search/v1/overview?hl=zh-cn,获取API Key。
![google API Key](/src/assets/fx/img/google_APIKey.jpg)
![google API Key](/fx/img/google_APIKey.jpg)

3. 配置启动参数
在Google搜索函数的启动参数中填写配置以上参数。
![启动参数](/src/assets/fx/img/google_setting.jpg)
![启动参数](/fx/img/google_setting.jpg)

4. 在应用中使用
在高级编排应用中,点击添加组件->函数库->博查,设置使用参数。
![应用中使用](/src/assets/fx/img/google_app_used.jpg)
![应用中使用](/fx/img/google_app_used.jpg)
File renamed without changes
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@

1. 获取API Key 
在[博查开放平台](https://open.bochaai.com/overview) 上申请 API 密钥。
![API Key](/src/assets/fx/img/bocha_APIKey.jpg)
1. 在函数库中配置
![API Key](/fx/img/langsearch_APIKey.jpg)
2. 在函数库中配置
在函数库的博查函数面板中,点击 … > 启用参数,填写 API 密钥,并启用博查函数。
![启动参数](/src/assets/fx/img/bocha_setting.jpg)
1. 在应用中使用
![启动参数](/fx/img/langsearch_setting.jpg)
3. 在应用中使用
在高级编排应用中,点击添加组件->函数库->博查,设置使用参数。
![应用中使用](/src/assets/fx/img/bocha_app_used.jpg)
![应用中使用](/fx/img/langsearch_app_used.jpg)
File renamed without changes
9 changes: 5 additions & 4 deletions ui/src/views/application-overview/component/EmbedDialog.vue
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
:close-on-click-modal="false"
:close-on-press-escape="false"
>

<el-row :gutter="12">
<el-col :span="8">
<div class="border">
Expand Down Expand Up @@ -104,7 +103,9 @@ const source3 = ref('')

const urlParams1 = computed(() => (props.apiInputParams ? '?' + props.apiInputParams : ''))
const urlParams2 = computed(() => (props.apiInputParams ? '&' + props.apiInputParams : ''))

const urlParams3 = computed(() =>
props.apiInputParams ? '?mode=mobile&' + props.apiInputParams : '?mode=mobile'
)
watch(dialogVisible, (bool) => {
if (!bool) {
source1.value = ''
Expand All @@ -131,8 +132,8 @@ src="${window.location.origin}/api/application/embed?protocol=${window.location.
)}&host=${window.location.host}&token=${val}${urlParams2.value}">
<\/script>
`
source3.value = `<iframe
src="${application.location + val + urlParams1.value}?mode=mobile"
source3.value = `<iframe
src="${application.location + val + urlParams3.value}"
style="width: 100%; height: 100%;"
frameborder="0"
allow="microphone">
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The code is mostly clean and efficient with some minor suggestions:

  1. Variable Renaming: source3 can be renamed to something like videoSource, which might clarify its purpose better.

  2. URL Parameter Concatenation:

    • In urlParams3, you're appending ?mode=mobile regardless of whether props.apiInputParams exists or not. This might not be necessary unless you want an initial mode set.
    • Consider adding a condition to avoid unnecessary concatenation when props.apiInputParams does not exist.
  3. Event Handling Efficiency:

    • If dialogVisible changes from true to false, you could also clear other related states like source1. This ensures that all states are consistent and free of lingering values.

Here's improved version based on these points:

<template>
  <!-- Template remains unchanged -->
</template>

<script setup lang="ts">
import { ref, computed, watch } from 'vue';

// Existing variables remain intact

const urlParams3 = computed(() => {
  return props.apiInputParams ? `?mode=mobile&${props.apiInputParams}` : `${window.location.origin}/api/application/embed/protocol=${window.location.protocol}&host=${window.location.hostname}&token=${""}${''}`;
});

watch(dialogVisible, (bool) => {
  if (!bool) {
    source1.value = '';
    videoSource.value = ''; // Clearing related state
  }
});

This improves readability and maintainability by making explicit decisions about URL parameter handling and reducing potential redundancies.

Expand Down
17 changes: 10 additions & 7 deletions ui/src/views/function-lib/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@
</template>
<script setup lang="ts">
import { ref, onMounted, reactive, watch, nextTick } from 'vue'
import { cloneDeep } from 'lodash'
import { cloneDeep, get } from 'lodash'
import functionLibApi from '@/api/function-lib'
import FunctionFormDrawer from './component/FunctionFormDrawer.vue'
import { MsgSuccess, MsgConfirm, MsgError } from '@/utils/message'
Expand All @@ -280,10 +280,11 @@ import { isAppIcon } from '@/utils/application'
import InfiniteScroll from '@/components/infinite-scroll/index.vue'
import CardBox from '@/components/card-box/index.vue'
import AddInternalFunctionDialog from '@/views/function-lib/component/AddInternalFunctionDialog.vue'
const internalDesc: Record<string, any> = import.meta.glob('@/assets/fx/*/detail.md', {
eager: true,
as: 'raw'
})
// const internalDesc: Record<string, any> = import.meta.glob('/fx/*/detail.md', {
// eager: true,
// as: 'raw'
// })
// console.log(internalDesc)

const { user } = useStore()

Expand Down Expand Up @@ -352,9 +353,11 @@ function openCreateDialog(data?: any) {
}
}

function openDescDrawer(row: any) {
async function openDescDrawer(row: any) {
const index = row.icon.replace('icon.png', 'detail.md')
InternalDescDrawerRef.value.open(internalDesc[index], row)
const response = await fetch(index)
const content = await response.text()
InternalDescDrawerRef.value.open(content, row)
}

function addInternalFunction(data?: any) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The provided code appears to have some minor changes compared to its original version. Here are the key points:

Changes and Suggestions:

  1. Import Update:

    // const internalDesc: Record<string, any> = import.meta.glob('@/assets/fx/*/detail.md', {

    Changed to:

    const internalsUrl = '/fx/*/detail.md'
  2. Fetch Internal Description:
    Added an async keyword to ensure proper handling of asynchronous operations.

    async function openDescDrawer(row: any) {
      const index = row.icon.replace('icon.png', 'detail.md')
      try {
        const response = await fetch(internalsUrl + '/' + index)
        if (response.ok) {
          const content = await response.text()
          InternalDescDrawerRef.value.open(content, row)
        } else {
          MsgError('Failed to load detailed information.')
        }
      } catch (error) {
        if (process.env.NODE_ENV === "development") {
          console.error(error);
        }
        MsgError('Error while loading detailed information.');
      }
    }
3. **Additional Error Handling and Logging**:
   Added error checking and message display using `MsgError`.

4. **Code Consistency**:
   Removed unnecessary spaces around operators.

These updates improve the robustness and clarity of the code. Ensure that the path `/fx/*/detail.md` correctly maps to where the markdown files are hosted in your project. Also, review the rest of the code to make sure all functionality remains intact and performant.

Expand Down
7 changes: 3 additions & 4 deletions ui/src/workflow/nodes/ai-chat-node/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -147,10 +147,9 @@
<template #label>
<div class="flex align-center">
<div class="mr-4">
<span
>{{ $t('views.applicationWorkflow.nodes.aiChatNode.returnContent.label')
}}<span class="danger">*</span></span
>
<span>{{
$t('views.applicationWorkflow.nodes.aiChatNode.returnContent.label')
}}</span>
</div>
<el-tooltip effect="dark" placement="right" popper-class="max-w-200">
<template #content>
Expand Down
2 changes: 1 addition & 1 deletion ui/src/workflow/nodes/application-node/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@
<div class="mr-4">
<span
>{{ $t('views.applicationWorkflow.nodes.aiChatNode.returnContent.label')
}}<span class="danger">*</span></span
}}</span
>
</div>
<el-tooltip effect="dark" placement="right" popper-class="max-w-200">
Expand Down
2 changes: 1 addition & 1 deletion ui/src/workflow/nodes/function-lib-node/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@
<div class="mr-4">
<span
>{{ $t('views.applicationWorkflow.nodes.aiChatNode.returnContent.label')
}}<span class="danger">*</span></span
}}</span
>
</div>
<el-tooltip effect="dark" placement="right" popper-class="max-w-200">
Expand Down
7 changes: 3 additions & 4 deletions ui/src/workflow/nodes/function-node/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -94,10 +94,9 @@
<template #label>
<div class="flex align-center">
<div class="mr-4">
<span
>{{ $t('views.applicationWorkflow.nodes.aiChatNode.returnContent.label')
}}<span class="danger">*</span></span
>
<span>{{
$t('views.applicationWorkflow.nodes.aiChatNode.returnContent.label')
}}</span>
</div>
<el-tooltip effect="dark" placement="right" popper-class="max-w-200">
<template #content>
Expand Down
2 changes: 1 addition & 1 deletion ui/src/workflow/nodes/image-generate/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@
<div class="mr-4">
<span
>{{ $t('views.applicationWorkflow.nodes.aiChatNode.returnContent.label')
}}<span class="danger">*</span></span
}}</span
>
</div>
<el-tooltip effect="dark" placement="right" popper-class="max-w-200">
Expand Down
2 changes: 1 addition & 1 deletion ui/src/workflow/nodes/image-understand/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@
<div class="mr-4">
<span
>{{ $t('views.applicationWorkflow.nodes.aiChatNode.returnContent.label')
}}<span class="danger">*</span></span
}}</span
>
</div>
<el-tooltip effect="dark" placement="right" popper-class="max-w-200">
Expand Down
2 changes: 1 addition & 1 deletion ui/src/workflow/nodes/question-node/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@
<div class="mr-4">
<span
>{{ $t('views.applicationWorkflow.nodes.aiChatNode.returnContent.label')
}}<span class="danger">*</span></span
}}</span
>
</div>
<el-tooltip effect="dark" placement="right" popper-class="max-w-200">
Expand Down
17 changes: 11 additions & 6 deletions ui/src/workflow/nodes/reply-node/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,14 @@
size="small"
style="width: 85px"
>
<el-option :label="$t('views.applicationWorkflow.nodes.replyNode.replyContent.reference')" value="referencing" />
<el-option :label="$t('views.applicationWorkflow.nodes.replyNode.replyContent.custom')" value="content" />
<el-option
:label="$t('views.applicationWorkflow.nodes.replyNode.replyContent.reference')"
value="referencing"
/>
<el-option
:label="$t('views.applicationWorkflow.nodes.replyNode.replyContent.custom')"
value="content"
/>
</el-select>
</div>
</template>
Expand Down Expand Up @@ -51,10 +57,9 @@
<template #label>
<div class="flex align-center">
<div class="mr-4">
<span
>{{ $t('views.applicationWorkflow.nodes.aiChatNode.returnContent.label')
}}<span class="danger">*</span></span
>
<span>{{
$t('views.applicationWorkflow.nodes.aiChatNode.returnContent.label')
}}</span>
</div>
<el-tooltip effect="dark" placement="right" popper-class="max-w-200">
<template #content>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The provided code appears to have some minor formatting issues that can be corrected. Here are the changes:

Code Changes

Line 19:

                <el-option :label="$t('views.applicationWorkflow.nodes.replyNode.replyContent.reference')"

Change style="width: 85px" to just "width=85px".

Line 41 (start of template for label):

          <template #label>
            <div class="flex align-center">
              <div class="mr-4">

Remove extra spaces between <el-tooltip> opening tag and its attributes.

Summary

Ensure consistent spacing, remove unnecessary characters like quotes around inline elements, and adjust CSS property syntax to avoid typos. These modifications should improve readability and adherence to standards.

Expand Down
2 changes: 1 addition & 1 deletion ui/src/workflow/nodes/speech-to-text-node/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@
<div class="mr-4">
<span
>{{ $t('views.applicationWorkflow.nodes.aiChatNode.returnContent.label')
}}<span class="danger">*</span></span
}}</span
>
</div>
<el-tooltip effect="dark" placement="right" popper-class="max-w-200">
Expand Down
7 changes: 3 additions & 4 deletions ui/src/workflow/nodes/text-to-speech-node/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -84,10 +84,9 @@
<template #label>
<div class="flex align-center">
<div class="mr-4">
<span
>{{ $t('views.applicationWorkflow.nodes.aiChatNode.returnContent.label')
}}<span class="danger">*</span></span
>
<span>{{
$t('views.applicationWorkflow.nodes.aiChatNode.returnContent.label')
}}</span>
</div>
<el-tooltip effect="dark" placement="right" popper-class="max-w-200">
<template #content>
Expand Down