index
int64
0
0
repo_id
stringlengths
16
181
file_path
stringlengths
28
270
content
stringlengths
1
11.6M
__index_level_0__
int64
0
10k
0
petrpan-code/labring/FastGPT/docSite/layouts
petrpan-code/labring/FastGPT/docSite/layouts/shortcodes/figure.html
{{ if .Get "default" }} {{ template "_internal/shortcodes/figure.html" . }} {{ else }} {{ $url := urls.Parse (.Get "src") }} {{ $altText := .Get "alt" }} {{ $caption := .Get "caption" }} {{ $href := .Get "href" }} {{ $class := .Get "class" }} <figure{{ with $class }} class="{{ . }}"{{ end }}> {{ with ...
5,600
0
petrpan-code/labring/FastGPT/docSite
petrpan-code/labring/FastGPT/docSite/static/browserconfig.xml
<?xml version="1.0" encoding="utf-8"?> <browserconfig> <msapplication> <tile> <square150x150logo src="/mstile-150x150.png"/> <TileColor>#da532c</TileColor> </tile> </msapplication> </browserconfig>
5,601
0
petrpan-code/labring/FastGPT/docSite
petrpan-code/labring/FastGPT/docSite/static/favicon.svg
<svg width="32" height="32" viewBox="0 0 1041 1348" fill="none" xmlns="http://www.w3.org/2000/svg"> <path d="M340.837 0.33933L681.068 0.338989V0.455643C684.032 0.378397 686.999 0.339702 689.967 0.339702C735.961 0.3397 781.504 9.62899 823.997 27.6772C866.49 45.7254 905.099 72.1791 937.622 105.528C970.144 138.877 995.942...
5,602
0
petrpan-code/labring/FastGPT/docSite
petrpan-code/labring/FastGPT/docSite/static/safari-pinned-tab.svg
<?xml version="1.0" standalone="no"?> <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 20010904//EN" "http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd"> <svg version="1.0" xmlns="http://www.w3.org/2000/svg" width="1348.000000pt" height="1348.000000pt" viewBox="0 0 1348.000000 1348.000000" preserveAspectRatio="xMidYMid ...
5,603
0
petrpan-code/labring/FastGPT/docSite
petrpan-code/labring/FastGPT/docSite/static/site.webmanifest
{ "name": "FastGPT", "short_name": "FastGPT", "icons": [ { "src": "/android-chrome-192x192.png", "sizes": "192x192", "type": "image/png" }, { "src": "/android-chrome-512x512.png", "sizes": "512x512", "type": "image/png" } ], "theme_color": "#ffffff", "back...
5,604
0
petrpan-code/labring/FastGPT/docSite/static
petrpan-code/labring/FastGPT/docSite/static/docs/browserconfig.xml
<?xml version="1.0" encoding="utf-8"?> <browserconfig> <msapplication> <tile> <square150x150logo src="/mstile-150x150.png"/> <TileColor>#da532c</TileColor> </tile> </msapplication> </browserconfig>
5,605
0
petrpan-code/labring/FastGPT/docSite/static
petrpan-code/labring/FastGPT/docSite/static/docs/safari-pinned-tab.svg
<?xml version="1.0" standalone="no"?> <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 20010904//EN" "http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd"> <svg version="1.0" xmlns="http://www.w3.org/2000/svg" width="1348.000000pt" height="1348.000000pt" viewBox="0 0 1348.000000 1348.000000" preserveAspectRatio="xMidYMid ...
5,606
0
petrpan-code/labring/FastGPT/files/deploy
petrpan-code/labring/FastGPT/files/deploy/fastgpt/docker-compose.yml
# 非 host 版本, 不使用本机代理 version: '3.3' services: pg: image: ankane/pgvector:v0.5.0 # git # image: registry.cn-hangzhou.aliyuncs.com/fastgpt/pgvector:v0.5.0 # 阿里云 container_name: pg restart: always ports: # 生产环境建议不要暴露 - 5432:5432 networks: - fastgpt environment: # 这里的配置只有首次运行...
5,607
0
petrpan-code/labring/FastGPT/files/deploy
petrpan-code/labring/FastGPT/files/deploy/fastgpt/run.sh
#!/bin/bash docker-compose pull docker-compose up -d echo "Docker Compose 重新拉取镜像完成!" # 删除本地旧镜像 images=$(docker images --format "{{.ID}} {{.Repository}}" | grep fastgpt) # 将镜像 ID 和名称放入数组中 IFS=$'\n' read -rd '' -a image_array <<<"$images" # 遍历数组并删除所有旧的镜像 for ((i=1; i<${#image_array[@]}; i++)) do image=${image_arr...
5,608
0
petrpan-code/labring/FastGPT/files/deploy/fastgpt
petrpan-code/labring/FastGPT/files/deploy/fastgpt/clash/config.yaml
mixed-port: 7890 allow-lan: false bind-address: '*' mode: rule log-level: warning dns: enable: true ipv6: false nameserver: - 8.8.8.8 - 8.8.4.4 cache-size: 400 proxies: proxy-groups: - { name: '♻️ 自动选择', type: url-test, proxies: [香港V02×1.5,ABC, 印度01, 台湾03, 新加坡02, 新加坡03, 日本01, 日本02, 新加坡0...
5,609
0
petrpan-code/labring/FastGPT/files/deploy/fastgpt
petrpan-code/labring/FastGPT/files/deploy/fastgpt/clash/proxy.sh
export ALL_PROXY=socks5://127.0.0.1:7891 export http_proxy=http://127.0.0.1:7890 export https_proxy=http://127.0.0.1:7890 export HTTP_PROXY=http://127.0.0.1:7890 export HTTPS_PROXY=http://127.0.0.1:7890 OLD_PROCESS=$(pgrep clash) if [ ! -z "$OLD_PROCESS" ]; then echo "Killing old process: $OLD_PROCESS" kill $OLD_P...
5,610
0
petrpan-code/labring/FastGPT/files/deploy/fastgpt
petrpan-code/labring/FastGPT/files/deploy/fastgpt/clash/stop.sh
export ALL_PROXY='' export http_proxy='' export https_proxy='' export HTTP_PROXY='' export HTTPS_PROXY='' OLD_PROCESS=$(pgrep clash) if [ ! -z "$OLD_PROCESS" ]; then echo "Killing old process: $OLD_PROCESS" kill $OLD_PROCESS fi
5,611
0
petrpan-code/labring/FastGPT/files/deploy/fastgpt
petrpan-code/labring/FastGPT/files/deploy/fastgpt/docker-compose/init.sh
cp ./docker-compose /usr/local/bin/docker-compose sudo chmod +x /usr/local/bin/docker-compose
5,612
0
petrpan-code/labring/FastGPT/files/models
petrpan-code/labring/FastGPT/files/models/Baichuan2/openai_api.py
# coding=utf-8 # Implements API for Baichuan2-7B-Chat in OpenAI's format. (https://platform.openai.com/docs/api-reference/chat) # Usage: python openai_api.py import gc import time import torch import uvicorn from pydantic import BaseModel, Field, validator from fastapi import FastAPI, HTTPException from fastapi.middle...
5,613
0
petrpan-code/labring/FastGPT/files/models
petrpan-code/labring/FastGPT/files/models/Baichuan2/requirements.txt
protobuf transformers==4.30.2 cpm_kernels torch>=2.0 gradio mdtex2html sentencepiece accelerate sse-starlette fastapi==0.99.1 pydantic==1.10.7 uvicorn==0.21.1 xformers bitsandbytes
5,614
0
petrpan-code/labring/FastGPT/files/models
petrpan-code/labring/FastGPT/files/models/ChatGLM2/openai_api.py
# coding=utf-8 import argparse import time from contextlib import asynccontextmanager from typing import List, Literal, Optional, Union import numpy as np import tiktoken import torch import uvicorn from fastapi import Depends, FastAPI, HTTPException, Request from fastapi.middleware.cors import CORSMiddleware from pyd...
5,615
0
petrpan-code/labring/FastGPT/files/models
petrpan-code/labring/FastGPT/files/models/ChatGLM2/requirements.txt
fastapi==0.101.1 numpy==1.24.3 pydantic==1.10.7 scikit_learn==1.2.2 sentence_transformers==2.2.2 sse_starlette==1.6.5 starlette==0.27.0 tiktoken==0.4.0 torch==2.0.1 transformers==4.31.0 uvicorn==0.23.2
5,616
0
petrpan-code/labring/FastGPT/packages
petrpan-code/labring/FastGPT/packages/global/package.json
{ "name": "@fastgpt/global", "version": "1.0.0", "dependencies": { "axios": "^1.5.1", "timezones-list": "^3.0.2", "dayjs": "^1.11.7", "encoding": "^0.1.13", "openai": "^4.16.1", "js-tiktoken": "^1.0.7" }, "devDependencies": { "@types/node": "^20.8.5" } }
5,617
0
petrpan-code/labring/FastGPT/packages
petrpan-code/labring/FastGPT/packages/global/tsconfig.json
{ "compilerOptions": { "target": "es2015", "lib": ["dom", "dom.iterable", "esnext"], "allowJs": true, "skipLibCheck": true, "strict": true, "forceConsistentCasingInFileNames": true, "noEmit": true, "esModuleInterop": true, "module": "esnext", "moduleResolution": "node", "re...
5,618
0
petrpan-code/labring/FastGPT/packages/global/common
petrpan-code/labring/FastGPT/packages/global/common/error/errorCode.ts
import appErr from './code/app'; import chatErr from './code/chat'; import datasetErr from './code/dataset'; import openapiErr from './code/openapi'; import pluginErr from './code/plugin'; import outLinkErr from './code/outLink'; import teamErr from './code/team'; import userErr from './code/user'; export const ERROR_...
5,619
0
petrpan-code/labring/FastGPT/packages/global/common
petrpan-code/labring/FastGPT/packages/global/common/error/utils.ts
export const getErrText = (err: any, def = '') => { const msg: string = typeof err === 'string' ? err : err?.message || def || ''; msg && console.log('error =>', msg); return msg; };
5,620
0
petrpan-code/labring/FastGPT/packages/global/common/error
petrpan-code/labring/FastGPT/packages/global/common/error/code/app.ts
import { ErrType } from '../errorCode'; /* dataset: 502000 */ export enum AppErrEnum { unExist = 'unExist', unAuthApp = 'unAuthApp' } const appErrList = [ { statusText: AppErrEnum.unExist, message: '应用不存在' }, { statusText: AppErrEnum.unAuthApp, message: '无权操作该应用' } ]; export default appErrL...
5,621
0
petrpan-code/labring/FastGPT/packages/global/common/error
petrpan-code/labring/FastGPT/packages/global/common/error/code/chat.ts
import { ErrType } from '../errorCode'; /* dataset: 504000 */ export enum ChatErrEnum { unAuthChat = 'unAuthChat' } const errList = [ { statusText: ChatErrEnum.unAuthChat, message: '无权操作该对话记录' } ]; export default errList.reduce((acc, cur, index) => { return { ...acc, [cur.statusText]: { c...
5,622
0
petrpan-code/labring/FastGPT/packages/global/common/error
petrpan-code/labring/FastGPT/packages/global/common/error/code/dataset.ts
import { ErrType } from '../errorCode'; /* dataset: 501000 */ export enum DatasetErrEnum { unAuthDataset = 'unAuthDataset', unCreateCollection = 'unCreateCollection', unAuthDatasetCollection = 'unAuthDatasetCollection', unAuthDatasetData = 'unAuthDatasetData', unAuthDatasetFile = 'unAuthDatasetFile' } const ...
5,623
0
petrpan-code/labring/FastGPT/packages/global/common/error
petrpan-code/labring/FastGPT/packages/global/common/error/code/openapi.ts
import { ErrType } from '../errorCode'; /* dataset: 506000 */ export enum OpenApiErrEnum { unExist = 'unExist', unAuth = 'unAuth' } const errList = [ { statusText: OpenApiErrEnum.unExist, message: 'Api Key 不存在' }, { statusText: OpenApiErrEnum.unAuth, message: '无权操作该 Api Key' } ]; export def...
5,624
0
petrpan-code/labring/FastGPT/packages/global/common/error
petrpan-code/labring/FastGPT/packages/global/common/error/code/outLink.ts
import { ErrType } from '../errorCode'; /* dataset: 505000 */ export enum OutLinkErrEnum { unExist = 'unExist', unAuthLink = 'unAuthLink', linkUnInvalid = 'linkUnInvalid' } const errList = [ { statusText: OutLinkErrEnum.unExist, message: '分享链接不存在' }, { statusText: OutLinkErrEnum.unAuthLink, ...
5,625
0
petrpan-code/labring/FastGPT/packages/global/common/error
petrpan-code/labring/FastGPT/packages/global/common/error/code/plugin.ts
import { ErrType } from '../errorCode'; /* dataset: 507000 */ export enum PluginErrEnum { unExist = 'unExist', unAuth = 'unAuth' } const errList = [ { statusText: PluginErrEnum.unExist, message: '插件不存在' }, { statusText: PluginErrEnum.unAuth, message: '无权操作该插件' } ]; export default errList.re...
5,626
0
petrpan-code/labring/FastGPT/packages/global/common/error
petrpan-code/labring/FastGPT/packages/global/common/error/code/team.ts
import { ErrType } from '../errorCode'; /* team: 500000 */ export enum TeamErrEnum { teamOverSize = 'teamOverSize', unAuthTeam = 'unAuthTeam' } const teamErr = [ { statusText: TeamErrEnum.teamOverSize, message: 'error.team.overSize' }, { statusText: TeamErrEnum.unAuthTeam, message: '无权操作该团队' } ]; export defaul...
5,627
0
petrpan-code/labring/FastGPT/packages/global/common/error
petrpan-code/labring/FastGPT/packages/global/common/error/code/user.ts
import { ErrType } from '../errorCode'; /* team: 503000 */ export enum UserErrEnum { unAuthUser = 'unAuthUser', unAuthRole = 'unAuthRole', binVisitor = 'binVisitor', balanceNotEnough = 'balanceNotEnough' } const errList = [ { statusText: UserErrEnum.unAuthUser, message: '找不到该用户' }, { statusText: UserErrEnu...
5,628
0
petrpan-code/labring/FastGPT/packages/global/common
petrpan-code/labring/FastGPT/packages/global/common/file/constants.ts
export enum BucketNameEnum { dataset = 'dataset' } export const FileBaseUrl = '/api/common/file/read';
5,629
0
petrpan-code/labring/FastGPT/packages/global/common
petrpan-code/labring/FastGPT/packages/global/common/file/icon.ts
export const fileImgs = [ { suffix: 'pdf', src: '/imgs/files/pdf.svg' }, { suffix: 'csv', src: '/imgs/files/csv.svg' }, { suffix: '(doc|docs)', src: '/imgs/files/doc.svg' }, { suffix: 'txt', src: '/imgs/files/txt.svg' }, { suffix: 'md', src: '/imgs/files/markdown.svg' } // { suffix: '.', src: '/imgs/files/f...
5,630
0
petrpan-code/labring/FastGPT/packages/global/common
petrpan-code/labring/FastGPT/packages/global/common/file/tools.ts
export const formatFileSize = (bytes: number): string => { if (bytes === 0) return '0 B'; const k = 1024; const sizes = ['B', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB']; const i = Math.floor(Math.log(bytes) / Math.log(k)); return parseFloat((bytes / Math.pow(k, i)).toFixed(2)) + ' ' + sizes[i]; };
5,631
0
petrpan-code/labring/FastGPT/packages/global/common
petrpan-code/labring/FastGPT/packages/global/common/file/type.d.ts
import { BucketNameEnum } from './constants'; export type FileTokenQuery = { bucketName: `${BucketNameEnum}`; teamId: string; tmbId: string; fileId: string; };
5,632
0
petrpan-code/labring/FastGPT/packages/global/common
petrpan-code/labring/FastGPT/packages/global/common/parentFolder/type.d.ts
export type ParentTreePathItemType = { parentId: string; parentName: string; };
5,633
0
petrpan-code/labring/FastGPT/packages/global/common/plugin
petrpan-code/labring/FastGPT/packages/global/common/plugin/types/pluginRes.d.ts
export type FetchResultItem = { url: string; content: string; };
5,634
0
petrpan-code/labring/FastGPT/packages/global/common
petrpan-code/labring/FastGPT/packages/global/common/string/textSplitter.ts
import { getErrText } from '../error/utils'; import { countPromptTokens } from './tiktoken'; /** * text split into chunks * maxLen - one chunk len. max: 3500 * overlapLen - The size of the before and after Text * maxLen > overlapLen * markdown */ export const splitText2Chunks = (props: { text: string; maxLen: nu...
5,635
0
petrpan-code/labring/FastGPT/packages/global/common
petrpan-code/labring/FastGPT/packages/global/common/string/tools.ts
import crypto from 'crypto'; /* check string is a web link */ export function strIsLink(str?: string) { if (!str) return false; if (/^((http|https)?:\/\/|www\.|\/)[^\s/$.?#].[^\s]*$/i.test(str)) return true; return false; } /* hash string */ export const hashStr = (str: string) => { return crypto.createHash('...
5,636
0
petrpan-code/labring/FastGPT/packages/global/common/string
petrpan-code/labring/FastGPT/packages/global/common/string/tiktoken/cl100k_base.json
{ "pat_str": "('s|'S|'t|'T|'re|'rE|'Re|'RE|'ve|'vE|'Ve|'VE|'m|'M|'ll|'lL|'Ll|'LL|'d|'D)|[^\\r\\n\\p{L}\\p{N}]?\\p{L}+|\\p{N}{1,3}| ?[^\\s\\p{L}\\p{N}]+[\\r\\n]*|\\s*[\\r\\n]+|\\s+(?!\\S)|\\s+", "special_tokens": { "<|endoftext|>": 100257, "<|fim_prefix|>": 100258, "<|fim_middle|>": 100259, "<|fim_su...
5,637
0
petrpan-code/labring/FastGPT/packages/global/common/string
petrpan-code/labring/FastGPT/packages/global/common/string/tiktoken/index.ts
/* Only the token of gpt-3.5-turbo is used */ import type { ChatItemType } from '../../../core/chat/type'; import { Tiktoken } from 'js-tiktoken/lite'; import { adaptChat2GptMessages } from '../../../core/chat/adapt'; import { ChatCompletionRequestMessageRoleEnum } from '../../../core/ai/constant'; import encodingJson ...
5,638
0
petrpan-code/labring/FastGPT/packages/global/common/string
petrpan-code/labring/FastGPT/packages/global/common/string/tiktoken/type.d.ts
import type { Tiktoken } from 'js-tiktoken'; declare global { var TikToken: Tiktoken; }
5,639
0
petrpan-code/labring/FastGPT/packages/global/common/system
petrpan-code/labring/FastGPT/packages/global/common/system/types/index.d.ts
export type FeConfigsType = { show_emptyChat?: boolean; show_register?: boolean; show_appStore?: boolean; show_contact?: boolean; show_git?: boolean; show_pay?: boolean; show_openai_account?: boolean; show_promotion?: boolean; hide_app_flow?: boolean; docUrl?: string; openAPIDocUrl?: string; sys...
5,640
0
petrpan-code/labring/FastGPT/packages/global/common
petrpan-code/labring/FastGPT/packages/global/common/time/timezone.ts
import timezones from 'timezones-list'; import dayjs from 'dayjs'; import utc from 'dayjs/plugin/utc'; import timezone from 'dayjs/plugin/timezone'; dayjs.extend(utc); dayjs.extend(timezone); /** * Returns the offset from UTC in hours for the current locale. * @param {string} timeZone Timezone to get offset for * ...
5,641
0
petrpan-code/labring/FastGPT/packages/global
petrpan-code/labring/FastGPT/packages/global/core/type.d.ts
import type { Agent } from 'http'; declare global { var httpsAgent: Agent; }
5,642
0
petrpan-code/labring/FastGPT/packages/global/core
petrpan-code/labring/FastGPT/packages/global/core/ai/api.d.ts
export type PostReRankProps = { query: string; inputs: { id: string; text: string }[]; }; export type PostReRankResponse = { id: string; score: number }[];
5,643
0
petrpan-code/labring/FastGPT/packages/global/core
petrpan-code/labring/FastGPT/packages/global/core/ai/constant.ts
export enum ChatCompletionRequestMessageRoleEnum { 'System' = 'system', 'User' = 'user', 'Assistant' = 'assistant', 'Function' = 'function', 'Tool' = 'tool' }
5,644
0
petrpan-code/labring/FastGPT/packages/global/core
petrpan-code/labring/FastGPT/packages/global/core/ai/index.ts
import OpenAI from 'openai'; export default OpenAI;
5,645
0
petrpan-code/labring/FastGPT/packages/global/core
petrpan-code/labring/FastGPT/packages/global/core/ai/model.d.ts
export type LLMModelItemType = { model: string; name: string; maxContext: number; maxResponse: number; price: number; }; export type ChatModelItemType = LLMModelItemType & { quoteMaxToken: number; maxTemperature: number; censor?: boolean; vision?: boolean; defaultSystemChatPrompt?: string; }; expor...
5,646
0
petrpan-code/labring/FastGPT/packages/global/core
petrpan-code/labring/FastGPT/packages/global/core/ai/model.ts
import type { LLMModelItemType, ChatModelItemType, FunctionModelItemType, VectorModelItemType, AudioSpeechModelType, WhisperModelType } from './model.d'; export const defaultChatModels: ChatModelItemType[] = [ { model: 'gpt-3.5-turbo-1106', name: 'GPT35-1106', price: 0, maxContext: 16000,...
5,647
0
petrpan-code/labring/FastGPT/packages/global/core
petrpan-code/labring/FastGPT/packages/global/core/ai/type.d.ts
import type { ChatCompletion, ChatCompletionCreateParams, ChatCompletionChunk, ChatCompletionMessageParam, ChatCompletionContentPart } from 'openai/resources'; export type ChatCompletionContentPart = ChatCompletionContentPart; export type ChatCompletionCreateParams = ChatCompletionCreateParams; export type C...
5,648
0
petrpan-code/labring/FastGPT/packages/global/core
petrpan-code/labring/FastGPT/packages/global/core/app/api.d.ts
import { AppTypeEnum } from './constants'; import { AppSchema } from './type'; export type CreateAppParams = { name?: string; avatar?: string; type?: `${AppTypeEnum}`; modules: AppSchema['modules']; }; export interface AppUpdateParams { name?: string; type?: `${AppTypeEnum}`; avatar?: string; intro?: ...
5,649
0
petrpan-code/labring/FastGPT/packages/global/core
petrpan-code/labring/FastGPT/packages/global/core/app/constants.ts
export enum AppTypeEnum { basic = 'basic', advanced = 'advanced' }
5,650
0
petrpan-code/labring/FastGPT/packages/global/core
petrpan-code/labring/FastGPT/packages/global/core/app/type.d.ts
import { ModuleItemType } from '../module/type'; import { AppTypeEnum } from './constants'; import { PermissionTypeEnum } from '../../support/permission/constant'; export interface AppSchema { _id: string; userId: string; teamId: string; tmbId: string; name: string; type: `${AppTypeEnum}`; avatar: string...
5,651
0
petrpan-code/labring/FastGPT/packages/global/core
petrpan-code/labring/FastGPT/packages/global/core/chat/adapt.ts
import type { ChatItemType } from '../../core/chat/type.d'; import { ChatRoleEnum } from '../../core/chat/constants'; import { ChatCompletionRequestMessageRoleEnum } from '../../core/ai/constant'; import type { ChatMessageItemType } from '../../core/ai/type.d'; const chat2Message = { [ChatRoleEnum.AI]: ChatCompletio...
5,652
0
petrpan-code/labring/FastGPT/packages/global/core
petrpan-code/labring/FastGPT/packages/global/core/chat/api.d.ts
import { ModuleItemType } from '../module/type'; import { AdminFbkType, ChatItemType, moduleDispatchResType } from './type'; export type UpdateHistoryProps = { chatId: string; customTitle?: string; top?: boolean; }; export type AdminUpdateFeedbackParams = AdminFbkType & { chatItemId: string; }; export type I...
5,653
0
petrpan-code/labring/FastGPT/packages/global/core
petrpan-code/labring/FastGPT/packages/global/core/chat/constants.ts
export enum ChatRoleEnum { System = 'System', Human = 'Human', AI = 'AI', Function = 'Function', Tool = 'Tool' } export enum TaskResponseKeyEnum { 'answerText' = 'answerText', // answer module text key 'responseData' = 'responseData', 'history' = 'history' } export const ChatRoleMap = { [ChatRoleEn...
5,654
0
petrpan-code/labring/FastGPT/packages/global/core
petrpan-code/labring/FastGPT/packages/global/core/chat/type.d.ts
import { ClassifyQuestionAgentItemType } from '../module/type'; import { SearchDataResponseItemType } from '../dataset/type'; import { ChatRoleEnum, ChatSourceEnum, TaskResponseKeyEnum } from './constants'; import { FlowNodeTypeEnum } from '../module/node/constant'; import { AppSchema } from 'core/app/type'; export ty...
5,655
0
petrpan-code/labring/FastGPT/packages/global/core
petrpan-code/labring/FastGPT/packages/global/core/chat/utils.ts
import { IMG_BLOCK_KEY, FILE_BLOCK_KEY } from './constants'; export function chatContentReplaceBlock(content: string = '') { const regex = new RegExp(`\`\`\`(${IMG_BLOCK_KEY})\\n([\\s\\S]*?)\`\`\``, 'g'); return content.replace(regex, '').trim(); }
5,656
0
petrpan-code/labring/FastGPT/packages/global/core
petrpan-code/labring/FastGPT/packages/global/core/dataset/api.d.ts
import { DatasetDataIndexItemType } from './type'; /* ================= dataset ===================== */ /* ================= collection ===================== */ /* ================= data ===================== */ export type PgSearchRawType = { id: string; team_id: string; tmb_id: string; collection_id: stri...
5,657
0
petrpan-code/labring/FastGPT/packages/global/core
petrpan-code/labring/FastGPT/packages/global/core/dataset/constant.ts
export const PgDatasetTableName = 'modeldata'; export enum DatasetTypeEnum { folder = 'folder', dataset = 'dataset' } export const DatasetTypeMap = { [DatasetTypeEnum.folder]: { name: 'folder' }, [DatasetTypeEnum.dataset]: { name: 'dataset' } }; export enum DatasetCollectionTypeEnum { file = 'f...
5,658
0
petrpan-code/labring/FastGPT/packages/global/core
petrpan-code/labring/FastGPT/packages/global/core/dataset/controller.d.ts
import type { DatasetDataIndexItemType, DatasetDataSchemaType } from './type'; export type CreateDatasetDataProps = { teamId: string; tmbId: string; datasetId: string; collectionId: string; q: string; a?: string; indexes?: Omit<DatasetDataIndexItemType, 'dataId'>[]; }; export type UpdateDatasetDataProps...
5,659
0
petrpan-code/labring/FastGPT/packages/global/core
petrpan-code/labring/FastGPT/packages/global/core/dataset/type.d.ts
import type { LLMModelItemType, VectorModelItemType } from '../../core/ai/model.d'; import { PermissionTypeEnum } from '../../support/permission/constant'; import { PushDatasetDataChunkProps } from './api'; import { DatasetCollectionTypeEnum, DatasetDataIndexTypeEnum, DatasetTypeEnum, TrainingModeEnum } from '....
5,660
0
petrpan-code/labring/FastGPT/packages/global/core
petrpan-code/labring/FastGPT/packages/global/core/dataset/utils.ts
import { DatasetCollectionTypeEnum, DatasetDataIndexTypeEnum } from './constant'; import { getFileIcon } from '../../common/file/icon'; import { strIsLink } from '../../common/string/tools'; export function getCollectionIcon( type: `${DatasetCollectionTypeEnum}` = DatasetCollectionTypeEnum.file, name = '' ) { if...
5,661
0
petrpan-code/labring/FastGPT/packages/global/core
petrpan-code/labring/FastGPT/packages/global/core/module/api.d.ts
import { VectorModelItemType } from '../ai/model.d'; export type SelectedDatasetType = { datasetId: string; vectorModel: VectorModelItemType }[];
5,662
0
petrpan-code/labring/FastGPT/packages/global/core
petrpan-code/labring/FastGPT/packages/global/core/module/type.d.ts
import { FlowNodeTypeEnum, FlowNodeValTypeEnum } from './node/constant'; import { FlowNodeInputItemType, FlowNodeOutputItemType } from './node/type'; export type FlowModuleTemplateType = { id: string; flowType: `${FlowNodeTypeEnum}`; // unique logo?: string; name: string; description?: string; intro?: stri...
5,663
0
petrpan-code/labring/FastGPT/packages/global/core
petrpan-code/labring/FastGPT/packages/global/core/module/utils.ts
import { FlowNodeInputTypeEnum, FlowNodeSpecialInputKeyEnum, FlowNodeTypeEnum } from './node/constant'; import { FlowNodeInputItemType, FlowNodeOutputItemType } from './node/type'; import { ModuleItemType } from './type'; export function getPluginTemplatePluginIdInput(pluginId: string) { return { key: Flow...
5,664
0
petrpan-code/labring/FastGPT/packages/global/core/module
petrpan-code/labring/FastGPT/packages/global/core/module/node/constant.ts
export enum FlowNodeInputTypeEnum { systemInput = 'systemInput', // history, userChatInput, variableInput input = 'input', // one line input textarea = 'textarea', numberInput = 'numberInput', select = 'select', slider = 'slider', custom = 'custom', target = 'target', // data input switch = 'switch', ...
5,665
0
petrpan-code/labring/FastGPT/packages/global/core/module
petrpan-code/labring/FastGPT/packages/global/core/module/node/type.d.ts
import { FlowNodeInputTypeEnum, FlowNodeOutputTypeEnum, FlowNodeValTypeEnum, FlowNodeTypeEnum } from './constant'; export type FlowNodeChangeProps = { moduleId: string; type: | 'attr' // key: attr, value: new value | 'updateInput' // key: update input key, value: new input value | 'replaceInput...
5,666
0
petrpan-code/labring/FastGPT/packages/global/core
petrpan-code/labring/FastGPT/packages/global/core/plugin/constants.ts
import { ModuleItemType } from '../module/type'; export const defaultModules: ModuleItemType[] = [ { moduleId: 'fph4s3', name: '自定义输出', flowType: 'pluginOutput', showStatus: false, position: { x: 994.1266684738011, y: -45.87689365278443 }, inputs: [], outputs: [] }, { ...
5,667
0
petrpan-code/labring/FastGPT/packages/global/core
petrpan-code/labring/FastGPT/packages/global/core/plugin/controller.d.ts
import type { ModuleItemType } from '../module/type.d'; export type CreateOnePluginParams = { name: string; avatar: string; intro: string; modules?: ModuleItemType[]; }; export type UpdatePluginParams = { id: string; name?: string; avatar?: string; intro?: string; modules?: ModuleItemType[]; }; expor...
5,668
0
petrpan-code/labring/FastGPT/packages/global/core
petrpan-code/labring/FastGPT/packages/global/core/plugin/type.d.ts
import type { ModuleItemType } from '../module/type.d'; export type PluginItemSchema = { _id: string; userId: string; teamId: string; tmbId: string; name: string; avatar: string; intro: string; updateTime: Date; modules: ModuleItemType[]; };
5,669
0
petrpan-code/labring/FastGPT/packages/global/support
petrpan-code/labring/FastGPT/packages/global/support/activity/type.d.ts
export type PromotionRecordSchema = { _id: string; userId: string; // 收益人 objUId?: string; // 目标对象(如果是withdraw则为空) type: 'register' | 'pay'; createTime: Date; // 记录时间 amount: number; };
5,670
0
petrpan-code/labring/FastGPT/packages/global/support
petrpan-code/labring/FastGPT/packages/global/support/openapi/type.d.ts
export type OpenApiSchema = { _id: string; userId: string; teamId: string; tmbId: string; createTime: Date; lastUsedTime?: Date; apiKey: string; appId?: string; name: string; usage: number; limit?: { expiredTime?: Date; credit?: number; }; };
5,671
0
petrpan-code/labring/FastGPT/packages/global/support
petrpan-code/labring/FastGPT/packages/global/support/outLink/api.d.ts
import type { HistoryItemType, ChatSiteItemType } from '../../core/chat/type.d'; import type { InitChatResponse } from '../../core/chat/api.d'; import { OutLinkSchema } from '@fastgpt/global/support/outLink/type'; export type InitShareChatResponse = { userAvatar: string; app: InitChatResponse['app']; }; /* one pa...
5,672
0
petrpan-code/labring/FastGPT/packages/global/support
petrpan-code/labring/FastGPT/packages/global/support/outLink/constant.ts
export enum OutLinkTypeEnum { share = 'share', iframe = 'iframe', apikey = 'apikey' }
5,673
0
petrpan-code/labring/FastGPT/packages/global/support
petrpan-code/labring/FastGPT/packages/global/support/outLink/type.d.ts
import { OutLinkTypeEnum } from './constant'; export type OutLinkSchema = { _id: string; shareId: string; userId: string; teamId: string; tmbId: string; appId: string; name: string; total: number; lastTime: Date; type: `${OutLinkTypeEnum}`; responseDetail: boolean; limit?: { expiredTime?: D...
5,674
0
petrpan-code/labring/FastGPT/packages/global/support
petrpan-code/labring/FastGPT/packages/global/support/permission/constant.ts
export enum AuthUserTypeEnum { token = 'token', root = 'root', apikey = 'apikey', outLink = 'outLink' } export enum PermissionTypeEnum { 'private' = 'private', 'public' = 'public' } export const PermissionTypeMap = { [PermissionTypeEnum.private]: { iconLight: 'support/permission/privateLight', la...
5,675
0
petrpan-code/labring/FastGPT/packages/global/support
petrpan-code/labring/FastGPT/packages/global/support/permission/type.d.ts
import { AuthUserTypeEnum } from './constant'; export type AuthResponseType = { userId: string; teamId: string; tmbId: string; isOwner: boolean; canWrite: boolean; authType?: `${AuthUserTypeEnum}`; appId?: string; apikey?: string; };
5,676
0
petrpan-code/labring/FastGPT/packages/global/support
petrpan-code/labring/FastGPT/packages/global/support/permission/utils.ts
import { TeamMemberRoleEnum } from '../user/team/constant'; import { PermissionTypeEnum } from './constant'; /* team public source, or owner source in team */ export function mongoRPermission({ teamId, tmbId, role }: { teamId: string; tmbId: string; role: `${TeamMemberRoleEnum}`; }) { return { teamId...
5,677
0
petrpan-code/labring/FastGPT/packages/global/support
petrpan-code/labring/FastGPT/packages/global/support/user/api.d.ts
import { OAuthEnum } from './constant'; export type PostLoginProps = { username: string; password: string; tmbId?: string; }; export type OauthLoginProps = { type: `${OAuthEnum}`; code: string; callbackUrl: string; inviterId?: string; tmbId?: string; };
5,678
0
petrpan-code/labring/FastGPT/packages/global/support
petrpan-code/labring/FastGPT/packages/global/support/user/constant.ts
export enum OAuthEnum { github = 'github', google = 'google' }
5,679
0
petrpan-code/labring/FastGPT/packages/global/support
petrpan-code/labring/FastGPT/packages/global/support/user/type.d.ts
import { InformTypeEnum } from './constant'; import { TeamItemType } from './team/type'; export type UserModelSchema = { _id: string; username: string; password: string; avatar: string; balance: number; promotionRate: number; inviterId?: string; openaiKey: string; createTime: number; timezone: stri...
5,680
0
petrpan-code/labring/FastGPT/packages/global/support/user
petrpan-code/labring/FastGPT/packages/global/support/user/inform/constants.ts
export enum InformTypeEnum { system = 'system' } export const InformTypeMap = { [InformTypeEnum.system]: { label: '系统通知' } };
5,681
0
petrpan-code/labring/FastGPT/packages/global/support/user
petrpan-code/labring/FastGPT/packages/global/support/user/inform/type.d.ts
import { InformTypeEnum } from './constant'; export type SendInformProps = { tmbId?: string; type: `${InformTypeEnum}`; title: string; content: string; }; export type UserInformSchema = { _id: string; userId: string; time: Date; type: `${InformTypeEnum}`; title: string; content: string; read: bo...
5,682
0
petrpan-code/labring/FastGPT/packages/global/support/user
petrpan-code/labring/FastGPT/packages/global/support/user/team/constant.ts
export const TeamCollectionName = 'teams'; export const TeamMemberCollectionName = 'team.members'; export enum TeamMemberRoleEnum { owner = 'owner', admin = 'admin', visitor = 'visitor' } export const TeamMemberRoleMap = { [TeamMemberRoleEnum.owner]: { value: TeamMemberRoleEnum.owner, label: 'user.team...
5,683
0
petrpan-code/labring/FastGPT/packages/global/support/user
petrpan-code/labring/FastGPT/packages/global/support/user/team/controller.d.ts
import { TeamMemberRoleEnum } from './constant'; import { TeamMemberSchema } from './type'; export type AuthTeamRoleProps = { teamId: string; tmbId: string; role?: `${TeamMemberRoleEnum}`; }; export type CreateTeamProps = { name: string; avatar?: string; defaultTeam?: boolean; }; export type UpdateTeamProp...
5,684
0
petrpan-code/labring/FastGPT/packages/global/support/user
petrpan-code/labring/FastGPT/packages/global/support/user/team/type.d.ts
import { UserModelSchema } from '../type'; import { TeamMemberRoleEnum, TeamMemberStatusEnum } from './constant'; export type TeamSchema = { _id: string; name: string; ownerId: string; avatar: string; createTime: Date; balance: number; maxSize: number; }; export type TeamMemberSchema = { _id: string; ...
5,685
0
petrpan-code/labring/FastGPT/packages/global/support/wallet
petrpan-code/labring/FastGPT/packages/global/support/wallet/bill/api.d.ts
import { BillSourceEnum } from './constants'; import { BillListItemType } from './type'; export type CreateTrainingBillProps = { name: string; vectorModel?: string; agentModel?: string; }; export type ConcatBillProps = { teamId: string; tmbId: string; billId?: string; total: number; listIndex?: number...
5,686
0
petrpan-code/labring/FastGPT/packages/global/support/wallet
petrpan-code/labring/FastGPT/packages/global/support/wallet/bill/constants.ts
// ¥1 = 100000 export const PRICE_SCALE = 100000; export enum BillSourceEnum { fastgpt = 'fastgpt', api = 'api', shareLink = 'shareLink', training = 'training' } export const BillSourceMap: Record<`${BillSourceEnum}`, string> = { [BillSourceEnum.fastgpt]: '在线使用', [BillSourceEnum.api]: 'Api', [BillSource...
5,687
0
petrpan-code/labring/FastGPT/packages/global/support/wallet
petrpan-code/labring/FastGPT/packages/global/support/wallet/bill/tools.ts
/* bill common */ import { PRICE_SCALE } from './constants'; import { BillItemType, BillSchema } from './type'; /** * dataset price / PRICE_SCALE = real price */ export const formatPrice = (val = 0, multiple = 1) => { return Number(((val / PRICE_SCALE) * multiple).toFixed(10)); };
5,688
0
petrpan-code/labring/FastGPT/packages/global/support/wallet
petrpan-code/labring/FastGPT/packages/global/support/wallet/bill/type.d.ts
import { CreateBillProps } from './api'; import { BillSourceEnum } from './constants'; export type BillListItemType = { moduleName: string; amount: number; model?: string; tokenLen?: number; }; export type BillSchema = CreateBillProps & { _id: string; time: Date; }; export type BillItemType = { id: str...
5,689
0
petrpan-code/labring/FastGPT/packages/global/support/wallet
petrpan-code/labring/FastGPT/packages/global/support/wallet/pay/type.d.ts
export type PaySchema = { _id: string; userId: string; teamId: string; tmbId: string; createTime: Date; price: number; orderId: string; status: 'SUCCESS' | 'REFUND' | 'NOTPAY' | 'CLOSED'; };
5,690
0
petrpan-code/labring/FastGPT/packages
petrpan-code/labring/FastGPT/packages/service/package.json
{ "name": "@fastgpt/service", "version": "1.0.0", "dependencies": { "@fastgpt/global": "workspace:*", "axios": "^1.5.1", "nextjs-cors": "^2.1.2", "next": "13.5.2", "cookie": "^0.5.0", "jsonwebtoken": "^9.0.2", "mongoose": "^7.0.2", "winston": "^3.10.0", "winston-mongodb": "^5.1...
5,691
0
petrpan-code/labring/FastGPT/packages
petrpan-code/labring/FastGPT/packages/service/tsconfig.json
{ "compilerOptions": { "target": "es2015", "lib": ["dom", "dom.iterable", "esnext"], "allowJs": true, "skipLibCheck": true, "strict": true, "forceConsistentCasingInFileNames": true, "noEmit": true, "esModuleInterop": true, "module": "esnext", "moduleResolution": "node", "re...
5,692
0
petrpan-code/labring/FastGPT/packages/service/common
petrpan-code/labring/FastGPT/packages/service/common/api/plusRequest.ts
import axios, { Method, InternalAxiosRequestConfig, AxiosResponse } from 'axios'; interface ConfigType { headers?: { [key: string]: string }; hold?: boolean; timeout?: number; } interface ResponseDataType { code: number; message: string; data: any; } /** * 请求开始 */ function requestStart(config: InternalA...
5,693
0
petrpan-code/labring/FastGPT/packages/service/common/buffer
petrpan-code/labring/FastGPT/packages/service/common/buffer/tts/schema.ts
import { connectionMongo, type Model } from '../../../common/mongo'; const { Schema, model, models } = connectionMongo; import { TTSBufferSchemaType } from './type.d'; export const collectionName = 'ttsbuffers'; const TTSBufferSchema = new Schema({ bufferId: { type: String, required: true }, text: { ...
5,694
0
petrpan-code/labring/FastGPT/packages/service/common/buffer
petrpan-code/labring/FastGPT/packages/service/common/buffer/tts/type.d.ts
export type TTSBufferSchemaType = { bufferId: string; text: string; buffer: Buffer; };
5,695
0
petrpan-code/labring/FastGPT/packages/service/common/file
petrpan-code/labring/FastGPT/packages/service/common/file/gridfs/controller.ts
import { Types, connectionMongo } from '../../mongo'; import { BucketNameEnum } from '@fastgpt/global/common/file/constants'; import fsp from 'fs/promises'; import fs from 'fs'; import { DatasetFileSchema } from '@fastgpt/global/core/dataset/type'; export function getGFSCollection(bucket: `${BucketNameEnum}`) { retu...
5,696
0
petrpan-code/labring/FastGPT/packages/service/common/file
petrpan-code/labring/FastGPT/packages/service/common/file/image/constant.ts
export const imageBaseUrl = '/api/system/img/';
5,697
0
petrpan-code/labring/FastGPT/packages/service/common/file
petrpan-code/labring/FastGPT/packages/service/common/file/image/controller.ts
import { imageBaseUrl } from './constant'; import { MongoImage } from './schema'; export function getMongoImgUrl(id: string) { return `${imageBaseUrl}${id}`; } export const maxImgSize = 1024 * 1024 * 12; export async function uploadMongoImg({ base64Img, teamId, expiredTime }: { base64Img: string; teamId: ...
5,698
0
petrpan-code/labring/FastGPT/packages/service/common/file
petrpan-code/labring/FastGPT/packages/service/common/file/image/schema.ts
import { TeamCollectionName } from '@fastgpt/global/support/user/team/constant'; import { connectionMongo, type Model } from '../../mongo'; const { Schema, model, models } = connectionMongo; const ImageSchema = new Schema({ teamId: { type: Schema.Types.ObjectId, ref: TeamCollectionName }, binary: { t...
5,699