mirror of
https://github.com/csunny/DB-GPT.git
synced 2025-07-30 15:21:02 +00:00
fix:client path error and update chat_knowledge prompt
This commit is contained in:
parent
b4b810d68f
commit
a1369c02c4
@ -14,14 +14,22 @@ PROMPT_SCENE_DEFINE = """A chat between a curious user and an artificial intelli
|
||||
The assistant gives helpful, detailed, professional and polite answers to the user's questions. """
|
||||
|
||||
|
||||
_DEFAULT_TEMPLATE_ZH = """ 基于以下已知的信息, 专业、简要的回答用户的问题,
|
||||
如果无法从提供的内容中获取答案, 请说: "知识库中提供的内容不足以回答此问题" 禁止胡乱编造, 回答的时候最好按照1.2.3.点进行总结。
|
||||
_DEFAULT_TEMPLATE_ZH = """ 基于以下给出的已知信息, 准守规范约束,专业、简要回答用户的问题.
|
||||
规范约束:
|
||||
1.如果已知信息包含的图片、链接、表格、代码块等特殊markdown标签格式的信息,确保在答案中包含原文这些图片、链接、表格和代码标签,不要丢弃不要修改,如:图片格式:, 链接格式:[xxx](xxx), 表格格式:|xxx|xxx|xxx|, 代码格式:```xxx```.
|
||||
2.如果无法从提供的内容中获取答案, 请说: "知识库中提供的内容不足以回答此问题" 禁止胡乱编造.
|
||||
3.回答的时候最好按照1.2.3.点进行总结.
|
||||
已知内容:
|
||||
{context}
|
||||
问题:
|
||||
{question},请使用和用户相同的语言进行回答.
|
||||
"""
|
||||
_DEFAULT_TEMPLATE_EN = """ Based on the known information below, provide users with professional and concise answers to their questions. If the answer cannot be obtained from the provided content, please say: "The information provided in the knowledge base is not sufficient to answer this question." It is forbidden to make up information randomly. When answering, it is best to summarize according to points 1.2.3.
|
||||
_DEFAULT_TEMPLATE_EN = """ Based on the known information below, provide users with professional and concise answers to their questions.
|
||||
constraints:
|
||||
1.Ensure to include original markdown formatting elements such as images, links, tables, or code blocks without alteration in the response if they are present in the provided information.
|
||||
For example, image format should be , link format [xxx](xxx), table format should be represented with |xxx|xxx|xxx|, and code format with xxx.
|
||||
2.If the information available in the knowledge base is insufficient to answer the question, state clearly: "The content provided in the knowledge base is not enough to answer this question," and avoid making up answers.
|
||||
3.When responding, it is best to summarize the points in the order of 1, 2, 3.
|
||||
known information:
|
||||
{context}
|
||||
question:
|
||||
|
@ -10,8 +10,8 @@ from dbgpt.core.schema.api import ChatCompletionResponse, ChatCompletionStreamRe
|
||||
|
||||
from .schema import ChatCompletionRequestBody
|
||||
|
||||
CLIENT_API_PATH = "/api"
|
||||
CLIENT_SERVE_PATH = "/serve"
|
||||
CLIENT_API_PATH = "api"
|
||||
CLIENT_SERVE_PATH = "serve"
|
||||
|
||||
|
||||
class ClientException(Exception):
|
||||
@ -274,7 +274,7 @@ class Client:
|
||||
"""
|
||||
try:
|
||||
response = await self._http_client.get(
|
||||
self._api_url + CLIENT_SERVE_PATH + path,
|
||||
f"{self._api_url}/{CLIENT_SERVE_PATH}{path}",
|
||||
*args,
|
||||
)
|
||||
return response
|
||||
@ -290,7 +290,7 @@ class Client:
|
||||
"""
|
||||
try:
|
||||
return await self._http_client.post(
|
||||
self._api_url + CLIENT_SERVE_PATH + path,
|
||||
f"{self._api_url}/{CLIENT_SERVE_PATH}{path}",
|
||||
json=args,
|
||||
)
|
||||
finally:
|
||||
@ -305,7 +305,7 @@ class Client:
|
||||
"""
|
||||
try:
|
||||
return await self._http_client.post(
|
||||
self._api_url + CLIENT_SERVE_PATH + path,
|
||||
f"{self._api_url}/{CLIENT_SERVE_PATH}{path}",
|
||||
params=args,
|
||||
)
|
||||
finally:
|
||||
@ -318,7 +318,9 @@ class Client:
|
||||
path: str, The path to patch.
|
||||
args: Any, The arguments to pass to the patch.
|
||||
"""
|
||||
return self._http_client.patch(self._api_url + CLIENT_SERVE_PATH + path, *args)
|
||||
return self._http_client.patch(
|
||||
f"{self._api_url}/{CLIENT_SERVE_PATH}{path}", *args
|
||||
)
|
||||
|
||||
async def put(self, path: str, args):
|
||||
"""Put method.
|
||||
@ -329,7 +331,7 @@ class Client:
|
||||
"""
|
||||
try:
|
||||
return await self._http_client.put(
|
||||
self._api_url + CLIENT_SERVE_PATH + path, json=args
|
||||
f"{self._api_url}/{CLIENT_SERVE_PATH}{path}", json=args
|
||||
)
|
||||
finally:
|
||||
await self._http_client.aclose()
|
||||
@ -343,7 +345,7 @@ class Client:
|
||||
"""
|
||||
try:
|
||||
return await self._http_client.delete(
|
||||
self._api_url + CLIENT_SERVE_PATH + path, *args
|
||||
f"{self._api_url}/{CLIENT_SERVE_PATH}{path}", *args
|
||||
)
|
||||
finally:
|
||||
await self._http_client.aclose()
|
||||
|
Loading…
Reference in New Issue
Block a user