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