style: format code
This commit is contained in:
parent
9bc86c070c
commit
e27a10b5f1
@ -4,13 +4,7 @@ import re
|
|||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
from yuxi import config as conf
|
from yuxi import config as conf
|
||||||
from yuxi.utils.paths import (
|
from yuxi.utils.paths import OUTPUTS_DIR_NAME, UPLOADS_DIR_NAME, VIRTUAL_PATH_PREFIX, WORKSPACE_DIR_NAME
|
||||||
VIRTUAL_PATH_PREFIX,
|
|
||||||
WORKSPACE_DIR_NAME,
|
|
||||||
OUTPUTS_DIR_NAME,
|
|
||||||
UPLOADS_DIR_NAME
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
_SAFE_THREAD_ID_RE = re.compile(r"^[A-Za-z0-9_-]+$")
|
_SAFE_THREAD_ID_RE = re.compile(r"^[A-Za-z0-9_-]+$")
|
||||||
|
|
||||||
|
|||||||
@ -1,12 +1,11 @@
|
|||||||
from yuxi.utils.paths import (
|
from yuxi.utils.paths import (
|
||||||
VIRTUAL_PATH_PREFIX,
|
VIRTUAL_KBS_PATH,
|
||||||
VIRTUAL_PATH_WORKSPACE,
|
|
||||||
VIRTUAL_PATH_OUTPUTS,
|
VIRTUAL_PATH_OUTPUTS,
|
||||||
|
VIRTUAL_PATH_PREFIX,
|
||||||
VIRTUAL_PATH_UPLOADS,
|
VIRTUAL_PATH_UPLOADS,
|
||||||
VIRTUAL_KBS_PATH
|
VIRTUAL_PATH_WORKSPACE,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
PROMPT = f"""
|
PROMPT = f"""
|
||||||
你是一个人工智能助手 “语析”,专门用来回答用户的问题。请根据用户提供的信息,尽可能详细地回答问题。
|
你是一个人工智能助手 “语析”,专门用来回答用户的问题。请根据用户提供的信息,尽可能详细地回答问题。
|
||||||
如果你不确定答案,可以说你不知道,但请尽量提供相关的信息或建议。请保持礼貌和专业。
|
如果你不确定答案,可以说你不知道,但请尽量提供相关的信息或建议。请保持礼貌和专业。
|
||||||
|
|||||||
@ -1,11 +1,10 @@
|
|||||||
from yuxi.utils.paths import (
|
from yuxi.utils.paths import (
|
||||||
VIRTUAL_PATH_PREFIX,
|
|
||||||
VIRTUAL_PATH_WORKSPACE,
|
|
||||||
VIRTUAL_PATH_OUTPUTS,
|
VIRTUAL_PATH_OUTPUTS,
|
||||||
|
VIRTUAL_PATH_PREFIX,
|
||||||
VIRTUAL_PATH_UPLOADS,
|
VIRTUAL_PATH_UPLOADS,
|
||||||
|
VIRTUAL_PATH_WORKSPACE,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
DEEP_PROMPT = f"""你是一位专家级研究员。你的工作是进行彻底的研究,然后撰写一份精美的报告。
|
DEEP_PROMPT = f"""你是一位专家级研究员。你的工作是进行彻底的研究,然后撰写一份精美的报告。
|
||||||
|
|
||||||
你应该做的第一件事是把原始的用户问题写入 `question.txt`,以便你有一个记录。
|
你应该做的第一件事是把原始的用户问题写入 `question.txt`,以便你有一个记录。
|
||||||
|
|||||||
@ -15,8 +15,8 @@ from yuxi import config, graph_base
|
|||||||
from yuxi.agents.toolkits.registry import ToolExtraMetadata, _all_tool_instances, _extra_registry, tool
|
from yuxi.agents.toolkits.registry import ToolExtraMetadata, _all_tool_instances, _extra_registry, tool
|
||||||
from yuxi.storage.minio import aupload_file_to_minio
|
from yuxi.storage.minio import aupload_file_to_minio
|
||||||
from yuxi.utils import logger
|
from yuxi.utils import logger
|
||||||
from yuxi.utils.question_utils import normalize_questions
|
|
||||||
from yuxi.utils.paths import VIRTUAL_PATH_OUTPUTS
|
from yuxi.utils.paths import VIRTUAL_PATH_OUTPUTS
|
||||||
|
from yuxi.utils.question_utils import normalize_questions
|
||||||
|
|
||||||
# Lazy initialization for TavilySearch (only when API key is available)
|
# Lazy initialization for TavilySearch (only when API key is available)
|
||||||
_tavily_search_instance = None
|
_tavily_search_instance = None
|
||||||
@ -67,9 +67,7 @@ if config.enable_web_search:
|
|||||||
class PresentArtifactsInput(BaseModel):
|
class PresentArtifactsInput(BaseModel):
|
||||||
"""Expose artifact files to the frontend after the agent finishes."""
|
"""Expose artifact files to the frontend after the agent finishes."""
|
||||||
|
|
||||||
filepaths: list[str] = Field(
|
filepaths: list[str] = Field(description=f"需要展示给用户的文件绝对路径列表,只允许位于 {VIRTUAL_PATH_OUTPUTS} 下")
|
||||||
description=f"需要展示给用户的文件绝对路径列表,只允许位于 {VIRTUAL_PATH_OUTPUTS} 下"
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
def _normalize_presented_artifact_path(filepath: str, runtime: ToolRuntime) -> str:
|
def _normalize_presented_artifact_path(filepath: str, runtime: ToolRuntime) -> str:
|
||||||
|
|||||||
@ -559,7 +559,6 @@ async def agent_chat(
|
|||||||
message_type=message_type,
|
message_type=message_type,
|
||||||
)
|
)
|
||||||
trace_info: dict[str, Any] = {}
|
trace_info: dict[str, Any] = {}
|
||||||
last_agent_state_signature = ""
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
conv_repo = ConversationRepository(db)
|
conv_repo = ConversationRepository(db)
|
||||||
@ -986,6 +985,7 @@ async def stream_agent_resume(
|
|||||||
message_type="resume",
|
message_type="resume",
|
||||||
)
|
)
|
||||||
trace_info: dict[str, Any] = {}
|
trace_info: dict[str, Any] = {}
|
||||||
|
last_agent_state_signature = ""
|
||||||
|
|
||||||
stream_source = graph.astream(
|
stream_source = graph.astream(
|
||||||
resume_command,
|
resume_command,
|
||||||
|
|||||||
@ -1,4 +1,5 @@
|
|||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
from yuxi import config
|
from yuxi import config
|
||||||
|
|
||||||
VIRTUAL_PATH_PREFIX = config.sandbox_virtual_path_prefix
|
VIRTUAL_PATH_PREFIX = config.sandbox_virtual_path_prefix
|
||||||
|
|||||||
@ -106,7 +106,6 @@
|
|||||||
--bg-sider: var(--main-5);
|
--bg-sider: var(--main-5);
|
||||||
--color-text: var(--c-black);
|
--color-text: var(--c-black);
|
||||||
|
|
||||||
|
|
||||||
--light-98: rgba(255, 255, 255, 0.98);
|
--light-98: rgba(255, 255, 255, 0.98);
|
||||||
--light-95: rgba(255, 255, 255, 0.95);
|
--light-95: rgba(255, 255, 255, 0.95);
|
||||||
--light-90: rgba(255, 255, 255, 0.9);
|
--light-90: rgba(255, 255, 255, 0.9);
|
||||||
@ -133,7 +132,6 @@
|
|||||||
--dark-5: rgba(0, 0, 0, 0.05);
|
--dark-5: rgba(0, 0, 0, 0.05);
|
||||||
--dark-0: rgba(0, 0, 0, 0);
|
--dark-0: rgba(0, 0, 0, 0);
|
||||||
|
|
||||||
|
|
||||||
/* Shadow System - 阴影系统 */
|
/* Shadow System - 阴影系统 */
|
||||||
--shadow-0: rgba(0, 0, 0, 0.02);
|
--shadow-0: rgba(0, 0, 0, 0.02);
|
||||||
--shadow-1: rgba(0, 0, 0, 0.05);
|
--shadow-1: rgba(0, 0, 0, 0.05);
|
||||||
|
|||||||
@ -98,7 +98,6 @@
|
|||||||
--bg-sider: #141414;
|
--bg-sider: #141414;
|
||||||
--color-text: #ffffff;
|
--color-text: #ffffff;
|
||||||
|
|
||||||
|
|
||||||
--dark-98: rgba(255, 255, 255, 0.98);
|
--dark-98: rgba(255, 255, 255, 0.98);
|
||||||
--dark-95: rgba(255, 255, 255, 0.95);
|
--dark-95: rgba(255, 255, 255, 0.95);
|
||||||
--dark-90: rgba(255, 255, 255, 0.9);
|
--dark-90: rgba(255, 255, 255, 0.9);
|
||||||
|
|||||||
@ -140,7 +140,11 @@
|
|||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<template v-else-if="file?.previewType === 'pdf' && file?.previewUrl">
|
<template v-else-if="file?.previewType === 'pdf' && file?.previewUrl">
|
||||||
<iframe :src="file.previewUrl" class="pdf-preview fullscreen-embed-preview" :title="filePath" />
|
<iframe
|
||||||
|
:src="file.previewUrl"
|
||||||
|
class="pdf-preview fullscreen-embed-preview"
|
||||||
|
:title="filePath"
|
||||||
|
/>
|
||||||
</template>
|
</template>
|
||||||
<template v-else-if="isHtmlFile && htmlPreviewMode === 'render'">
|
<template v-else-if="isHtmlFile && htmlPreviewMode === 'render'">
|
||||||
<iframe
|
<iframe
|
||||||
@ -305,14 +309,11 @@ watch(
|
|||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
watch(
|
watch([() => props.filePath, () => props.file?.previewType, () => props.file?.content], () => {
|
||||||
[() => props.filePath, () => props.file?.previewType, () => props.file?.content],
|
if (isHtmlFile.value) {
|
||||||
() => {
|
htmlPreviewRenderKey.value += 1
|
||||||
if (isHtmlFile.value) {
|
|
||||||
htmlPreviewRenderKey.value += 1
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
)
|
})
|
||||||
|
|
||||||
watch(fullscreenPreviewVisible, (visible) => {
|
watch(fullscreenPreviewVisible, (visible) => {
|
||||||
document.body.style.overflow = visible ? 'hidden' : ''
|
document.body.style.overflow = visible ? 'hidden' : ''
|
||||||
@ -490,7 +491,7 @@ onUnmounted(() => {
|
|||||||
min-height: calc(80vh - 40px);
|
min-height: calc(80vh - 40px);
|
||||||
border: none;
|
border: none;
|
||||||
border-radius: 0px;
|
border-radius: 0px;
|
||||||
background: #fff; // HTML 内容通常需要白色背景以保证可读性
|
background: #fff; // HTML 内容通常需要白色背景以保证可读性
|
||||||
}
|
}
|
||||||
|
|
||||||
.unsupported-preview {
|
.unsupported-preview {
|
||||||
|
|||||||
@ -43,7 +43,9 @@
|
|||||||
<div class="todo-popover-header">
|
<div class="todo-popover-header">
|
||||||
<div class="todo-popover-title-wrap">
|
<div class="todo-popover-title-wrap">
|
||||||
<span class="todo-popover-title">当前任务</span>
|
<span class="todo-popover-title">当前任务</span>
|
||||||
<span class="todo-popover-summary">{{ completedTodoCount }}/{{ totalTodoCount }} 已完成</span>
|
<span class="todo-popover-summary"
|
||||||
|
>{{ completedTodoCount }}/{{ totalTodoCount }} 已完成</span
|
||||||
|
>
|
||||||
</div>
|
</div>
|
||||||
<span class="todo-popover-progress">{{ todoProgress }}%</span>
|
<span class="todo-popover-progress">{{ todoProgress }}%</span>
|
||||||
</div>
|
</div>
|
||||||
@ -53,7 +55,11 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="todo-popover-list">
|
<div class="todo-popover-list">
|
||||||
<div v-for="(todo, index) in todos" :key="`${todo.content}-${index}`" class="todo-item">
|
<div
|
||||||
|
v-for="(todo, index) in todos"
|
||||||
|
:key="`${todo.content}-${index}`"
|
||||||
|
class="todo-item"
|
||||||
|
>
|
||||||
<div class="todo-item-icon" :class="todo.status || 'unknown'">
|
<div class="todo-item-icon" :class="todo.status || 'unknown'">
|
||||||
<CheckCircleOutlined v-if="todo.status === 'completed'" />
|
<CheckCircleOutlined v-if="todo.status === 'completed'" />
|
||||||
<SyncOutlined v-else-if="todo.status === 'in_progress'" spin />
|
<SyncOutlined v-else-if="todo.status === 'in_progress'" spin />
|
||||||
@ -140,7 +146,9 @@ const todoPopoverOpen = ref(false)
|
|||||||
const placeholder = '问点什么?使用 @ 可以提及哦~'
|
const placeholder = '问点什么?使用 @ 可以提及哦~'
|
||||||
|
|
||||||
const totalTodoCount = computed(() => props.todos.length)
|
const totalTodoCount = computed(() => props.todos.length)
|
||||||
const completedTodoCount = computed(() => props.todos.filter((todo) => todo?.status === 'completed').length)
|
const completedTodoCount = computed(
|
||||||
|
() => props.todos.filter((todo) => todo?.status === 'completed').length
|
||||||
|
)
|
||||||
const showTodoEntry = computed(() => props.hasActiveThread && totalTodoCount.value > 0)
|
const showTodoEntry = computed(() => props.hasActiveThread && totalTodoCount.value > 0)
|
||||||
const todoProgress = computed(() => {
|
const todoProgress = computed(() => {
|
||||||
if (!totalTodoCount.value) return 0
|
if (!totalTodoCount.value) return 0
|
||||||
@ -284,8 +292,7 @@ const getTodoStatusLabel = (status) => {
|
|||||||
.todo-popover-card {
|
.todo-popover-card {
|
||||||
width: min(300px, calc(100vw - 32px));
|
width: min(300px, calc(100vw - 32px));
|
||||||
padding: 14px;
|
padding: 14px;
|
||||||
background:
|
background: linear-gradient(180deg, var(--gray-50) 0%, var(--gray-50) 100%);
|
||||||
linear-gradient(180deg, var(--gray-50) 0%, var(--gray-50) 100%);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.todo-popover-header {
|
.todo-popover-header {
|
||||||
|
|||||||
@ -72,7 +72,11 @@
|
|||||||
<Star :size="12" />
|
<Star :size="12" />
|
||||||
<span>支持项目</span>
|
<span>支持项目</span>
|
||||||
</div>
|
</div>
|
||||||
<button class="star-card-close lucide-icon-btn" @click="dismissStarCard" aria-label="关闭 Star 提示">
|
<button
|
||||||
|
class="star-card-close lucide-icon-btn"
|
||||||
|
@click="dismissStarCard"
|
||||||
|
aria-label="关闭 Star 提示"
|
||||||
|
>
|
||||||
<X :size="14" />
|
<X :size="14" />
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
@ -171,7 +175,16 @@
|
|||||||
<script setup>
|
<script setup>
|
||||||
import { computed, onMounted, ref, watch } from 'vue'
|
import { computed, onMounted, ref, watch } from 'vue'
|
||||||
import { useUserStore } from '@/stores/user'
|
import { useUserStore } from '@/stores/user'
|
||||||
import { ExternalLink, Key as KeyIcon, Settings, SquareCode, Star, User, Users, X } from 'lucide-vue-next'
|
import {
|
||||||
|
ExternalLink,
|
||||||
|
Key as KeyIcon,
|
||||||
|
Settings,
|
||||||
|
SquareCode,
|
||||||
|
Star,
|
||||||
|
User,
|
||||||
|
Users,
|
||||||
|
X
|
||||||
|
} from 'lucide-vue-next'
|
||||||
import BasicSettingsSection from '@/components/BasicSettingsSection.vue'
|
import BasicSettingsSection from '@/components/BasicSettingsSection.vue'
|
||||||
import ModelProvidersComponent from '@/components/ModelProvidersComponent.vue'
|
import ModelProvidersComponent from '@/components/ModelProvidersComponent.vue'
|
||||||
import UserManagementComponent from '@/components/UserManagementComponent.vue'
|
import UserManagementComponent from '@/components/UserManagementComponent.vue'
|
||||||
|
|||||||
@ -15,7 +15,4 @@ export const shouldAutoOpenAgentPanel = (threadFiles) => {
|
|||||||
return threadFiles.some((item) => item?.is_dir !== true && isTrackedPanelFilePath(item?.path))
|
return threadFiles.some((item) => item?.is_dir !== true && isTrackedPanelFilePath(item?.path))
|
||||||
}
|
}
|
||||||
|
|
||||||
export {
|
export { USER_DATA_OUTPUTS_PREFIX, USER_DATA_UPLOADS_PREFIX }
|
||||||
USER_DATA_OUTPUTS_PREFIX,
|
|
||||||
USER_DATA_UPLOADS_PREFIX
|
|
||||||
}
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user