-
Notifications
You must be signed in to change notification settings - Fork 4.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
190 additions
and
69 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,9 @@ | ||
import { PluginTemplateType } from '@fastgpt/global/core/plugin/type.d'; | ||
import { SystemPluginTemplateItemType } from '@fastgpt/global/core/workflow/type'; | ||
|
||
export type SystemPluginResponseType = Promise<Record<string, any>>; | ||
|
||
declare global { | ||
var communitySystemPlugins: SystemPluginTemplateItemType[]; | ||
var communitySystemPluginCb: Record<string, (e: any) => SystemPluginResponseType>; | ||
var systemPlugins: SystemPluginTemplateItemType[]; | ||
var systemPluginCb: Record<string, (e: any) => SystemPluginResponseType>; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import { PluginRuntimeType } from '@fastgpt/global/core/workflow/runtime/type'; | ||
import { ChatNodeUsageType } from '@fastgpt/global/support/wallet/bill/type'; | ||
import { splitCombinePluginId } from './controller'; | ||
import { PluginSourceEnum } from '@fastgpt/global/core/plugin/constants'; | ||
|
||
/* | ||
1. Commercial plugin: n points per times | ||
2. Other plugin: sum of children points | ||
*/ | ||
export const computedPluginUsage = async ( | ||
plugin: PluginRuntimeType, | ||
childrenUsage: ChatNodeUsageType[] | ||
) => { | ||
const { source } = await splitCombinePluginId(plugin.id); | ||
|
||
if (source === PluginSourceEnum.commercial) { | ||
return plugin.currentCost ?? 0; | ||
} | ||
|
||
return childrenUsage.reduce((sum, item) => sum + (item.totalPoints || 0), 0); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import React from 'react'; | ||
import { Image } from '@chakra-ui/react'; | ||
import type { ImageProps } from '@chakra-ui/react'; | ||
import { LOGO_ICON } from '@fastgpt/global/common/system/constants'; | ||
|
||
const Avatar = ({ w = '30px', src, ...props }: ImageProps) => { | ||
return ( | ||
<Image | ||
fallbackSrc={LOGO_ICON} | ||
fallbackStrategy={'onError'} | ||
// borderRadius={'md'} | ||
objectFit={'contain'} | ||
alt="" | ||
w={w} | ||
h={w} | ||
src={src || LOGO_ICON} | ||
{...props} | ||
/> | ||
); | ||
}; | ||
|
||
export default Avatar; |
Oops, something went wrong.