Skip to content
Closed
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
21 changes: 17 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
"spark-md5": "^3.0.2",
"tailwind-merge": "^2.5.4",
"tailwindcss-animate": "^1.0.7",
"uuid": "^11.1.0",
"vaul-vue": "^0.2.0",
"vditor": "^3.10.7",
"vee-validate": "^4.14.6",
Expand Down
43 changes: 35 additions & 8 deletions src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -266,18 +266,43 @@
}, 400)
}

const handleShareCode = (str: string) => {
str = str.trim()
if (str.length === 8) {
return str
}

const shareCodePattern = /share_code=([A-Za-z0-9]{8})/
const match = str.match(shareCodePattern)
if (match && match[1]) {
return match[1]
}

return ''
}

const runShareCode = async () => {
if (shareCode.value) {
shareCode.value = shareCode.value.trim()
if (shareCode.value.length != 8) {
const processedCode = handleShareCode(shareCode.value)
if (processedCode) {
shareCode.value = processedCode
if (shareCode.value.length != 8) {
useToaster({
type: 'error',
message: t('app.shareCode.error.shareCodeLength')
})
shareCode.value = ''
return false
}
convert()
} else {
useToaster({
type: 'error',
message: t('app.shareCode.error.shareCodeLength')
message: t('app.shareCode.error.invalid')
})
shareCode.value = ''
return false
}
convert()
} else {
try {
const clipboardText = await navigator.clipboard.readText()
Expand All @@ -288,15 +313,17 @@
})
return false
}
const trimmedClipboardText = clipboardText.trim()
if (trimmedClipboardText.length != 8) {

const processedCode = handleShareCode(clipboardText)
if (!processedCode) {
useToaster({
type: 'error',
message: t('app.shareCode.error.length')
message: t('app.shareCode.error.invalid')
})
return false
}
shareCode.value = trimmedClipboardText

shareCode.value = processedCode
convert()
} catch (error) {
useToaster({
Expand Down
4 changes: 2 additions & 2 deletions src/api/message-box.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,15 @@ export const get_messages_list = (params: any) => {
if (params.types && (typeof params.types === 'string' || typeof params.types === 'number')) {
searchParams.append('types', params.types)
}

return customFetch(`/bizyair/community/notifications?${searchParams.toString()}`, {
method: 'GET'
})
}

export const get_message_unread_count = () =>
customFetch(`/bizyair/community/notifications/unread_count`, {
method: 'GET'
method: 'GET',
shieldError: true
})

export const read_message = (id: number) =>
Expand Down
29 changes: 28 additions & 1 deletion src/components/assistant/Sidebar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,7 @@
} from './util'
import { useI18n } from 'vue-i18n'
import { useToaster } from '@/components/modules/toats/index'
import { v4 as uuidv4 } from 'uuid'

const { t } = useI18n()
const sidebarStore = useSidebarStore()
Expand Down Expand Up @@ -303,6 +304,20 @@
}
}

const promptId = ref('')
const requestId = ref('')

// 生成新的会话ID
const generateNewPromptId = () => {
promptId.value = uuidv4()
localStorage.setItem('bizyair-prompt-id', promptId.value)
}

// 生成新的请求ID
const generateNewRequestId = () => {
requestId.value = uuidv4()
}

// 清空对话历史
const clearHistory = () => {
// 创建一个新的欢迎消息
Expand All @@ -315,6 +330,7 @@
// 更新UI显示
chatMessages.value = [welcomeMessage]
console.log('历史记录已清空,并添加了欢迎消息')
generateNewPromptId()
}

// 中止生成
Expand Down Expand Up @@ -348,6 +364,7 @@

const sendMessage = async () => {
if (!canSendMessage.value || isLoading.value) return
generateNewRequestId()

const messageText = userInput.value
const currentTime = getCurrentTime()
Expand Down Expand Up @@ -547,7 +564,9 @@
}
},
{
model: 'Qwen/Qwen2.5-VL-72B-Instruct'
model: 'Qwen/Qwen2.5-VL-72B-Instruct',
prompt_id: promptId.value,
request_id: requestId.value
}
)
} catch (error) {
Expand Down Expand Up @@ -763,6 +782,14 @@
}
}

const savedPromptId = localStorage.getItem('bizyair-prompt-id')
if (savedPromptId) {
promptId.value = savedPromptId
} else {
generateNewPromptId()
}
generateNewRequestId()

// 确保全局bizyAirLib对象存在
if (typeof window.bizyAirLib === 'undefined') {
;(window as any).bizyAirLib = {}
Expand Down
6 changes: 5 additions & 1 deletion src/components/assistant/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ export interface ChatApiOptions {
top_k: number
frequency_penalty: number
max_tokens: number
prompt_id?: string
request_id?: string
}

// 图像生成选项接口
Expand Down Expand Up @@ -75,7 +77,9 @@ export function buildChatRequestBody(
frequency_penalty: mergedOptions.frequency_penalty,
n: 1,
stop: [],
messages: messages
messages: messages,
prompt_id: mergedOptions.prompt_id,
request_id: mergedOptions.request_id
}
}

Expand Down
43 changes: 39 additions & 4 deletions src/components/community/detail/Index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,11 @@
}
}, 300)

const openInWeb = () => {
const url = `https://bizyair.cn/community/models/${communityStore.TabSource}/${model.value?.id}?version=${currentVersion.value?.id}`
window.open(url, '_blank')
}

const getShareCode = async () => {
if (!currentVersion.value) return
isLoading.value = true
Expand Down Expand Up @@ -369,6 +374,7 @@

const handleAddNode = async () => {
try {
isLoading.value = true
const nodeTypes: Record<string, string> = {
LoRA: 'BizyAir_LoraLoader',
Controlnet: 'BizyAir_ControlNetLoader',
Expand Down Expand Up @@ -415,10 +421,13 @@

canvas.graph.add(loraLoaderNode)
communityStore.showDialog = false
communityStore.showCommunityDetail = false
useToaster.success(t('community.detail.nodeAddedSuccessfully'))
} catch (error) {
console.error('Failed to add node:', error)
useToaster.error(t('community.detail.failedAddNode' + error))
useToaster.error(t('community.detail.failedAddNode') + error)
} finally {
isLoading.value = false
}
}

Expand Down Expand Up @@ -700,6 +709,30 @@
</svg>
</div>
</vTooltips>

<vTooltips :tips="t('community.detail.open')">
<div
@click="openInWeb"
class="w-[48px] h-[48px] bg-[#4e4e4e] hover:bg-[#4e4e4e]/60 rounded-lg flex items-center justify-center cursor-pointer"
>
<svg
xmlns="http://www.w3.org/2000/svg"
width="18"
height="18"
viewBox="0 0 512 512"
>
<path
fill="none"
stroke="#FFF"
stroke-linecap="round"
stroke-linejoin="round"
stroke-width="32"
d="M384 224v184a40 40 0 0 1-40 40H104a40 40 0 0 1-40-40V168a40 40 0 0 1 40-40h167.48M336 64h112v112M224 288L440 72"
/>
</svg>
</div>
</vTooltips>

<Popover
v-if="['my', 'my_fork'].includes(communityStore.TabSource)"
class="bg-[#353535]"
Expand Down Expand Up @@ -872,6 +905,7 @@
<Button
v-if="model?.type !== 'Workflow'"
class="flex w-[170px] px-8 py-2 justify-center items-center gap-2 bg-[#F43F5E] hover:bg-[#F43F5E]/90 rounded-[6px]"
:disabled="isLoading"
@click="handleAddNode"
>
<svg
Expand All @@ -886,9 +920,10 @@
stroke="#F9FAFB"
stroke-linecap="round"
stroke-linejoin="round"
/></svg
>{{ t('community.detail.addNode') }}</Button
>
/>
</svg>
{{ t('community.detail.addNode') }}
</Button>

<Button
v-if="model?.type === 'Workflow'"
Expand Down
7 changes: 4 additions & 3 deletions src/components/model-select/detail/Index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -786,9 +786,10 @@
stroke="#F9FAFB"
stroke-linecap="round"
stroke-linejoin="round"
/></svg
>{{ t('modelSelect.apply') }}</Button
>
/>
</svg>
{{ t('modelSelect.apply') }}
</Button>
</div>
</div>
<div
Expand Down
10 changes: 10 additions & 0 deletions src/components/model-select/modules/ModelFilterBar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,16 @@
}
}

// 确保所有BaseModel在初始化时都被选中
if (
store.baseModelTypes &&
store.baseModelTypes.length > 0 &&
(!store[props.page].filterState.base_models ||
store[props.page].filterState.base_models.length === 0)
) {
store[props.page].filterState.base_models = store.baseModelTypes.map(model => model.value)
}

await nextTick()
emit('filter-data-ready')
}
Expand Down
2 changes: 1 addition & 1 deletion src/components/modules/toats/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
<Check class="w-6 h-6 mr-2" v-if="type === 'success'" />
<CircleX class="w-6 h-6 mr-2" v-if="type === 'error'" />
<TriangleAlert class="w-6 h-6 mr-2" v-if="type === 'warning'" />
<span class="flex-1">
<span class="flex-1 bizy-toast-message-text">
{{ message }}
</span>
<X class="absolute right-2 top-2 cursor-pointer" @click="close" />
Expand Down
4 changes: 3 additions & 1 deletion src/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
"error": {
"empty": "Clipboard content is empty or not a string.",
"length": "Clipboard content length is incorrect.",
"shareCodeLength": "Share code length is incorrect."
"shareCodeLength": "Share code length is incorrect.",
"invalid": "Share code format is incorrect."
}
},
"assistant": "BizyBot"
Expand Down Expand Up @@ -201,6 +202,7 @@
"load": "Load",
"loading": "Loading...",
"share": "Share",
"open": "Open on the website",
"copy": "Copy",
"download": "Download",
"stats": "Stats",
Expand Down
4 changes: 3 additions & 1 deletion src/locales/zh.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
"error": {
"empty": "剪贴板内容为空或不是字符串。",
"length": "剪贴板内容长度不正确。",
"shareCodeLength": "分享码长度不正确。"
"shareCodeLength": "分享码长度不正确。",
"invalid": "分享码格式不正确。"
}
},
"assistant": "BizyBot"
Expand Down Expand Up @@ -201,6 +202,7 @@
"load": "加载",
"loading": "加载中...",
"share": "分享",
"open": "在网站中打开",
"copy": "复制",
"download": "下载",
"stats": "统计",
Expand Down
Loading
Loading