Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
inscode
NodeJS_639770
提交
6b91b215
N
NodeJS_639770
项目概览
inscode
/
NodeJS_639770
与 Fork 源项目一致
Fork自
inscode / NodeJS
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
N
NodeJS_639770
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
提交
6b91b215
编写于
6月 11, 2024
作者:
D
DebugIsFalse
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix: eslint
上级
59b14e7f
变更
30
隐藏空白更改
内联
并排
Showing
30 changed file
with
88 addition
and
72 deletion
+88
-72
archive/Process.vue
archive/Process.vue
+1
-1
archive/SearchHistory.vue
archive/SearchHistory.vue
+3
-3
components/color-picker/ColorPicker.vue
components/color-picker/ColorPicker.vue
+10
-4
components/color-picker/ColorPickerPill.vue
components/color-picker/ColorPickerPill.vue
+2
-2
components/i/Confirm.vue
components/i/Confirm.vue
+1
-1
components/i/Create.vue
components/i/Create.vue
+2
-1
components/i/SearchHistory.vue
components/i/SearchHistory.vue
+2
-1
components/i/Sign.vue
components/i/Sign.vue
+1
-1
components/i/action/Collect.vue
components/i/action/Collect.vue
+1
-1
components/i/action/Thread.vue
components/i/action/Thread.vue
+6
-6
components/i/library/Create.vue
components/i/library/Create.vue
+1
-1
components/i/library/Edit.vue
components/i/library/Edit.vue
+1
-1
components/i/library/Header.vue
components/i/library/Header.vue
+2
-2
components/i/library/Select.vue
components/i/library/Select.vue
+6
-5
components/i/library/Thread.vue
components/i/library/Thread.vue
+4
-3
components/i/md/mdc.vue
components/i/md/mdc.vue
+2
-1
components/i/search/Ask.vue
components/i/search/Ask.vue
+1
-1
components/i/search/Content.vue
components/i/search/Content.vue
+5
-3
components/i/search/ExtraInfo.vue
components/i/search/ExtraInfo.vue
+2
-1
components/i/search/Header.vue
components/i/search/Header.vue
+1
-1
components/i/search/Process.vue
components/i/search/Process.vue
+1
-1
components/i/search/RecommendQuestion.vue
components/i/search/RecommendQuestion.vue
+1
-1
components/i/search/Title.vue
components/i/search/Title.vue
+1
-1
components/prose/Chart.global.vue
components/prose/Chart.global.vue
+2
-2
composables/useCollectionRequest.js
composables/useCollectionRequest.js
+7
-7
composables/useRequestError.js
composables/useRequestError.js
+1
-1
eslint.config.mjs
eslint.config.mjs
+2
-2
pages/library/index.vue
pages/library/index.vue
+1
-1
pages/search/[id].vue
pages/search/[id].vue
+14
-12
utils/searchUtil.js
utils/searchUtil.js
+4
-4
未找到文件。
archive/Process.vue
浏览文件 @
6b91b215
...
...
@@ -74,6 +74,6 @@ watch(() => props.collapse, () => {
handleCollapse
(
false
)
},
500
)
}
},
{
immediate
:
true
})
},
{
immediate
:
true
})
defineExpose
({
handleCollapse
})
</
script
>
archive/SearchHistory.vue
浏览文件 @
6b91b215
...
...
@@ -87,7 +87,7 @@
</template>
<
script
setup
>
import
{
IConfirm
}
from
'
#components
'
const
emits
=
defineEmits
([
'
sign
'
,
'
clear
'
])
const
emits
=
defineEmits
([
'
sign
'
,
'
clear
'
])
const
modal
=
useModal
()
const
{
$isSignIn
}
=
storeToRefs
(
useUserStore
())
const
{
$searchHistory
}
=
storeToRefs
(
useSearchStore
())
...
...
@@ -109,13 +109,13 @@ function handleClear () {
})
}
function
handleRemoveRecordItem
(
id
)
{
handleRemoveRecords
([
id
])
handleRemoveRecords
([
id
])
}
async
function
handleRemoveRecords
(
ids
)
{
if
(
!
ids
)
{
ids
=
$searchHistory
.
value
.
map
(
item
=>
item
.
c_id
)
}
const
{
data
}
=
await
useRequest
(
'
/v1/chat/completion/remove
'
,
{
const
{
data
}
=
await
useRequest
(
'
/v1/chat/completion/remove
'
,
{
method
:
'
post
'
,
body
:
ids
})
...
...
components/color-picker/ColorPicker.vue
浏览文件 @
6b91b215
...
...
@@ -15,14 +15,20 @@
<
template
#panel
>
<div
class=
"flex flex-col p-2 gap-2"
>
<div
class=
"grid grid-cols-5 gap-px"
>
<ColorPickerPill
v-for=
"color in primaryColors"
:key=
"color.value"
:color=
"color"
:selected=
"primary"
@
select=
"primary = color"
/>
<ColorPickerPill
v-for=
"color in primaryColors"
:key=
"color.value"
:color=
"color"
:selected=
"primary"
@
select=
"primary = color"
/>
</div>
<UDivider/>
<div
class=
"grid grid-cols-5 gap-px"
>
<ColorPickerPill
v-for=
"color in grayColors"
:key=
"color.value"
:color=
"color"
:selected=
"gray"
<ColorPickerPill
v-for=
"color in grayColors"
:key=
"color.value"
:color=
"color"
:selected=
"gray"
@
select=
"gray = color"
/>
</div>
</div>
...
...
@@ -50,7 +56,7 @@ const primary = computed({
}
})
const
grayColors
=
computed
(()
=>
[
'
slate
'
,
'
cool
'
,
'
zinc
'
,
'
neutral
'
,
'
stone
'
].
map
(
color
=>
({
value
:
color
,
text
:
color
,
hex
:
colors
[
color
][
colorMode
.
value
===
'
dark
'
?
400
:
500
]
})))
const
grayColors
=
computed
(()
=>
[
'
slate
'
,
'
cool
'
,
'
zinc
'
,
'
neutral
'
,
'
stone
'
].
map
(
color
=>
({
value
:
color
,
text
:
color
,
hex
:
colors
[
color
][
colorMode
.
value
===
'
dark
'
?
400
:
500
]
})))
const
gray
=
computed
({
get
()
{
return
grayColors
.
value
.
find
(
option
=>
option
.
value
===
appConfig
.
ui
.
gray
)
...
...
components/color-picker/ColorPickerPill.vue
浏览文件 @
6b91b215
...
...
@@ -20,6 +20,6 @@
</
template
>
<
script
setup
lang=
"ts"
>
defineProps
<
{
color
:
{
value
:
string
,
hex
:
string
},
selected
:
{
value
:
string
}
}
>
()
defineEmits
([
'
select
'
])
defineProps
<
{
color
:
{
value
:
string
,
hex
:
string
},
selected
:
{
value
:
string
}
}
>
()
defineEmits
([
'
select
'
])
</
script
>
\ No newline at end of file
components/i/Confirm.vue
浏览文件 @
6b91b215
...
...
@@ -32,7 +32,7 @@ defineProps({
default
:
false
}
})
const
emits
=
defineEmits
([
'
success
'
,
'
cancel
'
])
const
emits
=
defineEmits
([
'
success
'
,
'
cancel
'
])
function
handleCancel
()
{
emits
(
'
cancel
'
)
}
...
...
components/i/Create.vue
浏览文件 @
6b91b215
...
...
@@ -17,7 +17,8 @@
<div
class=
"flex justify-between items-center"
>
<div
class=
"flex items-center gap-2"
>
<UTooltip
class=
"relative"
:text=
"isPro ? '已开启专家搜索' : '已关闭专家搜索'"
:shortcuts=
"[metaSymbol, 'O']"
>
<div
v-show=
"!isPro"
<div
v-show=
"!isPro"
class=
"absolute w-7 h-0.5 rotate-45 top-3.5 left-1 bg-gray-700 dark:bg-gray-200 hover:bg-gray-900 dark:hover:bg-white rounded"
/>
<UButton
:ui=
"
{ rounded: 'rounded-full' }"
...
...
components/i/SearchHistory.vue
浏览文件 @
6b91b215
...
...
@@ -18,7 +18,8 @@
/>
</div>
<ClientOnly>
<div
v-auto-animate
<div
v-auto-animate
class=
"flex overflow-y-auto flex-col gap-1 border-l border-gray-200 dark:border-gray-800 pl-2 ml-5"
>
<template
v-for=
"item in $searchHistory.reverse()"
:key=
"item.c_id"
>
<UButton
...
...
components/i/Sign.vue
浏览文件 @
6b91b215
...
...
@@ -52,7 +52,7 @@
</div>
</
template
>
<
script
setup
>
const
emits
=
defineEmits
([
'
close
'
,
'
signIn
'
])
const
emits
=
defineEmits
([
'
close
'
,
'
signIn
'
])
// const email = ref('')
function
handleClose
()
{
emits
(
'
close
'
)
...
...
components/i/action/Collect.vue
浏览文件 @
6b91b215
...
...
@@ -15,7 +15,7 @@ const { deleteCollection } = useCollectionRequest()
const
modal
=
useModal
()
const
props
=
defineProps
({
id
:
{
type
:
[
String
,
Number
],
type
:
[
String
,
Number
],
default
:
''
}
})
...
...
components/i/action/Thread.vue
浏览文件 @
6b91b215
...
...
@@ -17,11 +17,11 @@ const Layout = inject('Layout')
const
modal
=
useModal
()
const
props
=
defineProps
({
collectionId
:
{
type
:
[
String
,
Number
],
type
:
[
String
,
Number
],
default
:
''
},
cId
:
{
type
:
[
String
,
Number
],
type
:
[
String
,
Number
],
default
:
''
},
size
:
{
...
...
@@ -29,7 +29,7 @@ const props = defineProps({
default
:
'
sm
'
}
})
const
emit
=
defineEmits
([
'
delete
'
])
const
emit
=
defineEmits
([
'
delete
'
])
const
actionItems
=
computed
(()
=>
{
let
items
if
(
props
.
collection_id
&&
props
.
c_id
)
{
...
...
@@ -38,7 +38,7 @@ const actionItems = computed(() => {
label
:
'
更改合集
'
,
icon
:
'
i-heroicons-squares-plus
'
,
click
:
()
=>
{
$openLibrarySelect
(
props
.
c_id
,
[
props
.
collection_id
])
$openLibrarySelect
(
props
.
c_id
,
[
props
.
collection_id
])
}
},
{
...
...
@@ -73,7 +73,7 @@ const actionItems = computed(() => {
description
:
'
确定要删除该主题吗?
'
,
async
onSuccess
()
{
modal
.
close
()
await
deleteThread
([
props
.
c_id
])
await
deleteThread
([
props
.
c_id
])
$getCollection
()
emit
(
'
delete
'
)
},
...
...
@@ -83,6 +83,6 @@ const actionItems = computed(() => {
})
}
})
return
[
items
]
return
[
items
]
})
</
script
>
components/i/library/Create.vue
浏览文件 @
6b91b215
...
...
@@ -70,7 +70,7 @@ const { $closeLibraryCreate, $getCollection } = useLibraryStore()
const
{
setOrUpdateCollection
}
=
useCollectionRequest
()
const
props
=
defineProps
({
id
:
{
type
:
[
String
,
Number
],
type
:
[
String
,
Number
],
default
:
''
}
})
...
...
components/i/library/Edit.vue
浏览文件 @
6b91b215
...
...
@@ -4,7 +4,7 @@
<
script
setup
>
defineProps
({
id
:
{
type
:
[
String
,
Number
],
type
:
[
String
,
Number
],
default
:
''
}
})
...
...
components/i/library/Header.vue
浏览文件 @
6b91b215
...
...
@@ -73,7 +73,7 @@ defineProps({
default
:
0
},
collectId
:
{
type
:
[
String
,
Number
],
type
:
[
String
,
Number
],
default
:
''
},
showTabs
:
{
...
...
@@ -85,7 +85,7 @@ defineProps({
default
:
0
}
})
const
emit
=
defineEmits
([
'
search
'
,
'
clear
'
,
'
change-tab
'
])
const
emit
=
defineEmits
([
'
search
'
,
'
clear
'
,
'
change-tab
'
])
const
searchQuery
=
ref
(
''
)
const
searchLoading
=
ref
(
false
)
defineShortcuts
({
...
...
components/i/library/Select.vue
浏览文件 @
6b91b215
...
...
@@ -30,7 +30,8 @@
>
<div
class=
"flex flex-grow justify-between items-center"
>
<div>
{{ item.name }}
</div>
<UIcon
v-if=
"selected.includes(item.id)"
name=
"i-heroicons-check-circle-20-solid"
<UIcon
v-if=
"selected.includes(item.id)"
name=
"i-heroicons-check-circle-20-solid"
class=
"text-primary text-lg"
/>
</div>
</UButton>
...
...
@@ -53,7 +54,7 @@
const
{
$isLibrarySelectOpen
,
$selectCollectionId
,
$selectThreadId
,
$collection
}
=
storeToRefs
(
useLibraryStore
())
const
{
$closeLibrarySelect
,
$openLibraryCreate
,
$setSelectCollectionId
,
$getCollection
}
=
useLibraryStore
()
const
{
saveCollection
,
deleteCollectionRecord
}
=
useCollectionRequest
()
const
emits
=
defineEmits
([
'
success
'
])
const
emits
=
defineEmits
([
'
success
'
])
// 合集列表
const
selected
=
ref
([])
const
loading
=
ref
(
false
)
...
...
@@ -65,7 +66,7 @@ function handleOpenCreate () {
$openLibraryCreate
()
}
async
function
handleSelected
(
id
)
{
selected
.
value
=
[
id
]
selected
.
value
=
[
id
]
}
async
function
handleSave
()
{
if
(
loading
.
value
)
return
...
...
@@ -80,7 +81,7 @@ async function handleSave() {
if
(
selected
.
value
.
length
)
{
const
selectedItem
=
selected
.
value
[
0
]
const
{
error
}
=
await
saveCollection
({
collection_id
:
selectedItem
,
c_id
:
$selectThreadId
.
value
})
!
error
.
value
&&
$setSelectCollectionId
([
selectedItem
])
!
error
.
value
&&
$setSelectCollectionId
([
selectedItem
])
}
loading
.
value
=
false
handleClose
()
...
...
@@ -92,7 +93,7 @@ async function handleSave() {
})
}
watch
(()
=>
$isLibrarySelectOpen
.
value
,
()
=>
{
selected
.
value
=
[
...
$selectCollectionId
.
value
]
selected
.
value
=
[
...
$selectCollectionId
.
value
]
if
(
!
$collection
.
value
.
length
)
{
$getCollection
()
}
...
...
components/i/library/Thread.vue
浏览文件 @
6b91b215
...
...
@@ -7,7 +7,8 @@
</ULink>
<div
class=
"flex justify-between items-center"
>
<div
class=
"flex gap-4"
>
<UTooltip
class=
"flex items-center text-sm gap-0.5"
:class=
"textColor"
<UTooltip
class=
"flex items-center text-sm gap-0.5"
:class=
"textColor"
:text=
"thread.is_public ? '公开主题,链接可被发现' : '私密主题,仅自己可见'"
>
<UIcon
:name=
"thread.is_public ? 'i-heroicons-lock-open' : 'i-heroicons-lock-closed'"
/>
<span>
{{
thread
.
is_public
?
'
公开
'
:
'
私有
'
}}
</span>
...
...
@@ -70,7 +71,7 @@ const props = defineProps({
default
:
false
}
})
const
emit
=
defineEmits
([
'
delete
'
])
const
emit
=
defineEmits
([
'
delete
'
])
const
thread
=
computed
(()
=>
{
if
(
!
props
.
isItem
)
return
props
.
item
else
{
...
...
@@ -94,7 +95,7 @@ function handleOpenSelect () {
function
handleUpdateCollect
(
data
)
{
const
{
c_id
}
=
data
.
value
if
(
c_id
===
thread
.
value
.
c_id
)
{
thread
.
value
.
collections
=
[
data
.
value
]
thread
.
value
.
collections
=
[
data
.
value
]
Layout
.
handleClearCollectData
()
}
}
...
...
components/i/md/mdc.vue
浏览文件 @
6b91b215
<
template
>
<div
class=
"grid grid-cols-1"
>
<MDC
v-if=
"content"
class=
"prose dark:prose-invert max-w-none"
:class=
"'prose-' + size"
:value=
"content"
<MDC
v-if=
"content"
class=
"prose dark:prose-invert max-w-none"
:class=
"'prose-' + size"
:value=
"content"
tag=
"article"
/>
</div>
</
template
>
...
...
components/i/search/Ask.vue
浏览文件 @
6b91b215
...
...
@@ -53,7 +53,7 @@ const props = defineProps({
default
:
false
}
})
const
emits
=
defineEmits
([
'
ask
'
,
'
stop
'
])
const
emits
=
defineEmits
([
'
ask
'
,
'
stop
'
])
const
isFocus
=
ref
(
false
)
const
cardUI
=
computed
(()
=>
{
const
base
=
{
...
...
components/i/search/Content.vue
浏览文件 @
6b91b215
...
...
@@ -15,10 +15,12 @@
</div>
<IMdMdc
:content=
"item.article"
/>
<div
v-if=
"item.showActions"
class=
"space-x-2"
>
<UButton
size=
"xs"
color=
"gray"
leading-icon=
"i-heroicons-document-duplicate-20-solid"
label=
"复制"
<UButton
size=
"xs"
color=
"gray"
leading-icon=
"i-heroicons-document-duplicate-20-solid"
label=
"复制"
@
click=
"handleCopyMD"
/>
<UButton
size=
"xs"
color=
"gray"
leading-icon=
"i-heroicons-share-20-solid"
label=
"分享"
@
click=
"handleShare"
/>
<UButton
v-if=
"isLastIndex"
size=
"xs"
color=
"gray"
leading-icon=
"i-heroicons-arrow-path-rounded-square-20-solid"
<UButton
v-if=
"isLastIndex"
size=
"xs"
color=
"gray"
leading-icon=
"i-heroicons-arrow-path-rounded-square-20-solid"
label=
"重写"
@
click=
"handleReGenerate"
/>
</div>
</template>
...
...
@@ -55,7 +57,7 @@ const props = defineProps({
default
:
''
// start | finish
}
})
const
emits
=
defineEmits
([
'
regenerate
'
])
const
emits
=
defineEmits
([
'
regenerate
'
])
function
handleReGenerate
()
{
emits
(
'
regenerate
'
,
props
.
index
)
}
...
...
components/i/search/ExtraInfo.vue
浏览文件 @
6b91b215
...
...
@@ -14,7 +14,8 @@
<div
class=
"flex mb-2"
>
<div
class=
"flex items-center gap-1 text-sm overflow-hidden"
>
<UIcon
class=
"flex-shrink-0"
name=
"i-simple-icons-github"
/>
<ULink
class=
"flex-grow truncate underline"
:to=
"chart.info.url"
target=
"_blank"
<ULink
class=
"flex-grow truncate underline"
:to=
"chart.info.url"
target=
"_blank"
:title=
"chart.info.description"
>
{{
chart
.
info
.
name
}}
</ULink>
<UIcon
class=
"flex-shrink-0"
name=
"i-heroicons-arrow-top-right-on-square"
/>
...
...
components/i/search/Header.vue
浏览文件 @
6b91b215
...
...
@@ -112,7 +112,7 @@ const state = reactive({
id
:
route
.
params
.
id
})
const
Layout
=
inject
(
'
Layout
'
)
const
emits
=
defineEmits
([
'
update-query
'
])
const
emits
=
defineEmits
([
'
update-query
'
])
const
isEditTitle
=
ref
(
false
)
const
titleRef
=
ref
(
null
)
const
editTitle
=
ref
(
''
)
...
...
components/i/search/Process.vue
浏览文件 @
6b91b215
...
...
@@ -65,6 +65,6 @@ watch(() => props.collapse, () => {
handleCollapse
(
false
)
},
1000
)
}
},
{
immediate
:
true
})
},
{
immediate
:
true
})
defineExpose
({
handleCollapse
})
</
script
>
components/i/search/RecommendQuestion.vue
浏览文件 @
6b91b215
...
...
@@ -26,7 +26,7 @@ defineProps({
default
:
()
=>
[]
}
})
const
emits
=
defineEmits
([
'
click
'
])
const
emits
=
defineEmits
([
'
click
'
])
function
handleClick
(
title
)
{
emits
(
'
click
'
,
title
)
}
...
...
components/i/search/Title.vue
浏览文件 @
6b91b215
...
...
@@ -12,7 +12,7 @@ const props = defineProps({
default
:
''
},
id
:
{
type
:
[
String
,
Number
],
type
:
[
String
,
Number
],
default
:
''
}
})
...
...
components/prose/Chart.global.vue
浏览文件 @
6b91b215
...
...
@@ -45,8 +45,8 @@ function init () {
datasets
:
props
.
data
.
map
(
item
=>
{
// item.backgroundColor = ['rgba(54, 162, 235, 0.2)', 'rgba(255, 99, 132, 0.2)', 'rgba(255, 159, 64, 0.2)', 'rgba(255, 205, 86, 0.2)', 'rgba(75, 192, 192, 0.2)', 'rgba(153, 102, 255, 0.2)', 'rgba(201, 203, 207, 0.2)']
// item.borderColor = ['rgb(54, 162, 235)', 'rgb(255, 99, 132)', 'rgb(255, 159, 64)', 'rgb(255, 205, 86)', 'rgb(75, 192, 192)', 'rgb(153, 102, 255)', 'rgb(201, 203, 207)']
item
.
backgroundColor
=
[
'
rgba(54, 162, 235, 0.2)
'
]
item
.
borderColor
=
[
'
rgb(54, 162, 235)
'
]
item
.
backgroundColor
=
[
'
rgba(54, 162, 235, 0.2)
'
]
item
.
borderColor
=
[
'
rgb(54, 162, 235)
'
]
item
.
borderWidth
=
1
return
item
})
...
...
composables/useCollectionRequest.js
浏览文件 @
6b91b215
...
...
@@ -9,7 +9,7 @@ export default () => {
* description string
*
*/
const
{
data
,
error
}
=
await
useRequest
(
'
/v1/collection/merge
'
,
{
const
{
data
,
error
}
=
await
useRequest
(
'
/v1/collection/merge
'
,
{
method
:
'
post
'
,
body
})
...
...
@@ -17,7 +17,7 @@ export default () => {
}
// 删除收藏夹
const
deleteCollection
=
async
(
collection_id
)
=>
{
const
{
data
,
error
}
=
await
useRequest
(
`/v1/collection/
${
collection_id
}
/remove`
,
{
const
{
data
,
error
}
=
await
useRequest
(
`/v1/collection/
${
collection_id
}
/remove`
,
{
method
:
'
post
'
})
return
{
data
,
error
}
...
...
@@ -26,7 +26,7 @@ export default () => {
const
saveCollection
=
async
(
body
)
=>
{
// collection_id number 收藏夹ID
// c_id string 会话ID
const
{
data
,
error
}
=
await
useRequest
(
`/v1/collection/item/add`
,
{
const
{
data
,
error
}
=
await
useRequest
(
'
/v1/collection/item/add
'
,
{
method
:
'
post
'
,
body
})
...
...
@@ -34,7 +34,7 @@ export default () => {
}
// 查询收藏夹会话列表
const
findCollection
=
async
(
collection_id
)
=>
{
const
{
data
,
error
}
=
await
useRequest
(
`/v1/collection/
${
collection_id
}
/items`
)
const
{
data
,
error
}
=
await
useRequest
(
`/v1/collection/
${
collection_id
}
/items`
)
if
(
error
.
value
)
{
return
[]
}
...
...
@@ -42,7 +42,7 @@ export default () => {
}
// 删除收藏夹会话
const
deleteCollectionRecord
=
async
(
collection_id
,
c_id
)
=>
{
const
{
data
,
error
}
=
await
useRequest
(
`/v1/collection/item/delete`
,
{
const
{
data
,
error
}
=
await
useRequest
(
'
/v1/collection/item/delete
'
,
{
method
:
'
post
'
,
body
:
{
collection_id
,
c_id
}
})
...
...
@@ -51,12 +51,12 @@ export default () => {
}
// 查询会话是否被收藏
const
findRecordCollection
=
async
(
c_id
)
=>
{
const
{
data
,
error
}
=
await
useRequest
(
`/v1/collection/item/check/
${
c_id
}
`
)
const
{
data
,
error
}
=
await
useRequest
(
`/v1/collection/item/check/
${
c_id
}
`
)
return
{
data
,
error
}
}
const
deleteThread
=
async
(
ids
)
=>
{
const
{
data
,
error
}
=
await
useRequest
(
'
/v1/chat/completion/remove
'
,
{
const
{
data
,
error
}
=
await
useRequest
(
'
/v1/chat/completion/remove
'
,
{
method
:
'
post
'
,
body
:
ids
})
...
...
composables/useRequestError.js
浏览文件 @
6b91b215
export
default
function
(
status
,
message
)
{
if
(
import
.
meta
.
client
&&
[
400
,
401
,
403
].
includes
(
status
))
{
if
(
import
.
meta
.
client
&&
[
400
,
401
,
403
].
includes
(
status
))
{
// 全局弹提示
let
title
if
(
status
===
400
)
title
=
message
...
...
eslint.config.mjs
浏览文件 @
6b91b215
...
...
@@ -3,7 +3,7 @@ import withNuxt from './.nuxt/eslint.config.mjs'
export
default
withNuxt
({
files
:
[
'
**/*.vue
'
,
'
**/*.js
'
],
ignores
:
[
'
node_modules/**
'
],
rules
:
{
'
semi
'
:
[
0
],
'
vue/html-indent
'
:
[
'
off
'
],
...
...
@@ -20,6 +20,6 @@ export default withNuxt({
// 关键字后面是否要空一格
'
keyword-spacing
'
:
[
2
,
{
'
before
'
:
true
,
'
after
'
:
true
}],
// 强制最后一行空行
'
no-multiple-empty-lines
'
:
[
'
error
'
,
{
'
max
'
:
2
,
'
maxEOF
'
:
1
}]
'
no-multiple-empty-lines
'
:
[
'
error
'
,
{
'
max
'
:
2
,
'
maxEOF
'
:
1
}],
}
})
pages/library/index.vue
浏览文件 @
6b91b215
...
...
@@ -39,7 +39,7 @@
</div>
</
template
>
<
script
setup
>
import
{
LG
}
from
'
~/composables/useMQ.js
'
;
import
{
LG
}
from
'
~/composables/useMQ.js
'
;
const
{
$collection
}
=
storeToRefs
(
useLibraryStore
())
const
{
$openLibraryCreate
,
$getCollection
}
=
useLibraryStore
()
...
...
pages/search/[id].vue
浏览文件 @
6b91b215
...
...
@@ -9,8 +9,10 @@
:repo=
"state.repo"
@
update-query=
"handleUpdateQuery"
/>
<div
ref=
"scrollElement"
class=
"container min-h-svh max-w-screen-lg 2xl:max-w-screen-xl flex flex-col space-y-6 p-6 mb-6 pb-0"
>
<div
ref=
"scrollElement"
class=
"container min-h-svh max-w-screen-lg 2xl:max-w-screen-xl flex flex-col space-y-6 p-6 mb-6 pb-0"
>
<template
v-for=
"(item, index) in data"
:key=
"index"
>
<ISearchArticle>
<template
#title
>
...
...
@@ -101,8 +103,8 @@ function initSearchItemInfo (info, records) {
async
function
initSearchRecordsChart
(
repos
)
{
if
(
!
import
.
meta
.
client
)
return
repos
.
forEach
((
repo
)
=>
{
const
{
output
,
index
}
=
repo
const
{
gits
,
urls
}
=
handleFormatInfoData
(
output
)
const
{
output
,
index
}
=
repo
const
{
gits
,
urls
}
=
handleFormatInfoData
(
output
)
fetchRepoStarsData
(
urls
).
then
((
result
)
=>
{
const
card
=
handleFormatRepoStars
(
result
,
gits
)
const
cardItem
=
data
.
value
[
index
].
extra
.
find
(
item
=>
item
.
type
===
card
.
type
)
...
...
@@ -117,7 +119,7 @@ function initSearchRecords (records) {
let
{
answer
,
actions
}
=
item
const
{
question
,
answer_type
}
=
item
answer
=
answer_type
===
'
json
'
?
handleFormatReports
(
answer
)
:
answer
const
historyItem
=
{
article
:
answer
,
question
,
showActions
:
true
}
const
historyItem
=
{
article
:
answer
,
question
,
showActions
:
true
}
actions
=
typeof
actions
===
'
string
'
?
JSON
.
parse
(
actions
)
:
actions
historyItem
.
extra
=
historyItem
.
extra
||
[]
// 处理搜索过程
...
...
@@ -131,7 +133,7 @@ function initSearchRecords (records) {
}
else
if
(
action
===
'
search_relate_repo
'
)
{
// 处理请求Loading使用使用
historyItem
.
extra
.
push
({
ready
:
false
,
type
:
action
})
repos
.
push
({
output
:
child
.
output
,
index
})
repos
.
push
({
output
:
child
.
output
,
index
})
}
return
child
})
...
...
@@ -189,7 +191,7 @@ function scrollToView () {
function
createGenerateInitItem
(
question
,
regenerate
)
{
if
(
askingData
.
value
.
question
&&
!
regenerate
)
{
const
deepCopy
=
JSON
.
parse
(
JSON
.
stringify
(
askingData
.
value
))
deepCopy
.
extra
=
[
...
askingSidebarCards
.
value
]
deepCopy
.
extra
=
[
...
askingSidebarCards
.
value
]
data
.
value
.
push
(
deepCopy
)
}
askingData
.
value
.
question
=
''
...
...
@@ -241,7 +243,7 @@ function handleFormFetchData (fetchData) {
let
message
=
{}
try
{
message
=
JSON
.
parse
(
fetchData
)
}
catch
(
error
)
{
}
}
catch
(
error
)
{
}
if
(
Object
.
keys
(
message
).
length
===
0
)
return
const
{
meta
,
choices
,
error
,
code
}
=
message
// 处理403
...
...
@@ -265,7 +267,7 @@ function handleFormFetchData (fetchData) {
const
content
=
choices
[
0
].
message
.
content
switch
(
meta
.
action
)
{
case
'
rephrase_question
'
:
askingData
.
value
.
actions
.
push
({
action
:
meta
.
action
,
output
:
content
})
askingData
.
value
.
actions
.
push
({
action
:
meta
.
action
,
output
:
content
})
break
case
'
search_file
'
:
askingData
.
value
.
source
=
handleFormatSource
(
content
,
state
)
...
...
@@ -312,17 +314,17 @@ function handleStopGenerate () {
aiChatController
&&
aiChatController
.
abort
()
}
function
handleError
(
event
)
{
console
.
log
(
`error:`
,
event
)
console
.
log
(
'
error:
'
,
event
)
resetAskingData
(
''
)
handleStopGenerate
()
if
(
event
)
throw
event
}
function
handleOpen
(
status
)
{
if
([
401
,
403
].
includes
(
status
))
resetAskingData
(
''
)
if
([
401
,
403
].
includes
(
status
))
resetAskingData
(
''
)
}
async
function
fetchLinkedQuestion
(
query
)
{
const
{
gitPath
,
id
}
=
state
const
messages
=
[
{
role
:
'
user
'
,
content
:
query
}
]
const
messages
=
[
{
role
:
'
user
'
,
content
:
query
}
]
const
{
data
}
=
await
useRequest
(
'
/v1/chat/recomend_question
'
,
{
method
:
'
post
'
,
body
:
{
repo_path
:
gitPath
||
''
,
c_id
:
id
,
messages
}
...
...
utils/searchUtil.js
浏览文件 @
6b91b215
...
...
@@ -56,7 +56,7 @@ export function gitToLabel(url) {
// 如果匹配不到,返回空字符串
if
(
!
match
)
{
return
""
;
return
''
;
}
// 返回匹配到的项目名称
...
...
@@ -75,7 +75,7 @@ export function handleFormatRepoStars (repoObj, gits) {
})
Object
.
keys
(
repoObj
).
forEach
(
child
=>
{
const
data
=
repoObj
[
child
]
const
cardDataItem
=
{
data
:
[
{
data
:
[],
label
:
'
Star 数量
'
}
],
labels
:
[],
info
:
gitsMap
[
child
]
}
const
cardDataItem
=
{
data
:
[
{
data
:
[],
label
:
'
Star 数量
'
}
],
labels
:
[],
info
:
gitsMap
[
child
]
}
data
.
forEach
(
dataItem
=>
{
const
{
date
,
stargazers
}
=
dataItem
cardDataItem
.
labels
.
push
(
date
)
...
...
@@ -92,7 +92,7 @@ export function baseGitUrl(gitPath) {
return
endWidthGit
?
gitPath
.
slice
(
0
,
gitPath
.
length
-
4
)
:
gitPath
}
export
function
handleFormatSource
(
source
,
params
)
{
const
{
gitPath
,
branch
,
repo
}
=
params
const
{
gitPath
,
branch
,
repo
}
=
params
if
(
Array
.
isArray
(
source
))
return
source
const
gitUrl
=
baseGitUrl
(
gitPath
)
return
source
.
split
(
'
\n
'
).
map
((
item
)
=>
{
...
...
@@ -118,7 +118,7 @@ export function handleFormatInfoData (output) {
if
(
typeof
output
===
'
string
'
)
{
try
{
info
.
gits
=
JSON
.
parse
(
output
)
}
catch
(
error
)
{
}
}
catch
(
error
)
{
}
}
else
{
info
.
gits
=
output
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录