Skip to content

Commit a63467d

Browse files
authored
优化建议模式;修复多索引训练失败问题 (#1043)
* doc * Optimize possible null Pointers and parts of Ux * fix: mulity index training error
1 parent 9d27de1 commit a63467d

File tree

11 files changed

+407
-28
lines changed

11 files changed

+407
-28
lines changed

.github/ISSUE_TEMPLATE/config.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
blank_issues_enabled: false
22
contact_links:
33
- name: 微信交流群
4-
url: https://doc.fastgpt.in/wechat-fastgpt.webp
4+
url: https://oss.laf.run/htr4n1-images/fastgpt-qr-code.jpg
55
about: FastGPT 全是问题群

packages/service/core/dataset/training/controller.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ import { getCollectionWithDataset } from '../controller';
99
import { TrainingModeEnum } from '@fastgpt/global/core/dataset/constants';
1010
import { simpleText } from '@fastgpt/global/common/string/tools';
1111
import { countPromptTokens } from '@fastgpt/global/common/string/tiktoken';
12-
import type { VectorModelItemType, LLMModelItemType } from '@fastgpt/global/core/ai/model.d';
1312

1413
export const lockTrainingDataByTeamId = async (teamId: string): Promise<any> => {
1514
try {

packages/service/core/workflow/dispatch/agent/runTool/promptCall.ts

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,15 @@ export const runToolWithPromptCall = async (
164164
parseAnswerResult.toolName = toolModule.name;
165165
parseAnswerResult.toolAvatar = toolModule.avatar;
166166

167+
// run tool flow
168+
const startParams = (() => {
169+
try {
170+
return json5.parse(parseAnswerResult.arguments);
171+
} catch (error) {
172+
return {};
173+
}
174+
})();
175+
167176
// SSE response to client
168177
if (stream && detail) {
169178
responseWrite({
@@ -182,15 +191,6 @@ export const runToolWithPromptCall = async (
182191
});
183192
}
184193

185-
// run tool flow
186-
const startParams = (() => {
187-
try {
188-
return json5.parse(parseAnswerResult.arguments);
189-
} catch (error) {
190-
return {};
191-
}
192-
})();
193-
194194
const moduleRunResponse = await dispatchWorkFlow({
195195
...props,
196196
runtimeModules: runtimeModules.map((module) => ({
@@ -374,7 +374,7 @@ const parseAnswer = (str: string): FunctionCallCompletion | string => {
374374
return {
375375
id: getNanoid(),
376376
name: toolCall.toolId,
377-
arguments: JSON.stringify(toolCall.arguments)
377+
arguments: JSON.stringify(toolCall.arguments || toolCall.parameters)
378378
};
379379
} catch (error) {
380380
return str;

packages/service/core/workflow/dispatch/agent/runTool/toolChoice.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -332,8 +332,8 @@ async function streamResponse({
332332

333333
const responseChoice = part.choices?.[0]?.delta;
334334
// console.log(JSON.stringify(responseChoice, null, 2));
335-
if (responseChoice.content) {
336-
const content = responseChoice?.content || '';
335+
if (responseChoice?.content) {
336+
const content = responseChoice.content || '';
337337
textAnswer += content;
338338

339339
responseWrite({
@@ -343,7 +343,7 @@ async function streamResponse({
343343
text: content
344344
})
345345
});
346-
} else if (responseChoice.tool_calls?.[0]) {
346+
} else if (responseChoice?.tool_calls?.[0]) {
347347
const toolCall: ChatCompletionMessageToolCall = responseChoice.tool_calls[0];
348348

349349
// 流响应中,每次只会返回一个工具. 如果带了 id,说明是执行一个工具

projects/app/public/locales/en/common.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1334,6 +1334,7 @@
13341334
"Not sufficient": "Your AI points are insufficient, please upgrade the package or purchase additional AI points before continuing to use.",
13351335
"Pay error": "Pay error",
13361336
"Pay success": "Pay success",
1337+
"Plan expired time": "Plan expired time",
13371338
"Standard Plan Detail": "Standard Plan Detail",
13381339
"To read plan": "Read plan",
13391340
"bill": {

projects/app/public/locales/zh/common.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1336,6 +1336,7 @@
13361336
"Not sufficient": "您的 AI 积分不足,请先升级套餐或购买额外 AI 积分后继续使用。",
13371337
"Pay error": "支付失败",
13381338
"Pay success": "支付成功",
1339+
"Plan expired time": "套餐到期时间",
13391340
"Standard Plan Detail": "套餐详情",
13401341
"To read plan": "查看套餐",
13411342
"bill": {

projects/app/src/pages/account/components/Info.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -397,15 +397,15 @@ const PlanUsage = () => {
397397
<Box fontWeight={'bold'} fontSize="xl">
398398
{t(planName)}
399399
</Box>
400+
<Flex mt="2" color={'#485264'} fontSize="sm">
401+
<Box>{t('support.wallet.Plan expired time')}:</Box>
402+
<Box ml={2}>{formatTime2YMD(standardPlan?.expiredTime)}</Box>
403+
</Flex>
400404
{isFreeTeam && (
401-
<Box mt="3" color={'#485264'} fontSize="sm">
405+
<Box mt="2" color={'#485264'} fontSize="sm">
402406
免费版用户15天无任何使用记录时,系统会自动清理账号知识库。
403407
</Box>
404408
)}
405-
<Flex mt="3" color={'#485264'} fontSize="sm">
406-
<Box>{t('common.Expired Time')}:</Box>
407-
<Box ml={2}>{formatTime2YMD(standardPlan?.expiredTime)}</Box>
408-
</Flex>
409409
</Box>
410410
<Button onClick={() => router.push('/price')}>
411411
{t('support.wallet.subscription.Upgrade plan')}

projects/app/src/pages/account/components/InformTable.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import MyIcon from '@fastgpt/web/components/common/Icon';
88
import { usePagination } from '@fastgpt/web/hooks/usePagination';
99
import { useLoading } from '@fastgpt/web/hooks/useLoading';
1010

11-
const BillTable = () => {
11+
const InformTable = () => {
1212
const theme = useTheme();
1313
const { Loading } = useLoading();
1414
const { isPc } = useSystemStore();
@@ -87,4 +87,4 @@ const BillTable = () => {
8787
);
8888
};
8989

90-
export default BillTable;
90+
export default InformTable;

projects/app/src/pages/app/detail/components/SimpleEdit/ToolSelectModal.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@ const RenderList = React.memo(function RenderList({
207207
return templates.length === 0 && !isLoadingData ? (
208208
<EmptyTip text={t('core.app.ToolCall.No plugin')} />
209209
) : (
210-
<MyBox isLoading={isLoading}>
210+
<MyBox>
211211
{templates.map((item, i) => {
212212
const selected = !!selectedTools.find((tool) => tool.id === item.id);
213213
return (
@@ -257,6 +257,7 @@ const RenderList = React.memo(function RenderList({
257257
size={'sm'}
258258
variant={'whiteBase'}
259259
leftIcon={<AddIcon fontSize={'10px'} />}
260+
isLoading={isLoading}
260261
onClick={() => onClickAdd(item)}
261262
>
262263
{t('common.Add')}

projects/app/src/service/core/dataset/data/controller.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,8 @@ export async function insertData2Dataset({
4444
indexes =
4545
Array.isArray(indexes) && indexes.length > 0
4646
? indexes.map((index) => ({
47-
...index,
47+
// @ts-ignore
48+
...index.toObject(),
4849
dataId: undefined,
4950
defaultIndex: index.text.trim() === qaStr
5051
}))

0 commit comments

Comments
 (0)