langgenius / dify

Dify is an open-source LLM app development platform. Dify's intuitive interface combines AI workflow, RAG pipeline, agent capabilities, model management, observability features and more, letting you quickly go from prototype to production.
https://dify.ai
Other
51.67k stars 7.48k forks source link

In logging and annotation, the log is empty with no records after being opened. #10719

Open liuxiaochenlcx opened 3 hours ago

liuxiaochenlcx commented 3 hours ago

Self Checks

Dify version

0.11.1

Cloud or Self Hosted

Self Hosted (Docker)

Steps to reproduce

Using Docker Compose to newly deploy the latest version of Dify on the company’s virtual machine. Import the previous DSL and call it normally via the API. After the call, click on Logging and Annotation, then click on a log entry.

✔️ Expected Behavior

There should be call details displayed.

❌ Actual Behavior

b5e5dd46380d2b5011337439d776265
dosubot[bot] commented 3 hours ago

Hello, @liuxiaochenlcx! I'm here to assist you with any bugs, questions, or contributions you may have. Let's work together to resolve the issue you're experiencing.

I couldn't find a specific solution to the issue of empty logs in Dify version 0.11.1. However, there are some related discussions and issues that might be helpful:

  1. A similar issue was discussed in this thread, where users faced problems with log files in Docker. Although this discussion is unsolved, it might provide some insights or similar experiences.

  2. There was an issue with logging in Docker Compose for version 0.6.9, which was resolved by initializing the logging configuration before any other log configurations. You can find the details of the solution in this issue. Although this is for an earlier version, the approach might be applicable or provide a starting point for troubleshooting.

For Dify version 0.11.1, ensure that your logging configurations in the docker-compose.yaml file are correctly set up. The configurations include settings for LOG_LEVEL, LOG_FILE, LOG_FILE_MAX_SIZE, LOG_FILE_BACKUP_COUNT, LOG_DATEFORMAT, and LOG_TZ [1][2].

If the problem persists, you might want to check the logging handlers and dependencies used in Dify, such as RotatingFileHandler and pytz for timezone handling [3]. These components could be relevant to the issue you're experiencing.

To continue talking to Dosu, mention @dosu.

crazywoola commented 3 hours ago

@xuzuodong

function getThreadMessages(tree: ChatItemInTree[], targetMessageId?: string): ChatItemInTree[] {
  let ret: ChatItemInTree[] = []
  let targetNode: ChatItemInTree | undefined

  // find path to the target message
  const stack = tree.toReversed().map(rootNode => ({
    node: rootNode,
    path: [rootNode],
  }))
  while (stack.length > 0) {
    const { node, path } = stack.pop()!
    if (
      node.id === targetMessageId
      || (!targetMessageId && !node.children?.length && !stack.length) // if targetMessageId is not provided, we use the last message in the tree as the target
    ) {
      targetNode = node
      ret = path.map((item, index) => {
        if (!item.isAnswer)
          return item

        const parentAnswer = path[index - 2]
        const siblingCount = !parentAnswer ? tree.length : parentAnswer.children!.length
        const prevSibling = !parentAnswer ? tree[item.siblingIndex! - 1]?.children?.[0]?.id : parentAnswer.children![item.siblingIndex! - 1]?.children?.[0].id
        const nextSibling = !parentAnswer ? tree[item.siblingIndex! + 1]?.children?.[0]?.id : parentAnswer.children![item.siblingIndex! + 1]?.children?.[0].id

        return { ...item, siblingCount, prevSibling, nextSibling }
      })
      break
    }
    if (node.children) {
      for (let i = node.children.length - 1; i >= 0; i--) {
        stack.push({
          node: node.children[i],
          path: [...path, node.children[i]],
        })
      }
    }
  }

It seems there is something wrong here.

xuzuodong commented 3 hours ago

What browser are you using?

xuzuodong commented 3 hours ago

Looks like toReversed is not compatible to your browser.

https://caniuse.com/?search=toreversed